[Deprecated] Quantizing Image Classification Model¶
Post-training Optimization Tool is deprecated since OpenVINO 2023.0. Neural Network Compression Framework (NNCF) is recommended for the post-training quantization instead.
This example demonstrates the use of the Post-training Optimization Tool API for the task of quantizing a classification model.
The MobilenetV2 model from TensorFlow is used for this purpose.
DataLoader is created to load the ImageNet classification dataset and the implementation of Accuracy at top-1 metric 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 need to download the validation part of the ImageNet image database and place it in a separate folder,
which will be later referred to as
<IMAGES_DIR>. Annotations to images should be stored in a separate .txt file (
<IMAGENET_ANNOTATION_FILE>) in the format
How to Run the Example¶
Launch Model Downloader tool to download
mobilenet-v2-1.0-224model from the Open Model Zoo repository.
omz_downloader --name mobilenet-v2-1.0-224
Launch Model Converter tool to generate Intermediate Representation (IR) files for the model:
omz_converter --name mobilenet-v2-1.0-224 --mo <PATH_TO_MODEL_OPTIMIZER>/mo.py
Launch the example script from the example directory:
python3 ./classification_sample.py -m <PATH_TO_IR_XML> -a <IMAGENET_ANNOTATION_FILE> -d <IMAGES_DIR>
Optional: you can specify .bin file of IR directly using the