Home > Mobile >  OpenVINO 2020 INT8 conversion tool POT early experience
OpenVINO 2020 INT8 conversion tool POT early experience

Time:09-28

In OpenVINO 2019 is to use Calibration tool into INT8 model, network model by OpenVINO 2020 version began this tool to be removed, replaced by the POT (Post - Training Optimization tool) tools. The use of the POT and parameters meaning and Calibration tool is different, so to turn INT8 model to study the document, the club's official website again here simple writing I use this tool to convert a mobilenet model of a process,




This time with OpenVINO 2020 conversion INT8 mainly use two tools

1. The pot

This is INT8 conversion tools, and on the way to use calibration tool is different parts of the calibration tool can be run through the direct method of the specified argument, and pot need to write the most parameters into a config file, and then use the

Pot - c/config file
Methods to run,



2. Accuracy_check

This model can be used to check on the specified data set of reasoning accuracy,

Run command and parameter

Accuracy_check - c/config configuration file - s [put validation data sets the root directory path] - td CPU


First is the installation process

Installation process and is not the same as before, was previously installed OpenVINO kit after calibration tool will bring in, and after OpenVINO 2020 version, need to manually install it on again after installed OpenVINO accuracy_check and pot tools,

Accuracy_checker installation path in the

C: \ Program Files \ (x86) IntelSWTools \ openvino \ deployment_tools \ open_model_zoo \ tools \ accuracy_checker

Need in accordance with the instructions to run the https://docs.openvinotoolkit.org/latest/_tools_accuracy_checker_README.html directory
Python setup. Py install
The installation of pot tool path in the

C: \ Program Files \ IntelSWTools \ openvino \ (x86) deployment_tools \ tools \ post_training_optimization_toolkit

Need in accordance with the instructions to run the https://docs.openvinotoolkit.org/latest/_README.html directory
Python setup. Py install
After installed tools can do INT8 model conversion and reasoning precision statistics the

My work path c: \ temp \ so several files in the mobilenetv3

V3 - large_224_1. 0 _float. XML/bin/. Mappling is mobilenet v3 FP32 OpenVINO IR model
MobilenetV3_tf_int8_simple_mode. Json and mobilenetV3_tf_int8. Json is pot convert Int8 model configuration file command dedicated (pot)
MobilenetV3_FP32_ac. Yml and mobilenetV3_INT8_ac. Yml is accuracy_checker statistics FP32 model and int8 model reasoning precision profile (accuracy_checker command)
ILSVRC2012_img_val_small directory is used to store validation data set and data set of annotations file
After the operation will be generated

Results directory to store int8 model conversion out


ILSVRC2012_img_val_small the following data sets and annotation file

I cut out of the data set from imagenet so simple, in the directory is a label file to add a bunch of pictures

The annotation. TXT in each row is the file name in the catalog and the corresponding imagenet logo label


The label has two versions, the net can refer to this article download imagenet2012 data sets, and instructions on the label itself, because mobilenet classification belongs to image classification, so mark documents is simpler, if mobilenet - SSD the sort of image recognition model, the label is more complicated, need according to the official documentation to identify the window coordinates, classification label all figure into,



First from the front calibration_tool used simple mode conversion, write a transformation configuration file mobilenetV3_tf_int8_simple_mode. Json
{
"Model" : {
//"model_name" generated int8 IR specified file filename
"Model_name" : "v3 - large_224_1. 0 _int8,"
//"model" file name "weights" corresponding to convert the original IR
"Model" : "v3 - large_224_1. 0 _float. XML",
"Weights" : "v3 - large_224_1. 0 _float. Bin"
},
"Engine" : {
//designated "type" with simplified model
"Type" : "simplified",
//you can specify the path to the directory with images or video file
//braking you can specify the template for file names to filter images to load
//templates are Unix style
//data set directory
"Data_source" : "ILSVRC2012_img_val_small
"},
"Compression will" : {
//specify the optimization of hardware equipment operation, 2020 new Settings, prepare the way for future use GPU reasoning
"Target_device" : "CPU",
//set optimization algorithm, optimization algorithm of DefaultQuantization is the default
"Algorithms" : [
{
"Name" : "DefaultQuantization,"
"Params" : {
"Preset" : "the performance",
"Stat_subset_size" : 300
}
}
]
}
}
Then run the
Pot - c mobilenetV3_tf_int8_simple_mode. Json

Can see optimization algorithm is increased to 3 kinds of DefaultQuantization/ActivationChannelAlignment/MinMaxQuantization, but judging from the official 2020.2 document, only support of the former two https://docs.openvinotoolkit.org/2020.2/_compression_algorithms_quantization_README.html

Final conversion model v3 - large_224_1. 0 _int8. Bin and v3 - large_224_1. 0 _int8. The XML generated by./results \ the v3 - large_224_1. 0 _int8_defaultquantization \ _09 54-2020-06-02-41 in the optimized directory under



Next look at FP32 model and INT8 model reasoning precision

First configuration mobilenetV3_FP32_ac. Yml
Models:
- name: the v3 - large_224_1. 0 _float
Launchers:
# DLSDK is openvino specified operation under the framework, can also be tensorflow or other framework
# model/weights is to test the model file name
# adapter is tell accuracy the checker model output is the output of target classification and target recognition or other
- framework: DLSDK
Model: the v3 - large_224_1. 0 _float. XML
Weights: v3 - large_224_1. 0 _float. Bin
Adapter: classification

Datasets:
# the following part is about the path of the data set, the format of the data set (imagenet, VOC or other), and indicate the name of the file
- name: ILSVRC2012_img_val_small
Data_source: ILSVRC2012_img_val_small
Annotation_conversion:
The converter: imagenet
Annotation_file: "ILSVRC2012_img_val_small/annotation. TXT"
Tell ac_checker tool # pretreatment before sending image data sets into the model to do the preprocessing, such as scaling, shear or adjust the RGB/BGR order
Preprocessing:
- type: resize
Size: 256
- type: crop
Size: 224
# statistical accuracy with the algorithm defined here, here to see whether the two kinds of accuracy, one is the top1, is also a top5
The metrics:
- name: accuracy @ top1
Type: accuracy
Top_k: 1
- name: accuracy @ top5
Type: accuracy
Top_k: 5

Run the command
Accuracy_check -c mobilenetV3_FP32_ac. Yml -s./- td CPU

See the output

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related