Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tensorflow object detection Fine-tuning a model from an existing checkpoint

I'm trying to train a model from an existing checkpoint following the these instructions.

I have configured the Object Detection Training Pipeline using the faster_rcnn_resnet101_voc07.config configuration.

In checkpoint section I have set the directory where are located the checkpoint files of the pretrained model faster_rcnn_resnet101_coco.tar.gz

Acording the to this issue the fine_tune_checkpoint can be a path to a directory containing the three files: (.data-00000-of-00001, .index, .meta).

So I set the path to the directory "/home/docs/car_dataset/models/model/train"

gradient_clipping_by_norm: 10.0
  fine_tune_checkpoint: "/home/docs/car_dataset/models/model/train"
  from_detection_checkpoint: true
  num_steps: 800000
  data_augmentation_options {
    random_horizontal_flip {
    }
  }

However when I execute the script for training:

python object_detection/train.py     --logtostderr\
--pipeline_config_path=/home/docs/car_dataset/models/model/faster_rcnn_resnet101_voc07.config\
--train_dir=/home/docs/car_dataset/models/model/train\
--num_gpus=2

I got the error:

tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file /home/docs/car_dataset/models/model/train: Failed precondition: /home/docs/car_dataset/models/model/train: perhaps your file is in a different file format and you need to use a different restore operator?

I have also tried setting the path to every file in the directory

fine_tune_checkpoint: "/home/docs/car_dataset/models/model/train/model.ckpt.meta"

but I get the error:

tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file /home/docs/car_dataset/models/model/train/model.ckpt.meta: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?

What is the correct way to define a pre trained model in the pipeline configuration having the three files: (.data-00000-of-00001, .index, .meta).

Tensorflow version: 1.2.1

like image 435
alfredo138923 Avatar asked Aug 15 '17 02:08

alfredo138923


People also ask

What is fine-tuning in object detection model?

Fine-Tuning: Unfreeze a few of the top layers of a frozen model base and jointly train both the newly-added classifier layers and the last layers of the base model. This allows us to "fine-tune" the higher-order feature representations in the base model in order to make them more relevant for the specific task.

What is fine tune checkpoint?

This section describes more precise adjustment of the rules for Data Loss Prevention. Check Point Software Blade on a Security Gateway that detects and prevents the unauthorized transmission of confidential information outside the organization. Acronym: DLP. in your organization.


2 Answers

What you have to do is to specify the whole path without the ".meta", ".index" and ".data-00000-of-00001" extensions. In your case, this looks to be: "/home/docs/car_dataset/models/model/train/model.ckpt" (which you'll notice is more specific than the directory).

like image 190
Jonathan Huang Avatar answered Oct 03 '22 08:10

Jonathan Huang


Setting the path the following way works for me, ~/faster_rcnn_inception_resnet_v2_640x640/checkpoint/ckpt-0

ckpt-0 is the name of the index file without the .index extension

like image 42
blue-zircon Avatar answered Oct 03 '22 07:10

blue-zircon