Skip to content

Instantly share code, notes, and snippets.

@nonlinearjunkie
Created July 1, 2020 10:39
Show Gist options
  • Save nonlinearjunkie/87885a43b4807ce7e0077f5d3fda0ec3 to your computer and use it in GitHub Desktop.
Save nonlinearjunkie/87885a43b4807ce7e0077f5d3fda0ec3 to your computer and use it in GitHub Desktop.
position_block_15 = base_model.get_layer('block_15_add')
for layer in base_model.layers:
layer.trainable = True
all_layers = base_model.layers
for i in range(base_model.layers.index(position_block_15)):
all_layers[i].trainable = False
model_transfered_1.compile(optimizer=Adam(lr=0.0005),
loss='categorical_crossentropy', metrics=['categorical_accuracy'])
epochs = 14
steps_per_epoch = train_generator.n//train_generator.batch_size
validation_steps = validation_generator.n//validation_generator.batch_size
history = model_transfered_1.fit(
x=train_generator,
steps_per_epoch=steps_per_epoch,
epochs=epochs,
validation_data = validation_generator,
validation_steps = validation_steps,
shuffle=True
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment