I am training a model using Mask RCNN; it saves the model after every epoch as mask_rcnn_building_cfg_0001.h5 (number corresponds epoch number).
I use pre-trained weights for Transfer Learning, which works fine. But now I want to use my own trained model to further train as it is much more optimized.
In codebase, there is this part:
callbacks = [
keras.callbacks.TensorBoard(log_dir=self.log_dir,
histogram_freq=0, write_graph=True, write_images=False),
keras.callbacks.ModelCheckpoint(self.checkpoint_path,
verbose=0, save_weights_only=True),
]
So normally I have to be able to call model.load_weights('mask_rcnn_building_cfg_0001.h5', by_name=True, exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"])
and use saved model for resuming training, but training does not start. But the same load_weights() function works with the pretrained model downloaded from internet and model continues training.
Now, how should I set model paremeters in order to save weights after each epoch, for using in further trainings as pretrained weights?
My best guess is I somehow have to exclue output layer from mask_rcnn_building_cfg_0001.h5, but not sure hw to do that.