Guest User

Untitled

a guest
Jul 16th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. def keras_model(image_x, image_y):
  2. num_of_classes = 12
  3. model = Sequential()
  4. model.add(Conv2D(32, (5, 5), input_shape=(image_x, image_y, 1), activation='relu'))
  5. model.add(MaxPooling2D(pool_size=(2, 2), strides=(2, 2), padding='same'))
  6. model.add(Conv2D(64, (5, 5), activation='sigmoid'))
  7. model.add(MaxPooling2D(pool_size=(5, 5), strides=(5, 5), padding='same'))
  8. model.add(Flatten())
  9. model.add(Dense(1024, activation='relu'))
  10. model.add(Dropout(0.6))
  11. model.add(Dense(num_of_classes, activation='softmax'))
  12.  
  13. model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
  14. filepath = "hand_exp.h5"
  15. checkpoint1 = ModelCheckpoint(filepath, monitor='val_acc', verbose=1, save_best_only=True, mode='max')
  16. callbacks_list = [checkpoint1]
  17.  
  18. return model, callbacks_list
Add Comment
Please, Sign In to add comment