I am trying to use ResNet152 ( pretrained on imagenet) to solve a certain classification task. According to Keras, one strategy for transfer learning is that we do not use the Resnet classifier and then we design and train our own classifier but while freezing the Resnet layers ( phase 1) . After that, we unfreeze the Resnet layers and fine-tune the model as a whole ( phase 2) . To do so we set the trainable attribute of the Resnet model to false and we need to set the training argument to false and for phase 2 we need to set the trainable attribute to true so that we can fine tune the whole layers of the model while keeping the batch normalization layers in inference mode, since we have passed the argument training with False in phase 1 and therefore we will not alter the already learned statistics in the batch normalization layers from imagenet . Now what I did is that I have followed the same steps for phase 1 , however, I have saved the model using model.save() , then later ( after many days) I have loaded again the model and I have then fined tuned this model. So here is my question, when I have loaded the model I have compiled and trained the model directly, I am not sure that if the batch normalization layers will work in inference or training mode ? In other words, after loading the model the training argument still has a False value, or do I need to do some extra step after loading the model to make sure that the Batch normalization layers will work in inference mode?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.