Keras implementation of YOLOv4
Is it possible in this Keras implementation of YOLOv4 to somehow continue training from the last saved best weights? Something like the following:
model_checkpoint_callback = tf.keras.callbacks.ModelCheckpoint(
filepath=checkpoint_filepath,
monitor='val_binary_accuracy',
mode='max',
save_best_only=True)
model.load_weights(checkpoint_filepath)
According to these lines the repository automatically handles the weights on your path; So to load a pre-trained weights (either .h5
checkpoint or .weights
to do transfer learning, and follow training notebooks for the rest;
model = Yolov4(weight_path='mytraining.weights',
class_name_path=class_name_path)
Update: (from the comments of OP)
Pre-trained weights can be loaded for transfer learning by passing the path to ".h5" checkpoint file to weight_path
argumentwith the following amendment in models.py
: replace line 75:
if load_pretrained and self.weight_path and self.weight_path.endswith('.weights'):
with:
if load_pretrained and self.weight_path and (self.weight_path.endswith('.weights') or self.weight_path.endswith('.h5')):
This issue is addressed in this PR.