March 2018
Intermediate to advanced
272 pages
7h 53m
English
For this model we're going to train twice. For the first round of training we will do feature extraction for 10 epochs by training with the network frozen, only adjusting the fully connected layer weights, as we discussed in the Transfer network architecture section. Then, in the next section we will unfreeze some of the layers and train again, fine-tuning for another 10 epochs, as shown in the following code:
data_dir = "data/train/"val_dir = "data/val/"epochs = 10batch_size = 30model = build_model_feature_extraction()train_generator, val_generator = setup_data(data_dir, val_dir)callbacks_fe = create_callbacks(name='feature_extraction')# stage 1 fitmodel.fit_generator( train_generator, steps_per_epoch=train_generator.n ...