Skip to content

Instantly share code, notes, and snippets.

@shayaf84
Last active August 16, 2020 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shayaf84/02b820494e50d1708219751a09ad482f to your computer and use it in GitHub Desktop.
Save shayaf84/02b820494e50d1708219751a09ad482f to your computer and use it in GitHub Desktop.
model = Sequential()
model.add(Reshape((64,64,3)))
model.add(Conv2D(32, (3, 3), padding = 'same', \
activation="relu",input_shape = (2000,64,64,3)))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.5))
model.add(Conv2D(32, (3, 3), padding = 'same',activation="relu"))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dropout(0.5))
model.add(Dense(32, activation = 'relu'))
model.add(Dropout(0.5))
model.add(Dense(1, activation = 'sigmoid'))
opt = keras.optimizers.rmsprop(lr=1e-4, decay=1e-6)
model.compile(loss="binary_crossentropy",optimizer=opt,metrics=['accuracy'])
monitor = ModelCheckpoint('./model.h5', monitor='val_acc', verbose=0,\
save_best_only=True, save_weights_only=False,\
mode='auto', period=1)
history = model.fit(train_data, train_labels, epochs = 15,\
validation_data = (test_data, test_labels),callbacks=[monitor])
plot_acc(history)
plot_loss(history)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment