Last active
August 28, 2020 16:28
-
-
Save shayaf84/6c0f38f231dd76632bec1cfe09002c05 to your computer and use it in GitHub Desktop.
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
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