aclmdlAIPP
Interfaces of this data type are all synchronous interfaces.
- Function: create_aipp
- Function: destroy_aipp
- Dynamic AIPP Parameter Settings
- Function: set_aipp_input_format
- Function: set_aipp_csc_params
- Function: set_aipp_rbuv_swap_switch
- Function: set_aipp_ax_swap_switch
- Function: set_aipp_src_image_size
- Function: set_aipp_scf_params
- Function: set_aipp_crop_params
- Function: set_aipp_padding_params
- Function: set_aipp_dtc_pixel_mean
- Function: set_aipp_dtc_pixel_min
- Function: set_aipp_pixel_var_reci
- Function: set_input_aipp
Function: create_aipp
C Prototype |
aclmdlAIPP *aclmdlCreateAIPP(uint64_t batchSize) |
---|---|
Python Function |
aipp_ptr = acl.mdl.create_aipp(batch_size) |
Function Usage |
Creates data of the acl.mdl.create_aipp type based on the batch size supported by the model in dynamic AIPP scenarios, to store dynamic AIPP parameters. |
Input Description |
batch_size: int, number of batches of a model. |
Return Value |
aipp_ptr: int, object address of data of the aclmdlAIPP type. |
Restrictions |
None |
Precautions |
None |
Function: destroy_aipp
C Prototype |
aclError aclmdlDestroyAIPP(const aclmdlAIPP *aippParmsSet) |
---|---|
Python Function |
ret = acl.mdl.destroy_aipp(aipp_parms_set) |
Function Usage |
Destroys data of the aclmdlAIPP type. |
Input Description |
aipp_parms_set: int, pointer to data of the aclmdlAIPP type to be destroyed. |
Return Value |
ret: int, error code.
|
Restrictions |
Destruction API: The released or destroyed resources are no longer available after this API is called. You are advised to set the released or destroyed resources to invalid values (for example, 0 or None) after calling this API. |
Precautions |
None |
Dynamic AIPP Parameter Settings
Function: set_aipp_input_format
C Prototype |
aclError aclmdlSetAIPPInputFormat(aclmdlAIPP *aippParmsSet, AippInputFormat inputFormat) |
---|---|
Python Function |
ret = acl.mdl.set_aipp_input_format(aipp_parms_set, input_format) |
Function Usage |
Sets the input format of the source image in dynamic AIPP scenarios. It is a synchronous interface. |
Input Description |
aipp_parms_set: int, pointer to the dynamic AIPP parameter object. acl.mdl.create_aipp is called in advance to create data of the aclmdlAIPP type. input_format: int, format of the original input image. Values:
|
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: set_aipp_csc_params
C Prototype |
aclError aclmdlSetAIPPCscParams(aclmdlAIPP *aippParmsSet, int8_t csc_switch, int16_t cscMatrixR0C0, int16_t cscMatrixR0C1, int16_t cscMatrixR0C2, int16_t cscMatrixR1C0, int16_t cscMatrixR1C1,int16_t cscMatrixR1C2, int16_t cscMatrixR2C0, int16_t cscMatrixR2C1, int16_t cscMatrixR2C2, uint8_t cscOutputBiasR0, uint8_t cscOutputBiasR1, uint8_t cscOutputBiasR2, uint8_t cscInputBiasR0, uint8_t cscInputBiasR1, uint8_t cscInputBiasR2) |
---|---|
Python Function |
ret = acl.mdl.set_aipp_csc_params(aipp_parms_set, csc_switch, csc_matrix_R0C0, csc_matrix_R0C1, csc_matrix_R0C2,csc_matrix_R1C0, csc_matrix_R1C1, csc_matrix_R1C2, csc_matrix_R2C0, csc_matrix_R2C1, csc_matrix_R2C2, csc_output_bias_R0, csc_output_bias_R1, csc_output_bias_R2, csc_input_bias_R0, csc_input_bias_R1, csc_input_bias_R2) |
Function Usage |
Sets CSC parameters in dynamic AIPP scenarios. If the CSC switch is disabled, parameters set by calling this interface are invalid. It is a synchronous interface.
CSC parameters are closely related to the formats of the source and destination images. You can refer to the CSC configuration description in ATC Tool Instructions for CSC parameter settings. Configure CSC parameters as required if the listed image formats do not meet your requirements. |
Input Description |
aipp_parms_set: int, pointer to the dynamic AIPP parameter object. acl.mdl.create_aipp is called in advance to create data of the aclmdlAIPP type. csc_switch: int, CSC switch. Values:
csc_matrix_R0C0: int, CSC matrix parameter.
csc_matrix_R0C1: int, CSC matrix parameter.
csc_matrix_R0C2: int, CSC matrix parameter.
csc_matrix_R1C0: int, CSC matrix parameter.
csc_matrix_R1C1: int, CSC matrix parameter.
csc_matrix_R1C2: int, CSC matrix parameter.
csc_matrix_R2C0: int, CSC matrix parameter.
csc_matrix_R2C1: int, CSC matrix parameter.
csc_matrix_R2C2: int, CSC matrix parameter.
csc_output_bias_R0: int, output bias during RGB2YUV conversion. The default value is 0.
csc_output_bias_R1: int, output bias during RGB2YUV conversion. The default value is 0.
csc_output_bias_R2: int, output bias during RGB2YUV conversion. The default value is 0.
csc_input_bias_R0: int, input bias during YUV2RGB conversion. The default value is 0.
csc_input_bias_R1: int, input bias during YUV2RGB conversion. The default value is 0.
csc_input_bias_R2: int, input bias during YUV2RGB conversion. The default value is 0.
|
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: set_aipp_rbuv_swap_switch
C Prototype |
aclError aclmdlSetAIPPRbuvSwapSwitch(aclmdlAIPP *aippParmsSet, int8_t rbuvSwapSwitch) |
---|---|
Python Function |
ret = acl.mdl.set_aipp_rbuv_swap_switch(aipp_parms_set, rbuv_swap_switch) |
Function Usage |
Sets the RB or UV channel swap switch before CSC in dynamic AIPP scenarios. It is a synchronous interface. |
Input Description |
aipp_parms_set: int, pointer to the dynamic AIPP parameter object.
rbuv_swap_switch: int, RB or UV channel swap switch. Values:
|
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: set_aipp_ax_swap_switch
C Prototype |
aclError aclmdlSetAIPPAxSwapSwitch(aclmdlAIPP *aippParmsSet, int8_t axSwapSwitch) |
---|---|
Python Function |
ret = acl.mdl.set_aipp_ax_swap_switch(aipp_parms_set, ax_swap_switch) |
Function Usage |
Sets the RB or UV channel swap switch before CSC in dynamic AIPP scenarios. It is a synchronous interface. |
Input Description |
aipp_parms_set: int, pointer to the dynamic AIPP parameter object.
ax_swap_switch: int, GBA->ARGB or YUVA->AYUV switch. Values:
|
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: set_aipp_src_image_size
C Prototype |
aclError aclmdlSetAIPPSrcImageSize(aclmdlAIPP *aippParmsSet, int32_t srcImageSizeW, int32_t srcImageSizeH) |
---|---|
Python Function |
ret = acl.mdl.set_aipp_src_image_size(aipp_parms_set, src_image_size_w, src_image_size_h) |
Function Usage |
Sets the size of the source image in dynamic AIPP scenarios. It is a synchronous interface. |
Input Description |
aipp_parms_set: int, dynamic AIPP parameter object.
src_image_size_w: int, source image width. For the YUV420SP_U8 format, the value must be an even number.
src_image_size_h: int, source image height. For the YUV420SP_U8 format, the value must be an even number.
|
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: set_aipp_scf_params
C Prototype |
aclError aclmdlSetAIPPScfParams(aclmdlAIPP *aippParmsSet, int8_t scfSwitch, int32_t scfInputSizeW, int32_t scfInputSizeH, int32_t scfOutputSizeW, int32_t scfOutputSizeH, uint64_t batchIndex) |
---|---|
Python Function |
ret = acl.mdl.set_aipp_scf_params(aipp_parms_set, scf_switch, scf_input_size_w, scf_input_size_h, scf_output_size_w, scf_output_size_h, batch_index) |
Function Usage |
Sets resizing parameters in dynamic AIPP scenarios. It is a synchronous interface. This reserved interface is not supported currently. |
Input Description |
aipp_parms_set: int, dynamic AIPP parameter object.
scf_switch: int, whether to zoom in or out the image. Values:
scf_input_size_w: int, source image width.
scf_input_size_h: int, source image height.
scf_output_size_w: int, destination image width.
scf_output_size_h: int, destination image height.
batch_index: int, index of batch for image resizing. The default value is 0.
|
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: set_aipp_crop_params
C Prototype |
aclError aclmdlSetAIPPCropParams(aclmdlAIPP *aippParmsSet, int8_t cropSwitch,int32_t cropStartPosW, int32_t cropStartPosH, int32_t cropSizeW, int32_t cropSizeH,uint64_t batchIndex) |
---|---|
Python Function |
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) |
Function Usage |
Sets cropping parameters in dynamic AIPP scenarios. It is a synchronous interface. |
Input Description |
aipp_parms_set: int, pointer to the dynamic AIPP parameter object.
crop_switch: int, whether to crop an image. Values:
crop_start_pos_w: int, horizontal coordinate of the crop start. For YUV420SP_U8, the value must be an even number.
crop_start_pos_h: int, vertical coordinate of the crop start. For YUV420SP_U8, the value must be an even number.
crop_size_w: int, crop size width. For YUV420SP_U8, the value must be an even number.
crop_size_h: int, crop size height. For YUV420SP_U8, the value must be an even number.
batch_index: int, index of batch for image cropping. The default value is 0.
|
Return Value |
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:
|
Precautions |
None |
Function: set_aipp_padding_params
C Prototype |
aclError aclmdlSetAIPPPaddingParams(aclmdlAIPP *aippParmsSet, int8_t paddingSwitch,int32_t paddingSizeTop, int32_t paddingSizeBottom,int32_t paddingSizeLeft, int32_t paddingSizeRight,uint64_t batchIndex) |
---|---|
Python Function |
ret = acl.mdl.set_aipp_padding_params(aipp_parms_set, padding_switch, padding_size_top, padding_size_bottom, padding_size_left, padding_size_right, batch_index) |
Function Usage |
Sets padding parameters in dynamic AIPP scenarios. It is a synchronous interface. |
Input Description |
aipp_parms_set: int, pointer to the dynamic AIPP parameter object.
padding_switch: int, whether to perform padding on the image. Values:
padding_size_top: int, top padding size.
padding_size_bottom: int, bottom padding size.
padding_size_left: int, left padding size.
padding_size_right: int, right padding size.
batch_index: int, index of batch for image padding. The default value is 0.
|
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: set_aipp_dtc_pixel_mean
C Prototype |
aclError aclmdlSetAIPPDtcPixelMean(aclmdlAIPP *aippParmsSet, int16_t dtcPixelMeanChn0, int16_t dtcPixelMeanChn1, int16_t dtcPixelMeanChn2, int16_t dtcPixelMeanChn3, uint64_t batchIndex) |
---|---|
Python Function |
ret = acl.mdl.set_aipp_dtc_pixel_mean(aipp_parms_set, dtc_pixel_mean_chn0, dtc_pixel_mean_chn1, dtc_pixel_mean_chn2, dtc_pixel_mean_chn3, batch_index) |
Function Usage |
Sets the mean value of each channel in dynamic AIPP scenarios. It is a synchronous interface. |
Input Description |
aipp_parms_set: int, pointer to the dynamic AIPP parameter object.
dtc_pixel_mean_chn0: int, mean value of channel 0.
dtc_pixel_mean_chn1: int, mean value of channel 1.
dtc_pixel_mean_chn2: int, mean value of channel 2.
dtc_pixel_mean_chn3: int, mean value of channel 3. If there are only three channels, the default value is 0.
batch_index: int, index of batch for channel mean value setting. The default value is 0.
|
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: set_aipp_dtc_pixel_min
C Prototype |
aclError aclmdlSetAIPPDtcPixelMin(aclmdlAIPP *aippParmsSet, float dtcPixelMinChn0, float dtcPixelMinChn1, float dtcPixelMinChn2, float dtcPixelMinChn3, uint64_t batchIndex) |
---|---|
Python Function |
ret = acl.mdl.set_aipp_dtc_pixel_min(aipp_parms_set, dtc_pixel_mean_chn0, dtc_pixel_mean_chn1, dtc_pixel_mean_chn2, dtc_pixel_mean_chn3, batch_index) |
Function Usage |
Sets the minimum value of each channel in dynamic AIPP scenarios. It is a synchronous interface. |
Input Description |
aipp_parms_set: int, pointer to the dynamic AIPP parameter object.
dtc_pixel_mean_chn0: int, mean value of channel 0.
dtc_pixel_mean_chn1: int, mean value of channel 1.
dtc_pixel_mean_chn2: int, mean value of channel 2.
dtc_pixel_mean_chn3: int, mean value of channel 3. If there are only three channels, the default value is 0.
batch_index: int, index of batch for channel mean value setting. The default value is 0.
|
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: set_aipp_pixel_var_reci
C Prototype |
aclError aclmdlSetAIPPPixelVarReci(aclmdlAIPP *aippParmsSet, float dtcPixelVarReciChn0, float dtcPixelVarReciChn1, float dtcPixelVarReciChn2, float dtcPixelVarReciChn3, uint64_t batchIndex) |
---|---|
Python Function |
ret = acl.mdl.set_aipp_pixel_var_reci(aipp_parms_set, dtc_pixel_var_reci_chn0, dtc_pixel_var_reci_chn1, dtc_pixel_var_reci_chn2, dtc_pixel_var_reci_chn3, batch_index) |
Function Usage |
Sets the variance of each channel in dynamic AIPP scenarios. It is a synchronous interface. |
Input Description |
aipp_parms_set: int, pointer to the dynamic AIPP parameter object.
dtc_pixel_var_reci_chn0: int, variance of channel 0.
dtc_pixel_var_reci_chn1: int, variance of channel 1.
dtc_pixel_var_reci_chn2: int, variance of channel 2.
dtc_pixel_var_reci_chn3: int, variance of channel 3. If there are only three channels, the default value is 1.0.
batch_index: int, index of batch for channel variance setting. The default value is 0.
|
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: set_input_aipp
C Prototype |
aclError aclmdlSetInputAIPP(uint32_t modelId, aclmdlDataset *dataset, size_t index, const aclmdlAIPP *aippParmsSet) |
---|---|
Python Function |
ret = acl.mdl.set_input_aipp(model_id, dataset, index, aipp_parms_set) |
Function Usage |
Sets AIPP parameters for model inference in dynamic AIPP scenarios. It is a synchronous interface. |
Input Description |
model_id: int, ID of a model.
dataset: int, input data of a model.
index: int, index of the input AIPP. Index is obtained by calling acl.mdl.get_input_index_by_name. For dynamic AIPP, the input name is fixed to ascend_dynamic_aipp_data. aipp_parms_set: int, pointer to the dynamic AIPP parameter object.
|
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
- Function: create_aipp
- Function: destroy_aipp
- Dynamic AIPP Parameter Settings
- Function: set_aipp_input_format
- Function: set_aipp_csc_params
- Function: set_aipp_rbuv_swap_switch
- Function: set_aipp_ax_swap_switch
- Function: set_aipp_src_image_size
- Function: set_aipp_scf_params
- Function: set_aipp_crop_params
- Function: set_aipp_padding_params
- Function: set_aipp_dtc_pixel_mean
- Function: set_aipp_dtc_pixel_min
- Function: set_aipp_pixel_var_reci
- Function: set_input_aipp