Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6403 Discussions

INT8 quantization of ssd mobilenet v1 model

CJOY01
Beginner
563 Views

I am trying to convert ssd mobilenet v1 FP32 model to INT8 using calibration tool. I am using openvino version 2019_R3.1 and tensorflow version  1.1.4.0,   

I am facing one issue on using the   calibrate.py tool used for  calibrating the FP32 model.

 

I was successfully  able to convert data annotation files using the below mentioned step.

 

python3 convert_annotation.py imagenet --annotation_file /home/cyril.pj/Downloads/downloadsforint8/val.txt --labels_file /home/cyril.pj/Downloads/downloadsforint8/synset_words.txt -ss 2000 -o ~/annotations -a imagenet_calibration.pickle -m imagenet_calibration.json

 

after successful  completion of the above mentioned step, i was able to generate   .json and  .pickle file.

 

 

then for calibrating the model, i tried the below mentioned step,

 

python3 calibrate.py --config /opt/intel/openvino_2019.3.376/deployment_tools/tools/calibration_tool/configs/ssd_mobilenet_v1_coco.yml --definition /opt/intel/openvino_2019.3.376/deployment_tools/tools/calibration_tool/configs/definitions.yml -M /opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer --tf_custom_op_config_dir ~/tf_custom_op_configs --models ~/models/ssd --source /home/cyril.pj/SSD_COPIED/rawfiles -a ~/annotations --converted_models ~/models/ssd/

 

but i am not able to successfully execute the calibration  tool, i ma getting multiple errors,please find the below error logs, Kindly help on this issue,

 

==================================================================

[ ERROR ]  Failed to match nodes from custom replacement description with id 'ObjectDetectionAPIPreprocessorReplacement':
It means model and custom replacement description are incompatible.
Try to correct custom replacement description according to documentation with respect to model node names
[ ERROR ]  Failed to match nodes from custom replacement description with id 'ObjectDetectionAPISSDPostprocessorReplacement':
It means model and custom replacement description are incompatible.
Try to correct custom replacement description according to documentation with respect to model node names

[ SUCCESS ] Generated IR model.
[ SUCCESS ] XML file: /home/cyril.pj/models/ssd/ssd_mobilenet_v1_coco.xml
[ SUCCESS ] BIN file: /home/cyril.pj/models/ssd/ssd_mobilenet_v1_coco.bin
[ SUCCESS ] Total execution time: 16.42 seconds. 
Traceback (most recent call last):
  File "calibrate.py", line 20, in <module>
    with calibration.CommandLineProcessor.process() as config:
  File "/opt/intel/openvino_2019.3.376/python/python3.5/openvino/tools/calibration/command_line_processor.py", line 140, in process
    cpu_extension = DLSDKLauncher.get_cpu_extension(launcher['cpu_extensions'], args.cpu_extensions_mode)
  File "/opt/intel/openvino_2019.3.376/deployment_tools/open_model_zoo/tools/accuracy_checker/accuracy_checker/launcher/dlsdk_launcher.py", line 418, in get_cpu_extension
    raise ConfigError('suitable CPU extension lib not found in {}'.format(extensions_path))
accuracy_checker.config.config_validator.ConfigError: suitable CPU extension lib not found in /opt/intel/openvino_2019.3.376/deployment_tools/tools/calibration_tool
======================================================================================================

0 Kudos
1 Reply
JesusE_Intel
Moderator
563 Views

Hi CYRIL P,

Thanks for reaching out, I recommend updating to the latest OpenVINO toolkit 2020.1 release as it includes a new post training optimization tool and the old calibration tool has been removed and replaced by a new one.

Here is some documentation that may be useful:

OpenVINO toolkit Release Notes

INT8 Claibration

Post-Training Optimization Tool

Accuracy Checker Tool

Regards,

Jesus

0 Kudos
Reply