0. 写作目的
好记性不如烂笔头。
1. 构建Sequntial()类型的网络
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers.convolutional import Conv2D, MaxPooling2D
def Net():
model = Sequential()
model.add( Conv2D( filters=64, kernel_size=(3,3), strides=(1,1), padding='same',
activation='relu' ) )
model.add( MaxPooling2D(pool_size = (2,2)) )
model.add( Flatten() )
model.add( Dense( 128, activation='relu' ) )
model.add( Dropout( 0.5 ) )
model.add( Dense( 10, activation='softmax' ) )
return model
2. 建立Model类型的模型
2.1 完全手动建立Model类型的模型
from keras.layers import Input, Dense, Flatten, Dropout
from keras.layers.convolutional import Conv2D, MaxPooling2D
from keras.models import Mode