--dynamic_image_size

Applicability

Product

Supported

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

Sets dynamic image size profiles. Applies to the scenario where the resolution of images input for inference is unfixed.

See Also

Argument

Argument: Dynamic image size, for example, "imagesize1_height,imagesize1_width;imagesize2_height,imagesize2_width".

Format: Enclose the whole argument in double quotation marks (""), and separate profiles by semicolons (;) and that within a profile by commas (,).

Restrictions:

  • For the following products, the profile range is (1, 100]. That is, at least two profiles must be set, and a maximum of 100 profiles are supported.

    Atlas A3 training products / Atlas A3 inference products

    Atlas A2 training products / Atlas A2 inference products

    Atlas 200I/500 A2 inference products

    Atlas inference products

    Atlas training products

  • In the scenario where you have set too large image sizes or too many image size profiles, you are advised to run the swapoff -a command to disable the use of swap space as memory to prevent slow operating environment.

Suggestions and Benefits

Too large image sizes or too many image size profiles will cause model conversion failures. If such failure occurs, you are advised to reduce the number of profiles or decrease the profile value.

Example

--input_shape="data:8,3,-1,-1;img_info:8,4,-1,-1"  --dynamic_image_size="416,416;832,832"

-1 in --input_shape indicates dynamic image size enabled. The input supports the following shape profiles at ATC build time:

Profile 0: data(8,3,416,416)+img_info(8,4,416,416)

Profile 1: data(8,3,832,832)+img_info(8,4,832,832)

Dependencies and Restrictions

  • Restrictions:
    • Networks that contain dynamic-shape operators (middle layers of the network with unfixed shape) are not supported.
    • To use the dynamic image size feature, ensure that the configured profiles are within the valid range supported by the original framework.
    • If the dynamic image size is enabled, the sizes of the dataset images used for inference must match the runtime image size.
    • If you have set the dynamic image size as well as static AIPP (by setting --insert_op_conf), you must keep the cropping and padding switches off, and set src_image_size_w and src_image_size_h to 0 in the configuration file.
    • If you have set the dynamic image size as well as dynamic AIPP (by setting --insert_op_conf):

      In your inference code, call the aclmdlSetInputAIPP API to set dynamic AIPP parameters. Ensure that cropping and padding are disabled. In this scenario, ensure that the width and height configured by calling aclmdlSetInputAIPP are the same as those configured by calling aclmdlSetDynamicHWSize. That is, the width and height must be set to the maximum dynamic image size.

      For details about the APIs, see ""Model Execution"".

    • The offline model generated with this option is configured with the dynamic image size feature, which may result in structural differences compared with models generated with a fixed image size, leading to different inference performance.
  • API usage:

    If this option is used to set the dynamic image size during model conversion, you need to perform the following operations before calling the model execution APIs to run an application project for inference:

    • Use the aclmdlSetDynamicHWSize API to set the real image size. The size of the dataset images used for inference must match the specific image size in use.
    • If aclmdlSetDynamicHWSize is not called, values are assigned based on the maximum width and height within the dynamic image size range by default during model execution.

    For details about the API, see ""aclmdlSetDynamicHWSize"".