Other Algorithm Model Samples

Other algorithm model samples refer to the samples in the 05_miscellaneous/ folders.

The 05_miscellaneous/ folder contains miscellaneous samples used for other features in the X3 Toolchain, e.g., how to enable the RGB data trained model to receive YUV data at runtime using Horizon's model conversion toolchain.

For the sample usage, directories, and contents of the above samples, please refer to the following sections.

How to Use

Under each subfolder, all usage samples are packaged into a shell script in order.

Run the shell scripts in order to understand the usage of corresponding tools, API features, usage, etc.

Miscellaneous Samples

lenet_gray

Directory

01_lenet_gray/ . └── mapper ├── 00_init.sh // Obtain the model and calibration dataset required for the current sample ├── 01_check.sh // Pre-validates the model ├── 02_get_mnist.sh // Obtains the calibration dataset ├── 03_build.sh // Converts the debugging model ├── 04_inference.sh // Performs inference using the ONNX runtime ├── README.md ├── inference.py ├── lenet_gray_config.yaml └── process_mnist.py

Descriptions

This section contains model conversion, simulator runtime, and on-board runtime samples of gray image models.

resnet50_feature

Directory

02_resnet50_feature . └── mapper ├── 00_init.sh // Obtain the model and calibration dataset required for the current sample ├── 01_check.sh // Pre-validates the model ├── 02_build.sh // Converts the debugging model ├── 03_inference.sh // Performs inference using the ONNX runtime ├── README.md ├── inference.py └── resnet50_feature_config.yaml

Descriptions

This section contains model conversion, simulator runtime, and on-board runtime samples of resnet50_feature.

multi_input_example

Directory

04_multi_input_example . └── mapper ├── 00_init.sh // Obtain the model and calibration dataset required for the current sample ├── 01_check.sh // Pre-validates the model ├── 02_preprocess.sh // Preprocesses the model ├── 03_build.sh // Converts the debugging model ├── 04_inference.sh // Performs inference on a single image ├── data_preprocess.py ├── data_transformer.py ├── inference.py ├── README.md └── mobilenetv2_multi_config.yaml

Description

This section contains model conversion, simulator runtime, and on-board runtime samples of multi-input models.

model_verifier

Directory

07_model_verifier . ├── 00_init.sh // Obtain the model and calibration dataset required for the current sample ├── 01_preprocess.sh // Preprocesses the model ├── 02_build.sh // Converts the debugging model ├── 03_model_verify.sh // Verifies the model ├── calibration_data_feature ├── preprocess.py ├── README.md ├── mobilenet_config_bgr.yaml ├── mobilenet_config_yuv444.yaml └── resnet50_featuremap_config.yaml

Description

This section contains samples of model verification tool.

model_info

Directory

08_model_info . ├── 00_init.sh // Obtain the model and calibration dataset required for the current sample ├── 01_preprocess.sh // Preprocesses the model ├── 02_build.sh // Converts the debugging model ├── 03_model_info_check.sh // Obtains and prints the model information ├── README.md ├── mobilenet_config.yaml └── preprocess.py

Description

This section contains a sample of the model validation tool.

mobilenet_bgr

Directory

09_mobilenet_bgr . └── mapper ├── 00_init.sh // Obtain the model and calibration dataset required for the current sample ├── 01_check.sh // Pre-validates the model ├── 02_preprocess.sh // Preprocess the dataset ├── 03_build.sh // Converts the debugging model ├── 04_inference.sh // Performs inference on a single image ├── README.md ├── mobilenet_config.yaml ├── postprocess.py └── preprocess.py

Description

This is a sample of the MobileNetv1 model whose input_type_rt is specified as bgr.

mobilenet_yuv444

Directory

11_mobilenet_yuv444 . └── mapper ├── 00_init.sh // Obtain the model and calibration dataset required for the current sample ├── 01_check.sh // Pre-validates the model ├── 02_preprocess.sh // Preprocess the dataset ├── 03_build.sh // Converts the debugging model ├── 04_inference.sh // Performs inference on a single image ├── README.md ├── mobilenet_config.yaml ├── postprocess.py └── preprocess.py

Description

This is a sample of the MobileNetv1 model whose input_type_rt is specified as yuv444.

User Custom OP Sample

Directory

06_custom_op . └── mapper ├── 00_init.sh ├── 03_build.sh ├── 04_inference.sh ├── README.md ├── create_onnx.py ├── custom_op_config.yaml ├── custom_op_inference.py └── horizon_ops.py

Descriptions

When converting the floating-point model trained by open-source frameworks into the fixed-point model, the conversion will fail if the floating-point model contains the ops not supported by the Toolchain. In such cases, developers can still convert the model by adding custom ops using the custom op feature.

The mapper folder contains the scripts and configuration file required by running this sample.