AIPP Verification of the Model Input Size

If AIPP is configured, whether static AIPP or dynamic AIPP, the input size (input_size) of the eventually generated offline model is subject to operations such as cropping and padding. This section describes the restrictions on the model input size.

Assume that the batch number is N (the maximum batch number in the dynamic batch scenario). The input image width is src_image_size_w, and the input image height is src_image_size_h. The input image size can be calculated in the following formulas.

Static AIPP Verification

Table 1 input_size verification formulas

input_format

input_size

Remarks

YUV400_U8

N * src_image_size_w * src_image_size_h * 1

-

YUV420SP_U8

N * src_image_size_w * src_image_size_h * 1.5

-

XRGB8888_U8

N * src_image_size_w * src_image_size_h * 4

-

RGB888_U8

N * src_image_size_w * src_image_size_h * 3

-

Dynamic AIPP Verification

You will get a new input from ATC if you apply dynamic AIPP in model conversion. This input receives AIPP parameters passed to the aclmdlSetInputAIPP API provided by AscendCL. For details about the APIs,see aclmdlSetInputAIPP. Calculate the size of this new input as follows:

sizeof(kAippDynamicPara) – sizeof(kAippDynamicBatchPara) + batch_count * sizeof(kAippDynamicBatchPara)

For details about the kAippDynamicPara and kAippDynamicBatchPara parameters, see Input Struct.