Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def keras_model(image_x, image_y):
- num_of_classes = 12
- model = Sequential()
- model.add(Conv2D(32, (5, 5), input_shape=(image_x, image_y, 1), activation='relu'))
- model.add(MaxPooling2D(pool_size=(2, 2), strides=(2, 2), padding='same'))
- model.add(Conv2D(64, (5, 5), activation='sigmoid'))
- model.add(MaxPooling2D(pool_size=(5, 5), strides=(5, 5), padding='same'))
- model.add(Flatten())
- model.add(Dense(1024, activation='relu'))
- model.add(Dropout(0.6))
- model.add(Dense(num_of_classes, activation='softmax'))
- model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
- filepath = "hand_exp.h5"
- checkpoint1 = ModelCheckpoint(filepath, monitor='val_acc', verbose=1, save_best_only=True, mode='max')
- callbacks_list = [checkpoint1]
- return model, callbacks_list
Add Comment
Please, Sign In to add comment