Skip to content

Instantly share code, notes, and snippets.

@shayaf84
Last active August 28, 2020 16:28
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/6c0f38f231dd76632bec1cfe09002c05 to your computer and use it in GitHub Desktop.
Save shayaf84/6c0f38f231dd76632bec1cfe09002c05 to your computer and use it in GitHub Desktop.
expert_conv = VGG16(weights = 'imagenet', include_top = False,input_shape=(64,64,3))
for layer in expert_conv.layers:
trainable = True
layer.trainable = trainable
expert_model = Sequential()
expert_model.add(Reshape((64,64,3)))
expert_model.add(expert_conv)
expert_model.add(GlobalAveragePooling2D())
expert_model.add(Dense(128, activation = 'relu'))
expert_model.add(Dropout(0.3))
expert_model.add(Dense(64, activation = 'relu'))
expert_model.add(Dense(1, activation = "sigmoid"))
opt = keras.optimizers.SGD(lr=1e-4, momentum=0.95)
expert_model.compile(loss = "binary_crossentropy", optimizer = opt, \
metrics=['accuracy'])
history =expert_model.fit(train_data,train_labels,validation_data=\
(test_data,test_labels),epochs = 3)
plot_acc(history)
plot_loss(history)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment