Picture Inference Tool

The algorithm package provides the tools/infer_hbir.py tool for the inference verification of fixed-point models (only supporting the int-infer stage). The core part is used to load the quantized HBIR format model, complete the inference with the specified input and visualize the output results, verifying the correctness of the model's inference on the Horizon computing platform.

Usage

Run tools/infer_hbir.py, which supports custom input files or sampling input from the dataset, to complete the visual verification of the inference results. --use-dataset

Parameters Introduction

ParameterDescription
--config, -cPath to the config file.
--model-inputsOptional parameter, specifies the path for the input data. If not provided, it will look for the input_path parameter in the config file instead.
--save-pathThe save path for visualization results.
--use-datasetOptional parameter, if --model-inputs is not provided, and the config file does not contain input_path, or no data can be found under the input_path directory, then this parameter must be set to True to indicate that the data should be loaded from the dataset specified in the config file.

Usgae Example

Complete fixed-point model inference for resnet50_imagenet using the specified input file, and save the visualization files of inference results to the designated path.

python3 tools/infer_hbir.py \
        --config       configs/classification/resnet50_imagenet.py \
        --model-inputs inputs/resnet50_sample.npy \
        --save-path    outputs/infer_visualization

For a detailed introduction to the configuration file, please refer to the [Configuration] section [config configuration] (../config/keywords).