Created
October 29, 2018 16:23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = Sequential() | |
model.add(Conv2D(32, kernel_size=(3, 3), | |
activation='relu', | |
input_shape=input_shape)) | |
model.add(Conv2D(64, (3, 3), activation='relu')) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Dropout(0.40)) #0.4 removed as it is bad of tflite # 0.25 | |
model.add(Flatten()) | |
model.add(Dense(128, activation='relu')) | |
model.add(Dropout(0.25)) #0.25 removed as it is bad of tflite # 0.5 | |
model.add(Dense(num_classes, activation='sigmoid')) #sigmoid | |
model.compile(loss=keras.losses.binary_crossentropy, | |
optimizer=keras.optimizers.Adadelta(), | |
metrics=['accuracy']) | |
filepath="weights-improvement-{epoch:02d}-{val_acc:.2f}.hdf5" | |
checkpoint = ModelCheckpoint(filepath, monitor='val_acc', verbose=1, save_best_only=True, mode='max', period=5) | |
callbacks_list = [checkpoint] | |
model.fit(x_train, y_train, | |
batch_size=batch_size, | |
epochs=epochs, | |
verbose=1, | |
callbacks=callbacks_list, | |
validation_data=(x_test, y_test)) | |
score = model.evaluate(x_test, y_test, verbose=5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment