Preparing Model Files and Quantization Information Files
Network-wide Information File
The following describes how to obtain an offline model using the ATC model conversion tool. For more operations, see the ATC.
- Log in to the environment where Ascend-CANN-Toolkit is located as the running user.
- Obtain the original model files and save them in any directory.
Example: resnet50.prototxt and resnet50.caffemodel
- Perform ATC-based model conversion.
atc --model=$HOME/module/resnet50.prototxt --weight=$HOME/module/resnet50.caffemodel --framework=0 --output=$HOME/module/out/caffe_resnet50 --soc_version=<soc_version>
You should see information similar to the following if the conversion is successful.1ATC run success
Find the generated offline model (for example, resnet50.om) in the directory specified by the --output option.
- Generate a .json file.
atc --mode=1 --om=$HOME/module/out/caffe_resnet50/resnet50.om --json=$HOME/data/resnet50.json
You should see information similar to the following if the JSON file conversion is successful.
1ATC run success
After successful execution, you can check the .json file in the path specified by --json.
Quantized Original Model and Quantization Information File
Obtain the quantized original model and quantization information file by referring to Quick Start in AMCT.
- resnet50_quant.json: quantization information file recording node mappings between quantized and original models for accuracy comparison.
- resnet50_deploy_model.prototxt: quantized model file to be deployed on the AI processor.
- resnet50_deploy_weights.caffemodel: weight file of the quantized model to be deployed on the AI processor.
- resnet50_fake_quant_model.prototxt: quantized model file for accuracy simulation in the Caffe environment.
- resnet50_fake_quant_weights.caffemodel: weight file of the quantized model for accuracy simulation in the Caffe environment.
The resnet50_deploy_model.prototxt and resnet50_deploy_weights.caffemodel files can be used for ATC-based model conversion. The resnet50_fake_quant_model.prototxt and resnet50_fake_quant_weights.caffemodel files can be used to dump the quantized original Caffe model.
Quantized Offline Model File
Convert the quantized original model files resnet50_deploy_model.prototxt and resnet50_deploy_weights.caffemodel using the ATC to obtain the quantized offline model file and the JSON file generated during model conversion.
The quantized original model files are obtained from the Quantized Original Model and Quantization Information File. For details about how to convert the model using the ATC, see Network-wide Information File.