Preparation of 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 Instructions.
- Log in to an Ascend AI environment where the Ascend-CANN-Toolkit has been installed.
- 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 the AMCT Instructions.
- resnet50_quant.json: quantization information file. This file gives the node mapping between the quantized model and the original model and is used for accuracy comparison between the quantized model and the original model.
- resnet50_deploy_model.prototxt: quantized model file to be deployed on the Ascend AI Processor.
- resnet50_deploy_weights.caffemodel: weight file of the quantized model to be deployed on the Ascend 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 obtained in Quantized Original Model and Quantization Information File using ATC in Network-wide Information File to obtain the quantized offline model file and the .json file generated by converting the quantized offline model file.