Search code examples
pythonmachine-learningtensorflowobject-detection

Unable to load finetune_checkpoint in object detection training


I am following this tutorial.

I am using Oxford-IIIT Pet data and config file similar to this.

In the pipeline_config file, I have specified fine tune check point as

fine_tune_checkpoint: "{PATH TO}/ssd_mobilenet_v1_coco_11_06_2017/model.ckpt"
from_detection_checkpoint: false

But when I run, python object_detection/train.py ... --train_dir=${PATH_TO_TRAIN_DIR}

I am getting a list of warnings.

WARNING:root:Variable [MobilenetV1/Conv2d_0/BatchNorm/beta] not available in checkpoint.

.

.

.

WARNING:root:Variable [MobilenetV1/Conv2d_9_pointwise/weights] not available in checkpoint

and program exits saying

ValueError: No variables to save

I have inspected the ckpt in python using

print_tensors_in_checkpoint_file('{PATH TO}/ssd_mobilenet_v1_coco_11_06_2017/model.ckpt/model.ckpt', '',"")

The output was a list.

FeatureExtractor/MobilenetV1/Conv2d_0/BatchNorm/beta (DT_FLOAT) [32]

.

.

.

FeatureExtractor/MobilenetV1/Conv2d_9_pointwise/weights (DT_FLOAT) [1,1,512,512]

Note:Training script runs fine when finetune_checkpoint is disabled by

from_detection_checkpoint: true

in pipeline config file


Solution

  • Setting from_detection_checkpoint: true is actually required for the checkpoint file that you are using because that model was trained as a detector (so nothing is being disabled).

    You would only set from_detection_checkpoint: false if you wanted to train starting from one of the Slim models that was pre-trained for Imagenet classification.