Model Conversion
The model file generated by the training framework needs to be converted before inference is performed on the Ascend AI Processor. For details about model conversion, see the CANN ATC Instructions.
The following uses TensorFlow YOLOv3 PB as an example to describe how to convert a model into an .om file. The example command is as follows (Atlas 200/300/500 inference product used as an example):
atc --model=./yolov3_tf.pb --framework=3 --output=./yolov3_tf_bs1_fp16 --soc_version=Ascend310 --insert_op_conf=./aipp_yolov3_416_416.aippconfig --input_shape="input/input_data:1,416,416,3" --out_nodes="conv_lbbox/BiasAdd:0;conv_mbbox/BiasAdd:0;conv_sbbox/BiasAdd:0"
out_nodes must be used to specify the output nodes for the YOLOv3 model.
Example aipp.cfg file: (This AIPP file is used to convert the YUV format to the RGB format during color space conversion and is not normalized.)
aipp_op {
aipp_mode: static
input_format : YUV420SP_U8
csc_switch : true
rbuv_swap_switch : false
matrix_r0c0 : 256
matrix_r0c1 : 0
matrix_r0c2 : 359
matrix_r1c0 : 256
matrix_r1c1 : -88
matrix_r1c2 : -183
matrix_r2c0 : 256
matrix_r2c1 : 454
matrix_r2c2 : 0
input_bias_0 : 0
input_bias_1 : 128
input_bias_2 : 128
}
Parent topic: Using CLI for Development