- 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.
- 數(shù)據(jù)浪潮
- 計算機(jī)組成原理與接口技術(shù):基于MIPS架構(gòu)實(shí)驗(yàn)教程(第2版)
- 企業(yè)數(shù)字化創(chuàng)新引擎:企業(yè)級PaaS平臺HZERO
- Python絕技:運(yùn)用Python成為頂級數(shù)據(jù)工程師
- 數(shù)據(jù)庫基礎(chǔ)與應(yīng)用:Access 2010
- Word 2010中文版完全自學(xué)手冊
- 云計算環(huán)境下的信息資源集成與服務(wù)
- Architects of Intelligence
- Libgdx Cross/platform Game Development Cookbook
- 3D計算機(jī)視覺:原理、算法及應(yīng)用
- 深入淺出MySQL:數(shù)據(jù)庫開發(fā)、優(yōu)化與管理維護(hù)(第2版)
- 數(shù)據(jù)庫程序員面試筆試真題庫
- 大數(shù)據(jù)精準(zhǔn)挖掘
- Apache Kylin權(quán)威指南
- Node.js High Performance