Static AIPP
The AIPP configuration file can define multiple sets of AIPP configurations to apply different AIPP processing to different model inputs. When configuring multiple sets of AIPP configurations, enclose each set within one aipp_op configuration item. If the model has only one input, only the first set in aipp_op needs to be configured.
The following example is explained with a network model that has multiple inputs:
- Static AIPP + dynamic shape scenario: During model conversion, the static AIPP is set by --insert_op_conf, and the dynamic shape is set by --input_shape.
If the model has only one input, this scenario is not supported. If the model has multiple inputs, you must configure different input nodes accordingly, such as setting one input node with static AIPP and another node with a dynamic shape.
- During model conversion, if --dynamic_image_size is set (with unknown input width and height) and static AIPP is configured using --insert_op_conf, the cropping and padding functions must be disabled in your AIPP configuration file, and src_image_size_w and src_image_size_h must be set to 0.
- related_input_rank indicates the inputs to be AIPP processed. The following two sets of AIPP parameters are defined to perform AIPP processing on the first and second model inputs.
aipp_op { aipp_mode : static related_input_rank: 0 # AIPP processing performed on the first input src_image_size_w : 608 src_image_size_h : 608 crop : false input_format : YUV420SP_U8 csc_switch : true rbuv_swap_switch : false matrix_r0c0 : 298 matrix_r0c1 : 0 matrix_r0c2 : 409 matrix_r1c0 : 298 matrix_r1c1 : -100 matrix_r1c2 : -208 matrix_r2c0 : 298 matrix_r2c1 : 516 matrix_r2c2 : 0 input_bias_0 : 16 input_bias_1 : 128 input_bias_2 : 128 mean_chn_0 : 104 mean_chn_1 : 117 mean_chn_2 : 123 } aipp_op { aipp_mode : static related_input_rank: 1 # AIPP processing performed on the second input src_image_size_w : 608 src_image_size_h : 608 crop : false input_format : YUV420SP_U8 csc_switch : true rbuv_swap_switch : false matrix_r0c0 : 298 matrix_r0c1 : 0 matrix_r0c2 : 409 matrix_r1c0 : 298 matrix_r1c1 : -100 matrix_r1c2 : -208 matrix_r2c0 : 298 matrix_r2c1 : 516 matrix_r2c2 : 0 input_bias_0 : 16 input_bias_1 : 128 input_bias_2 : 128 mean_chn_0 : 104 mean_chn_1 : 117 mean_chn_2 : 123 }
- related_input_name indicates the name of the model input (value of input) for AIPP processing, or the output (value of top) of the first-layer node. This parameter applies only to Caffe network models, and cannot be used together with related_input_rank. If they are configured at the same time, related_input_name takes precedence over related_input_rank.Two sets of AIPP configurations are defined to perform AIPP processing on the first and second model inputs.
aipp_op { aipp_mode : static related_input_name: "data" # AIPP processing performed on the first input data src_image_size_w : 608 src_image_size_h : 608 crop : false input_format : YUV420SP_U8 csc_switch : true rbuv_swap_switch : false matrix_r0c0 : 298 matrix_r0c1 : 0 matrix_r0c2 : 409 matrix_r1c0 : 298 matrix_r1c1 : -100 matrix_r1c2 : -208 matrix_r2c0 : 298 matrix_r2c1 : 516 matrix_r2c2 : 0 input_bias_0 : 16 input_bias_1 : 128 input_bias_2 : 128 mean_chn_0 : 104 mean_chn_1 : 117 mean_chn_2 : 123 } aipp_op { aipp_mode : static related_input_name: "im_info" # AIPP processing performed on the second input im_info src_image_size_w : 608 src_image_size_h : 608 crop : false input_format : YUV420SP_U8 csc_switch : true rbuv_swap_switch : false matrix_r0c0 : 298 matrix_r0c1 : 0 matrix_r0c2 : 409 matrix_r1c0 : 298 matrix_r1c1 : -100 matrix_r1c2 : -208 matrix_r2c0 : 298 matrix_r2c1 : 516 matrix_r2c2 : 0 input_bias_0 : 16 input_bias_1 : 128 input_bias_2 : 128 mean_chn_0 : 104 mean_chn_1 : 117 mean_chn_2 : 123 }
Parent topic: AIPP Configuration Sample