The hrt_model_exec infer tool can be used for model inference, where the input data are defined by user and one frame is inferred.
The program runs a single frame of data in a single thread and outputs the time of the model execution.
The support range of the model: QAT(Quantized Awareness Training) model, PTQ (Post-Training Quantization) model.
| Parameter | Parameter Description | Correlated Parameters | |
|---|---|---|---|
-h, --help | None. | Display the help information. | None. |
-v, --version | None. | View the version number of the DNN prediction library of the tool. | None. |
infer | None. | Perform model inference and get model inference results. | This parameter should be used together with input_file to specify the input image path, and the tool resizes the image according to the model information and organizes the model input information. |
model_file | string | Model file path, multiple paths can be separated by commas. | None. |
model_name | string | Specify the name of a model. | None. |
input_file | string | Model input information. The input of the image type, it must have one of the following file name suffixes: PNG/JPG/JPEG/png/jpg/jpeg/bin/txt.The inputs should be separated by commas ,, such as xxx.jpg,input.txt. | This parameter needs to be used in conjunction with the subcommand inferto specify the input image path, and the tool resizes the image according to the model information and organizes the model input information. |
core_id | string | Specify the running core, 0 means arbitrary core, 1 means core0, 2 means core1 and etc. Default value is 0. When you need to specify multiple cores, separate them with commas, such as "1,2". | None. |
input_img_properties | string | The color space information of the model image input, range [Y, UV]. | This parameter should be used together with input_file, each image type input in input_file needs to specify a Y/UV type, and each input color space needs to be separated by an English character comma ,, such as: Y,UV. |
input_valid_shape | string | Model dynamic validShape input information. If the model input attribute validShape contains -1, the -1 part needs to be completed, and multiple validShape are separated by English semicolons.For example: --input_valid_shape="1,376,376,1;1,188,188,2". | None. |
input_stride | string | Model dynamic stride input information. If the model input attribute stride contains -1, the -1 part needs to be completed, and multiple strides are separated by English semicolons.For example: --input_stride="50176,224,1,1;25088,224,2,1". | None. |
frame_count | int | The number of running frames of the execution model. infer, defaults to 1. perf, defaults to 200. | When the subcommand is perf, it takes effect when perf_time is not set. |
dump_intermediate | string | dump model each layer of input and output, range [0, 3]. Default value is 0.dump_intermediate=0, the dump function is turned off by default.dump_intermediate=1, the input and output data of each node layer in the model are saved as bin, where inputs and outputs of node are stride data.dump_intermediate=2, the input and output data of each node layer in the model are saved as bin and txt, where the inputs and outputs of node are stride data.dump_intermediate=3, the input and output data of each node layer in the model are saved as bin and txt, where the inputs and outputs of node are valid data. | None. |
enable_dump | bool | Enables dump model input and output. Default value is false. | None. |
dump_precision | int | Controls the number of decimal places of the float type data output in txt format. Default value is 9. | None. |
dequantize_process | bool | Inverse quantization of model output. Default value is false. | Effective when the enable_dump parameter is true. |
remove_padding_process | bool | Remove padding of model output. Default value is false. | Effective when the enable_dump parameter is true. |
dump_format | string | The format of the dump model input and output, range [bin, txt]. Default value is bin. | None. |
dump_txt_axis | int | Control line feed rules for txt format input and output. If output dimension = n, then parameter range: [0, n]. Defaults to -1, which means one data per row. | None. |
enable_cls_post_process | bool | Enables classification post-processing. Default value is false. | This parameter needs to be used in conjunction with the subcommand infer. Currently, it only supports post-processing of the ptq classification model and printing of classification results. |
dump_path | string | The path of dump model input and output. | Effective when the enable_dump or dump_intermediate parameter is set. |
The tool infer supports inference for multiple input models, supporting image input, binary file input, and text file input, with input data separated by commas.
The model input information can be viewed via model_info.
If the model input is dynamic, you need to use the input_valid_shape and input_stride parameters to complete the dynamic information according to the actual input situation. You can choose to specify the parameters in the following two ways:
Only give the validShape or stride information of the dynamic input.
Give the validShape or stride information of all inputs. The information of non-dynamic inputs must be consistent with the model information.
The tool will automatically complete the dynamic input information to the maximum extent, which is convenient for you to perform performance evaluation more easily. You can choose whether to let the tool automatically complete it according to the actual situation.
If the input stride is dynamic and validShape is fixed, you can not specify the input_stride parameter. The tool will automatically complete it according to the minimum alignment rule and print the alignment information.
If both validShape and stride are dynamic:
If the input is a picture type, you need to specify the color space information of the picture input_img_properties, and the other parameters can be left unspecified. The tool will fill in the input_valid_shape and input_stride information according to the size of the picture.
If the input is a type other than a picture or is not specified, you need to set the input_valid_shape information, and the input_stride information will be automatically filled in and printed.
Taking the model in the Dynamic Input Introduction section as an example, you can run the model with the following command:
When input_file is given an image input, you need to use the input_img_properties parameter to specify which color space of the image you want to use as input to the model. Currently, only Y and UV color spaces are supported.