user10253771
user10253771

Reputation: 670

How to save best models in latest Tensorflow Object Detection API V2 with TF2?

Recently I am trying Tensorflow Object Detection API V2 with TF2, and I've sucessfully trained a network.

However, I found little information about how to save the best model.

I've found some simple tutorials that don't talk much about these details.

I've found a similar question here, however the best answer is to modify legacy/trainer.py, which seems to be outdated.

I've also found another similar question here, however the answers are talking about exporters, which is in model_lib.py, but I can't find similar parameter in model_lib_v2.py

So, for V2, which file should I modify to save the best model?

Upvotes: 4

Views: 2391

Answers (1)

Yasserius
Yasserius

Reputation: 97

Assuming you are using the official scripts from TF2 Object Detection repository, there is a tensorflow/models/research/object_detection/exporter_main_v2.py file for saving models.

Usage:

python .\exporter_main_v2.py \
    --input_type image_tensor \
    --pipeline_config_path .\...\pipeline.config \
    --trained_checkpoint_dir .\...\training \
    --output_directory .\...\my_model

Source: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html#exporting-a-trained-model

Upvotes: 2

Related Questions