Function: set_aipp_crop_params

Applicability

Product

Supported (√/x)

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

Sets scaling parameters in the dynamic AIPP scenario.

Prototype

  • C Prototype
    1
    aclError aclmdlSetAIPPCropParams(aclmdlAIPP *aippParmsSet, int8_t cropSwitch,int32_t cropStartPosW, int32_t cropStartPosH, int32_t cropSizeW, int32_t cropSizeH,uint64_t batchIndex)
    
  • Python Function
    1
    ret = acl.mdl.set_aipp_crop_params(aipp_parms_set, crop_switch, crop_start_pos_w, crop_start_pos_h, crop_size_w, crop_size_h, batch_index)
    

Parameter Description

Parameter

Description

aipp_parms_set

Int, pointer address of the dynamic AIPP configuration object. The aclmdlAIPP data must be created by the acl.mdl.create_aipp call in advance.

crop_switch

Int, whether to crop an image. Value range:

  • 0: The image is not cropped. When cropSwitch is set to 0, cropStartPosW, cropStartPosH, cropSizeW, and cropSizeH are invalid.
  • 1: The image is cropped.

crop_start_pos_w

Int, horizontal coordinate of the crop start. For the YUV420SP_U8 format, the value must be an even number. The value range is [0, 4095].

crop_start_pos_h

Int, vertical coordinate of the crop start. For the YUV420SP_U8 format, the value must be an even number. The value range is [0, 4095].

crop_size_w

Int, width of the crop ROI. Value range: [1, 4096]

crop_size_h

Int, height of the crop ROI. Value range: [1, 4096]

batch_index

Int, index of the batch for image cropping. The default value is 0. The value range is [0, batch_size). batch_size is set when acl.mdl.create_aipp is called to create data of the aclmdlAIPP type.

Return Value Description

Return Value

Description

ret

Int, error code.

Restrictions

If the cropping function is enabled, the following conditions must be met for the arguments passed to the acl.mdl.set_aipp_src_image_size call and acl.mdl.set_aipp_crop_params call:

  • srcImageSizeW ≥ cropSizeW + cropStartPosW
  • srcImageSizeH ≥ cropSizeH + cropStartPosH