[转]keras使用入门及3D神经网络资源
原文链接https://blog.csdn.net/lengxiaomo123/article/details/68926778
- Sequential模型
- 泛型模型
以通过向Sequential模型传递一个layer的list来构造该模型
- compile
- fit
- evaluate
- predict
from keras.layers import Dense,Activationfrom keras.models import Sequentialmodel = Sequential([Dense(10,input_dim=784),Activation('relu'),Dense(10),Activation('relu'),Dense(1),])model.compile(optimizer='rmsprop',loss='binary_crossentropy',metrics=['accuracy'])
- SGD
- RMSprop
- Adadelta
支持一些预定义的合并模式:
- Dense
- Activation
- Dropout
- Flatten
- Convolution2D层
- Convolution3D层
- MaxPooling2D层
- MaxPooling3D层
- AveragePooling2D层
- AveragePooling3D层
model = Sequential()# 160*100*22model.add(Convolution3D(10,kernel_dim1=9, # depthkernel_dim2=9, # rowskernel_dim3=9, # colsinput_shape=(3,160,100,22),activation='relu'))# now 152*92*14model.add(MaxPooling2D(pool_size=(2,2)))# now 76*46*14model.add(Convolution3D(30,kernel_dim1=7, # depthkernel_dim2=9, # rowskernel_dim3=9, # colsactivation='relu'))# now 68*38*8model.add(MaxPooling2D(pool_size=(2,2)))# now 34*19*8model.add(Convolution3D(50,kernel_dim1=5, # depthkernel_dim2=9, # rowskernel_dim3=8, # colsactivation='relu'))# now 26*12*4model.add(MaxPooling2D(pool_size=(2,2)))# now 13*6*4model.add(Convolution3D(150,kernel_dim1=3, # depthkernel_dim2=4, # rowskernel_dim3=3, # colsactivation='relu'))# now 10*4*2model.add(MaxPooling2D(pool_size=(2,2)))# now 5*2*2model.add(Dropout(0.25))model.add(Flatten())model.add(Dense(1500,activation='relu'))model.add(Dense(750,activation='relu'))model.add(Dense(num,activation='softmax')) #classification# Compilemodel.compile(loss='categorical_crossentropy', optimizer='RMSprop', metrics=['accuracy'])
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:[转载]keras使用入门及3D卷积神经网络资源 - Python技术站