Search code examples
tensorflowobject-detection

How to combine two frozen models (Tensorflow) for object detection?


I am trying to combine two frozen models (protobuffs) for object detection. The issue is one of the models is my own dataset and the other is the prebuilt model for coco dataset (just include more classes to the dataset itself). Is this possible? or is there a better approach to perform this? As training all the classes from scratch will probably take weeks. Thanks for the help in advance.


Solution

  • The issue is one of the models is my own dataset and the other is the prebuilt model for coco dataset (just include more classes to the dataset itself). Is this possible?

    Of course, it's possible. But you need to train the model again. When you train the model using your data like this,

    python object_detection/train.py \
        --logtostderr \
        --pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG} \
        --train_dir=${PATH_TO_TRAIN_DIR}
    

    Here the ${PATH_TO_YOUR_PIPELINE_CONFIG} is your config file and you need to specify the pre-trained model path as below,

    fine_tune_checkpoint: "PATH_TO_BE_CONFIGURED/model.ckpt"
    

    So doing this will help your training to converge faster, because instead of starting from scratch now your network will start from coco dataset's training weights.

    You need to download the coco model from here which you want to use. Then specify the model file path on the config file demonstrated above.