tensorflow / tensorflow/models

Fine tuining Faster RCNN Inception V2 - Object Detection API Colab TF2

Open
#8,885 5 comments 2 reactions 3 assignees View on GitHub

@pkulzc is already working on this.

Since Jul 17, 2020.

models:research:odapi type:feature
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

Prerequisites

Please answer the following question for yourself before submitting an issue.

  • I checked to make sure that this feature has not been requested already.

1. The entire URL of the file you are using

https://github.com/tensorflow/models/blob/master/research/object_detection/colab_tutorials/eager_few_shot_od_training_tf2_colab.ipynb

2. Describe the feature you request

I would like to restore the checkpoint of the pretrained model Faster R-CNN with Inception Resnet v2.

3. Additional context

How to set what to restore and what to re-initialize in this case?
What I did so far:

  • download the model from zoo
  • load the corresponding .config and ckpt-0
  • restoring the first stage box predictor and re-initializing the second one (not sure though)
    fake_box_predictor = tf.compat.v2.train.Checkpoint( _first_stage_box_predictor=detection_model._first_stage_box_predictor, ) fake_model = tf.compat.v2.train.Checkpoint( _feature_extractor=detection_model._feature_extractor, _first_stage_box_predictor=fake_box_predictor) ckpt = tf.compat.v2.train.Checkpoint(model=fake_model) ckpt.restore(checkpoint_path).expect_partial()

When I run the colab just applying these changes I get:
ValueError: Checkpoint was expecting a trackable object (an object derived from TrackableBase), got <object_detection.models.faster_rcnn_inception_resnet_v2_keras_feature_extractor.FasterRCNNInceptionResnetV2KerasFeatureExtractor object at 0x2b1081747da0>. If you believe this object should be trackable (i.e. it is part of the TensorFlow Python API and manages state), please open an issue.

4. Are you willing to contribute it? (Yes or No)

Yes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.