Tensorflow Object Detection API Train from exported model checkpoint
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.
Introduction
In the TensorFlow Object Detection API, training resumes from checkpoint files, not from the SavedModel serving directory itself. The main job is to point pipeline.config at a compatible checkpoint prefix, set the checkpoint type correctly, and keep the model architecture aligned with the weights you are restoring.
Distinguish Checkpoints from SavedModel Exports
This topic gets confusing because an exported model package may contain several artifacts. For training, the Object Detection API restores from checkpoint files such as ckpt-0, ckpt-12, or whatever latest checkpoint exists. A SavedModel export is for inference and serving.
That means the important distinction is:
- use checkpoint files for training or fine-tuning
- use the exported SavedModel for inference
If an export directory includes a checkpoint/ folder, you still restore from the checkpoint prefix inside that folder, not from the saved_model directory.
Arrange the Workspace Clearly
A clean layout reduces mistakes when you edit pipeline.config.
Keeping your editable config under models/my_ssd/ and your export artifacts under a separate folder makes it much easier to reason about what is used for training versus serving.
Configure pipeline.config Correctly
Three settings are the most important during fine-tuning:
- '
num_classes' - '
fine_tune_checkpoint' - '
fine_tune_checkpoint_type'
A minimal example looks like this:
The fine_tune_checkpoint value should point to the checkpoint prefix such as ckpt-0. Do not point it at the containing folder only, and do not point it at the .index file alone.
fine_tune_checkpoint_type should match the weights you are restoring. If you are starting from a pretrained detection model, "detection" is usually the right value.
Launch Training and Resume Safely
Training normally runs through model_main_tf2.py.
Watch the startup logs. They should show that variables were restored from the checkpoint. If many variables are skipped unexpectedly, treat that as a configuration problem until you verify otherwise.
To resume your own interrupted run, rerun the trainer with the same model_dir.
In that case, the API restores from the latest checkpoint in model_dir, which is different from the original fine-tune checkpoint you started from.
Export Only After Training
Once training completes, export a serving artifact for inference.
A quick sanity check helps confirm the export is usable:
That validates the serving artifact without confusing it with training state.
When an Exported Checkpoint Is Usable
If someone says they want to train from an exported model checkpoint, the precise answer is: yes, if they mean the actual checkpoint files packaged alongside the export and those checkpoints are compatible with the target architecture. No, if they mean the SavedModel serving directory alone.
That wording matters because many failed training runs are caused by pointing the fine-tune path at the wrong artifact rather than by a deeper model issue.
Common Pitfalls
The biggest mistake is confusing the SavedModel export with the checkpoint prefix. They serve different purposes.
Another issue is forgetting to update num_classes, label map paths, or input record paths when adapting a checkpoint to a new dataset. The model may restore successfully but still be configured for the wrong task.
Be careful with checkpoint type as well. A mismatch between model architecture and restore type can silently skip variables and degrade training quality.
Finally, if the label semantics changed significantly, do not try to continue a run blindly. Start a fresh fine-tuning experiment with a clear configuration instead.
Summary
- Fine-tuning uses checkpoint files, not the SavedModel directory.
- Point
fine_tune_checkpointat a checkpoint prefix such asckpt-0. - Set
fine_tune_checkpoint_typeandnum_classescorrectly inpipeline.config. - Resume interrupted training from
model_dir, not from a new export path. - Export a SavedModel only after training is complete.
Related reading
- tensorflow object detection API training fails silently
- TensorFlow Object Detection API Weird Behavior
- TensorFlow Object Detection API Weird Behavior
- Tensorflow object detection config files documentation
- Tensorflow object detection evaluation pycocotools missing
- tensorflow object detection Fine-tuning a model from an existing checkpoint
- Tensorflow Object detection model evaluation on Test Dataset
- TensorFlow object detection TF-TRT Warning Could not find TensorRT

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.