Model Inference
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.
Support Range
The support range of the model: QAT(Quantized Awareness Training) model, PTQ (Post-Training Quantization) model.
Usage
Parameters Introduction
Usage Example
Model Inference
Single Model Inference
Multiple Models Inference
Model Input Instructions
Multi-input Model Description
The tool infer supports inference for multiple input models, supporting image input, binary file input, text file input, and NumPy array file input, with input data separated by commas.
The model input information can be viewed via model_info.
Dynamic input instructions
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
validShapeorstrideinformation of the dynamic input. -
Give the
validShapeorstrideinformation 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
strideis dynamic andvalidShapeis fixed, you can not specify theinput_strideparameter. The tool will automatically complete it according to the minimum alignment rule and print the alignment information. -
If both
validShapeandstrideare 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 theinput_valid_shapeandinput_strideinformation 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_shapeinformation, and theinput_strideinformation 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:
Image type input instructions
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.
