Dynamic Shape Concepts and Restrictions
Concepts
Concept |
Description |
|---|---|
Dynamic batch/image size |
The batch size or image size is not fixed in certain scenarios. For example, in the object detection+target recognition cascade scenario where the number of detected objects is subject to change, the batch size of the target recognition input is dynamic.
|
Dynamic dimension sizes (ND format only) |
Dynamic dimensions for the ND format are useful in scenarios where input dimensions are unknown (such as the Transformer network). |
Restrictions
Application Scenario |
Precautions |
|---|---|
Performing inference on a single model |
AIPP (static or dynamic) and dynamic dimensions (ND format only) are mutually exclusive. |
Performing inference on a single model |
Select only one of the following methods:
|
Output buffer allocation for model inference |
You can allocate buffer based on the runtime dimensions. To be accurate, you can call aclmdlGetOutputSizeByIndex to obtain the required buffer size before allocating the buffer. |
Both static AIPP and dynamic image size enabled |
Because the width and height of the input image are uncertain in the dynamic image size scenario, when the insert_op_conf parameter of the ATC tool is used to take the AIPP configuration file, the cropping and padding functions cannot be enabled in the AIPP configuration file. Additionally, the src_image_size_w and src_image_size_h parameters in the configuration file need to be set to 0. |
Both dynamic AIPP and dynamic batch size enabled |
|
Both dynamic AIPP and dynamic image size enabled |
|
Dynamic AIPP and dynamic shape input (setting the shape range) used at the same time |
The width and height of the output image of dynamic AIPP must be within the configured shape range. |