Quantizing Object Detection Model with Accuracy Control

This example demonstrates the use of the Post-training Optimization Toolkit API to quantize an object detection model in the accuracy-aware mode. The MobileNetV1 FPN model from TensorFlow for object detection task is used for this purpose. A custom DataLoader is created to load the COCO dataset for object detection task and the implementation of mAP COCO is used for the model evaluation. The code of the example is available on GitHub.

How to prepare the data

To run this example, you will need to download the validation part of the COCO. The images should be placed in a separate folder, which will be later referred to as <IMAGES_DIR> and the annotation file instances_val2017.json later referred to as <ANNOTATION_FILE>.

How to Run the example

  1. Launch Model Downloader tool to download ssd_mobilenet_v1_fpn_coco model from the Open Model Zoo repository.

       omz_downloader --name ssd_mobilenet_v1_fpn_coco
    2. Launch [Model Converter](@ref omz_tools_downloader) tool to generate Intermediate Representation (IR) files for the model:
       omz_converter --name ssd_mobilenet_v1_fpn_coco --mo <PATH_TO_MODEL_OPTIMIZER>/mo.py
  2. Launch the example script from the example directory:

    python ./object_detection_example.py -m <PATH_TO_IR_XML> -d <IMAGES_DIR> --annotation-path <ANNOTATION_FILE>
  • Optional: you can specify .bin file of IR directly using the -w, --weights options.