Guest User

Untitled

a guest
Dec 15th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. filepath = "model.h5"
  2.  
  3. # Declare a checkpoint to save the best version of the model
  4. checkpoint = ModelCheckpoint(filepath, monitor='val_top_3_accuracy', verbose=1,
  5. save_best_only=True, mode='max')
  6.  
  7. # Reduce the learning rate as the learning stagnates
  8. reduce_lr = ReduceLROnPlateau(monitor='val_top_3_accuracy', factor=0.5, patience=2,
  9. verbose=1, mode='max', min_lr=0.00001)
  10.  
  11. callbacks_list = [checkpoint, reduce_lr]
  12.  
  13. # Fit the model
  14. history = model.fit_generator(train_batches,
  15. steps_per_epoch=train_steps,
  16. class_weight=class_weights,
  17. validation_data=valid_batches,
  18. validation_steps=val_steps,
  19. epochs=10,
  20. verbose=1,
  21. callbacks=callbacks_list)
Add Comment
Please, Sign In to add comment