- Practical Convolutional Neural Networks
- Mohit Sewak Md. Rezaul Karim Pradeep Pujari
- 207字
- 2021-06-24 18:58:51
Layers in the Keras model
A Keras layer is just like a neural network layer. There are fully connected layers, max pool layers, and activation layers. A layer can be added to the model using the model's add() function. For example, a simple model can be represented by the following:
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Flatten
#Creating the Sequential model
model = Sequential()
#Layer 1 - Adding a flatten layer
model.add(Flatten(input_shape=(32, 32, 3)))
#Layer 2 - Adding a fully connected layer
model.add(Dense(100))
#Layer 3 - Adding a ReLU activation layer
model.add(Activation('relu'))
#Layer 4- Adding a fully connected layer
model.add(Dense(60))
#Layer 5 - Adding an ReLU activation layer
model.add(Activation('relu'))
Keras will automatically infer the shape of all layers after the first layer. This means you only have to set the input dimensions for the first layer. The first layer from the preceding code snippet, model.add(Flatten(input_shape=(32, 32, 3))), sets the input dimension to (32, 32, 3) and the output dimension to (3072=32 x 32 x 3). The second layer takes in the output of the first layer and sets the output dimensions to (100). This chain of passing the output to the next layer continues until the last layer, which is the output of the model.
- Hands-On Machine Learning with Microsoft Excel 2019
- 數據之巔:數據的本質與未來
- 文本挖掘:基于R語言的整潔工具
- 大數據架構和算法實現之路:電商系統的技術實戰
- 數字媒體交互設計(初級):Web產品交互設計方法與案例
- Python數據分析與數據化運營
- Hadoop集群與安全
- Augmented Reality using Appcelerator Titanium Starter
- The Natural Language Processing Workshop
- 商業智能工具應用與數據可視化
- 數據庫原理與設計實驗教程(MySQL版)
- Access 2010數據庫應用技術教程(第二版)
- 推薦系統全鏈路設計:原理解讀與業務實踐
- 一本書講透數據治理:戰略、方法、工具與實踐
- Swift 2 By Example