Skip to content
Advertisement

How to continue training with checkpoints using object_detector.EfficientDetLite4Spec tensorflow lite

Preciously I have set my EfficientDetLite4 model “grad_checkpoint=true” in config.yaml. And it had successfully generated some checkpoints. However, I can’t figure out how to use these checkpoints when I want to continue training based on them.

Every time I train the model it just start from the beginning, not from my checkpoints.

The following picture shows my colab file system structure:

my colab file system structure

The following picture shows where my checkpoints store:

model file system here

The following code shows how I configure the model and how I train with the model.

JavaScript

Advertisement

Answer

The source code is the answer !

I ran into the same problem and found out that the model_dir we pass to the TFLite model Maker’s object detector API is only used for saving the model’s weights: that’s why the API never restores from checkpoints.

Having a look at the source code of this API, I noticed it internally uses the standard model.compile and model.fit functions and it saves the model’s weights through the callbacks parameter of model.fit.
This means that, provided that we can get the interal keras model, we can just restore our checkpoints by using model.load_weights !

These are the links to the source code if you want to know more about what some of the functions I use below do:

This is the code:

JavaScript
Advertisement