Function: set_input_aipp
Applicability
|
Product |
Supported (√/x) |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Function Usage
Sets the AIPP attributes for model inference based on the index of the dynamic AIPP input in the dynamic AIPP scenario.
Dynamic AIPP provides the following operations and they are executed in the exact sequence:
- Cropping
- Color space conversion
- Resizing (not supported in the current version)
- Mean subtraction/Normalization
- Padding
Prototype
- C Prototype
1aclError aclmdlSetInputAIPP(uint32_t modelId, aclmdlDataset *dataset, size_t index, const aclmdlAIPP *aippParmsSet)
- Python Function
1ret = acl.mdl.set_input_aipp(model_id, dataset, index, aipp_parms_set)
Parameter Description
|
Parameter |
Description |
|---|---|
|
model_id |
Int, model ID. You can obtain the model ID after the model is successfully loaded by calling the following APIs: |
|
dataset |
Int, pointer address of a model's input data. Data of type aclmdlDataset describes the input data for model inference, while data of type aclDataBuffer describes the input buffer size and address. |
|
index |
Int, input index of the dynamic AIPP input.
|
|
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. |
Return Value Description
|
Return Value |
Description |
|---|---|
|
ret |
Int, error code.
|
Restrictions
- The image size after dynamic AIPP processing must be the same as that defined by the input shape required by the original model.
- In batched inference scenarios, the image size after dynamic AIPP is calculated based on the configuration of each batch. After dynamic AIPP, the output image size must be consistent across batches. Table 1 describes the formulas for calculating the result image size.
- After image cropping, resizing, or padding, the rules for verifying the image size after dynamic AIPP are as follows. aippOutputW and aippOutputH indicate the width and height of the AIPP output image, respectively. Other parameters are the input parameters of the acl.mdl.set_aipp_src_image_size, acl.mdl.set_aipp_crop_params, and acl.mdl.set_aipp_padding_params APIs.
Reference
For details about the API call sequence and example, see Dynamic AIPP (Single Dynamic AIPP Input).
|
Cropping |
Resizing |
Padding |
Output Width and Height |
|---|---|---|---|
|
No |
No |
No |
aippOutputW = srcImageSizeW aippOutputH = srcImageSizeH |
|
Yes |
No |
No |
aippOutputW = cropSizeW aippOutputH = cropSizeH |
|
Yes |
Yes |
No |
aippOutputW = scfOutputSizeW aippOutputH = scfOutputSizeH |
|
Yes |
No |
Yes |
aippOutputW = cropSizeW + paddingSizeLeft + paddingSizeRight aippOutputH = cropSizeH + paddingSizeTop + paddingSizeBottom |
|
No |
No |
Yes |
aippOutputW = srcImageSizeW + paddingSizeLeft + paddingSizeRight aippOutputH = srcImageSizeH + paddingSizeTop + paddingSizeBottom |
|
No |
Yes |
Yes |
aippOutputW = scfOutputSizeW + paddingSizeLeft + paddingSizeRight aippOutputH = scfOutputSizeH + paddingSizeTop + paddingSizeBottom |
|
No |
Yes |
No |
aippOutputW = scfOutputSizeW aippOutputH = scfOutputSizeH |
|
Yes |
Yes |
Yes |
aippOutputW = scfOutputSizeW + paddingSizeLeft + paddingSizeRight aippOutputH = scfOutputSizeH + paddingSizeTop + paddingSizeBottom |