Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. from keras.models import Sequential
  2. from keras.layers import Input, Dense, Dropout, Flatten
  3. from keras.layers import Conv2D, MaxPooling2D
  4. from keras.layers import Activation
  5. from keras.datasets import mnist
  6.  
  7. def buildModel(inputShape, classCnt):
  8.     model = Sequential()
  9.     model.add(Conv2D(filters=32, kernel_size=3, activation='relu', input_shape=inputShape))
  10.     model.add(Conv2D(filters=32, kernel_size=3, activation='relu'))
  11.     model.add(Conv2D(filters=64, kernel_size=3, activation='relu'))
  12.     model.add(MaxPooling2D(pool_size=4))
  13.     model.add(Flatten())
  14.     model.add(Dense(256, activation='relu'))
  15.     model.add(Dropout(0.5))
  16.  
  17.     model.add(Dense(classCnt, activation='softmax'))
  18.  
  19.     model.compile(optimizer='adagrad', loss='categorical_crossentropy', metrics=['accuracy'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement