- 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.
- 數據庫應用實戰
- 算法競賽入門經典:習題與解答
- 數據庫基礎與應用:Access 2010
- Java Data Science Cookbook
- Learning Spring Boot
- MySQL 8.x從入門到精通(視頻教學版)
- Power BI商業數據分析完全自學教程
- MATLAB Graphics and Data Visualization Cookbook
- Splunk智能運維實戰
- SAS金融數據挖掘與建模:系統方法與案例解析
- 云工作時代:科技進化必將帶來的新工作方式
- 智能與數據重構世界
- 企業級大數據項目實戰:用戶搜索行為分析系統從0到1
- Visual Studio 2012 and .NET 4.5 Expert Development Cookbook
- 碼上行動:利用Python與ChatGPT高效搞定Excel數據分析