# EASE : Use POT to Quantize single-human-pose-estimation-0001 Public Model ###### tags: `EASE` `POT` `2022.1` ## Use OpenVINO dockerhub image ``` docker run -it -v ~/Downloads:/mnt -u root --rm openvino/ubuntu20_dev:latest ``` ## Run Accuracy Checker and POT In ubuntu20_dev docker image, #### 0. Download COCO 2017 trainval dataset and annotation ```=bash cd /home/openvino apt update apt install unzip mkdir coco_dataset cd coco_dataset curl http://images.cocodataset.org/zips/val2017.zip -o val2017.zip unzip val2017.zip curl http://images.cocodataset.org/annotations/annotations_trainval2017.zip -o trainval_2017.zip unzip trainval_2017.zip ``` ##### coco_dataset content ``` coco_dataset/ |--annotations/ |-- captions_train2017.json |-- captions_val2017.json |-- instances_train2017.json |-- instances_val2017.json |-- person_keypoints_train2017.json `-- person_keypoints_val2017.json |-- val2017/ |-- 000000042102.jpg |-- 000000060102.jpg |-- 000000245102.jpg ... `-- 000000364102.jpg ``` #### 1. Download single-human-pose-estimation-0001 omz_downloader --name single-human-pose-estimation-0001 -o /home/openvino/openvino_models #### 2. Convert single-human-pose-estimation-0001 to IR omz_converter --name single-human-pose-estimation-0001 -d /home/openvino/openvino_models #### 3. Run Accuracy Checker on single-human-pose-estimation-0001 pip install pycocotools accuracy_check -c single-human-pose-estimation-0001-int8.yml -m openvino_models/public/single-human-pose-estimation-0001/FP32/ #### 4. Run POT on single-human-pose-estimation-0001 pot -c single-human-pose-estimation-0001-int8.json -e #### 5. Copy single-human-pose-estimation-0001 FP16-INT8 IR ``` mkdir /home/openvino/openvino_models/public/single-human-pose-estimation-0001/FP16-INT8/ cp -ar results/single-human-pose-estimation-0001*/*/optimized/* /home/openvino/openvino_models/public/single-human-pose-estimation-0001/FP16-INT8/ ``` ## Reference https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/models/public/single-human-pose-estimation-0001/accuracy-check.yml ### single-human-pose-estimation-0001-int8.yml ``` models: - name: single-human-pose-estimation-0001 launchers: - framework: openvino device: CPU adapter: type: single_human_pose_estimation datasets: - name: ms_coco_single_keypoints data_source: /home/openvino/coco_dataset/val2017 annotation_conversion: converter: mscoco_single_keypoints annotation_file: /home/openvino/coco_dataset/annotations/person_keypoints_val2017.json annotation: mscoco_single_keypoints.pickle dataset_meta: mscoco_single_keypoints.json preprocessing: - type: transformed_crop_with_auto_scale dst_height: 384 dst_width: 288 stride: 8 metrics: - name: AP type: coco_orig_keypoints_precision reference: 0.6904 ``` ### single-human-pose-estimation-0001.json ``` { "model": { "model_name": "single-human-pose-estimation-0001", "model": "/home/openvino/openvino_models/public/single-human-pose-estimation-0001/FP16/single-human-pose-estimation-0001.xml", "weights": "/home/openvino/openvino_models/public/single-human-pose-estimation-0001/FP16/single-human-pose-estimation-0001.bin" }, "engine": { "config": "/home/openvino/single-human-pose-estimation-0001-int8.yml" }, "compression": { "algorithms": [ { "name": "DefaultQuantization", "params": { "preset": "performance", "stat_subset_size": 100 } } ] } } ``` ### accuracy_checker log ``` accuracy_check -c single-human-pose-estimation-0001-int8.yml -m openvino_models/public/single-human-pose-estimation-0001/FP32/single-human-pose-estimation-0001.xml Processing info: model: single-human-pose-estimation-0001 launcher: openvino device: CPU dataset: ms_coco_single_keypoints OpenCV version: 4.5.5 Annotation for ms_coco_single_keypoints dataset will be loaded from mscoco_single_keypoints.pickle Loaded dataset info: Dataset name: ms_coco_single_keypoints Accuracy Checker version 0.9.3 Dataset size 6352 Conversion parameters: converter: mscoco_single_keypoints annotation_file: /home/openvino/coco_dataset/annotations/person_keypoints_val2017.json ms_coco_single_keypoints dataset metadata will be loaded from mscoco_single_keypoints.json IE version: 2022.1.0-7019-cdb9bec7210-releases/2022/1 Loaded CPU plugin version: CPU - openvino_intel_cpu_plugin: 2022.1.2022.1.0-7019-cdb9bec7210-releases/2022/1 Found model openvino_models/public/single-human-pose-estimation-0001/FP32/single-human-pose-estimation-0001.xml Found weights openvino_models/public/single-human-pose-estimation-0001/FP32/single-human-pose-estimation-0001.bin Input info: Node name: data Tensor names: data precision: f32 shape: (1, 3, 384, 288) Output info Node name: heatmaps/sink_port_0 Tensor names: heatmaps precision: f32 shape: (1, 17, 48, 36) 6352 objects processed in 774.886 seconds loading annotations into memory... Done (t=0.20s) creating index... index created! Loading and preparing results... DONE (t=0.31s) creating index... index created! Running per image evaluation... Evaluate annotation type *keypoints* DONE (t=3.88s). Accumulating evaluation results... DONE (t=0.08s). Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets= 20 ] = 0.690 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets= 20 ] = 0.923 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets= 20 ] = 0.779 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets= 20 ] = 0.662 Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets= 20 ] = 0.732 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 20 ] = 0.726 Average Recall (AR) @[ IoU=0.50 | area= all | maxDets= 20 ] = 0.931 Average Recall (AR) @[ IoU=0.75 | area= all | maxDets= 20 ] = 0.808 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets= 20 ] = 0.692 Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets= 20 ] = 0.776 MSCOCOorigBaseMetric.compute_precision_recall: returning [[0.690453523582747, 0.9232926843990009, 0.7791885958151511, 0.6617599597063265, 0.731706173047956], [0.7259603274559194, 0.9310453400503779, 0.8082493702770781, 0.6921606118546846, 0.7761426978818284]] AP: 69.05% [FAILED: abs error = 0.005352 | relative error = 7.753e-05] ``` # POT logs ``` pot -c single-human-pose-estimation-0001-int8.json INFO:openvino.tools.pot.app.run:Output log dir: ./results/single-human-pose-estimation-0001_DefaultQuantization/2022-04-27_14-35-07 INFO:openvino.tools.pot.app.run:Creating pipeline: Algorithm: DefaultQuantization Parameters: preset : performance stat_subset_size : 100 target_device : ANY model_type : None dump_intermediate_model : False inplace_statistics : True exec_log_dir : ./results/single-human-pose-estimation-0001_DefaultQuantization/2022-04-27_14-35-07 =========================================================================== IE version: 2022.1.0-7019-cdb9bec7210-releases/2022/1 Loaded CPU plugin version: CPU - openvino_intel_cpu_plugin: 2022.1.2022.1.0-7019-cdb9bec7210-releases/2022/1 Annotation for ms_coco_single_keypoints dataset will be loaded from mscoco_single_keypoints.pickle Loaded dataset info: Dataset name: ms_coco_single_keypoints Accuracy Checker version 0.9.3 Dataset size 6352 Conversion parameters: converter: mscoco_single_keypoints annotation_file: /home/openvino/coco_dataset/annotations/person_keypoints_val2017.json ms_coco_single_keypoints dataset metadata will be loaded from mscoco_single_keypoints.json INFO:openvino.tools.pot.pipeline.pipeline:Inference Engine version: 2022.1.0-7019-cdb9bec7210-releases/2022/1 INFO:openvino.tools.pot.pipeline.pipeline:Model Optimizer version: 2022.1.0-7019-cdb9bec7210-releases/2022/1 INFO:openvino.tools.pot.pipeline.pipeline:Post-Training Optimization Tool version: 2022.1.0-7019-cdb9bec7210-releases/2022/1 INFO:openvino.tools.pot.statistics.collector:Start computing statistics for algorithms : DefaultQuantization INFO:openvino.tools.pot.statistics.collector:Computing statistics finished INFO:openvino.tools.pot.pipeline.pipeline:Start algorithm: DefaultQuantization INFO:openvino.tools.pot.algorithms.quantization.default.algorithm:Start computing statistics for algorithm : ActivationChannelAlignment INFO:openvino.tools.pot.algorithms.quantization.default.algorithm:Computing statistics finished INFO:openvino.tools.pot.algorithms.quantization.default.algorithm:Start computing statistics for algorithms : MinMaxQuantization,FastBiasCorrection INFO:openvino.tools.pot.algorithms.quantization.default.algorithm:Computing statistics finished INFO:openvino.tools.pot.pipeline.pipeline:Finished: DefaultQuantization ```