What do input_format_t, output_order_t mean?

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu

Which version of system do you use? Please provide the version of the system here:

Ubuntu 22.04

Please describe your issue below:

While converting YOLO, I saw the following values set when setting the input/output.

typedef enum {
    AML_INPUT_DEFAULT      = 0,    //channel format: caffe 2 1 0 ,others 0 1 2
    AML_INPUT_MODEL_NHWC   = 1,    //channel format: 0 1 2
    AML_INPUT_MODEL_NCHW   = 2,    //channel format: 2 1 0
} aml_input_format_t;
typedef enum {
    AML_OUTPUT_ORDER_DEFAULT      = 0,    //output format:  nhwc for adla, nchw for galcore
    AML_OUTPUT_ORDER_NHWC         = 1,    //output format: nhwc
    AML_OUTPUT_ORDER_NCHW         = 2,    //output format: nchw
} aml_output_order_t;

Also, when I checked the input/output of the converted yolo model, it was in HWC structure like below.


Inputs                  : [0 ]
    Input[0]            : 0
    Dim Count           : 4
    Size of dim[0]      : 1
    Size of dim[1]      : 416
    Size of dim[2]      : 416
    Size of dim[3]      : 3
    type                : Fp32
    inputs_memory_size  : 2028.00 kb


Outputs                 : [1131 1150 1112 ]
    Output[0]           : 1131
    Dim Count           : 4
    Size of dim[0]      : 1
    Size of dim[1]      : 26
    Size of dim[2]      : 26
    Size of dim[3]      : 72
    type                : Fp32

    Output[1]           : 1150
    Dim Count           : 4
    Size of dim[0]      : 1
    Size of dim[1]      : 52
    Size of dim[2]      : 52
    Size of dim[3]      : 72
    type                : Fp32

    Output[2]           : 1112
    Dim Count           : 4
    Size of dim[0]      : 1
    Size of dim[1]      : 13
    Size of dim[2]      : 13
    Size of dim[3]      : 72
    type                : Fp32
    outputs_memory_size : 998.16 kb

config:
  max_outstanding_outputs : 4
  axi_sram_size           : 1277952 bytes

First, I’m wondering what aml_input_format_t and aml_output_order_t do.

Second, I’m wondering if there is an easy way to change the axis order of the input/output.

Hello @GHdevlog

Maybe you can get some information from the documentation.

Is the model structure shown by adla_info_tool in NHWC format?

[0] = N
[1] = H
[2] = W
[3] = C

Like this. right?

Hello @GHdevlog ,

aml_input_format_t and aml_output_order_t are used in C++ inferring code. And the two parameters do not need to set normally. Input use AML_INPUT_DEFAULT that is default value. Whatever you use in output, output shape is the same.

Now convert tool cannot change the axis. You need to change axis before converting.

Adla convert tool format is NHWC. If your model has not transpose, it is like this.

Consider the size of the input data as [NHWC : 1,100,200,3].

I wonder how the model receives input when aml_input_format_t is AML_INPUT_MODEL_NHWC vs AML_INPUT_MODEL_NCHW, and if there is any difference in the input structure.

If AML_INPUT_MODEL_NHWC, the input would be [1,100,200,3],
Conversely, if AML_INPUT_MODEL_NCHW, the input would be [1,3,100,200]?

Hello @GHdevlog ,

Yes, you are right.