6.4.3. Other Algorithm Model Samples¶
Other algorithm model samples refer to the samples in the 05_miscellaneous/ and 06_custom_op/ folders.
Among them.
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 D-Robotics’s model conversion toolchain.The
06_custom_op/folder is a user custom OP sample helps developers understand how to add custom OP when there are Toolchain unsupported OPs.
For the sample usage, directories, and contents of the above samples, please refer to the following sections.
6.4.3.1. 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.
6.4.3.2. Miscellaneous Samples¶
6.4.3.2.1. lenet_gray¶
6.4.3.2.1.1. 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
6.4.3.2.1.2. Descriptions¶
This section contains model conversion, simulator runtime, and on-board runtime samples of gray image models.
6.4.3.2.2. resnet50_feature¶
6.4.3.2.2.1. 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
6.4.3.2.2.2. Descriptions¶
This section contains model conversion, simulator runtime, and on-board runtime samples of resnet50_feature.
6.4.3.2.3. vector-diff¶
6.4.3.2.3.1. Directory¶
03_vector_diff
.
└── mobilenet_mapper
├── 01_inference_rt.sh
├── 02_vec_diff.sh // Analyzes the output data using the vec_diff tool
├── ILSVRC2012_val_00000001.bin
└── README.md
6.4.3.2.3.2. Output List¶
CSV files and lists specified by the vec_diff -o command, including Left Files, Right Files, Cosine Similarity, Relative Euclidean Distance, Max Absolute Error, and Mean Square Error, as follows:
Left Files |
Right Files |
Cosine Similarity |
Relative Euclidean Distance |
Max Absolute Error |
Mean Square Error |
|---|---|---|---|---|---|
Layerxxx-quanti-input.txt |
Layerxxx-float-input.txt |
xxx |
xxx |
xxx |
xxx |
Layerxxx-quanti-param.txt |
Layerxxx-float-param.txt |
xxx |
xxx |
xxx |
xxx |
6.4.3.2.4. multi_input_example¶
6.4.3.2.4.1. 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
6.4.3.2.4.2. Description¶
This section contains model conversion, simulator runtime, and on-board runtime samples of multi-input models.
6.4.3.2.5. model_verifier¶
6.4.3.2.5.1. 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
6.4.3.2.5.2. Description¶
This section contains samples of model verification tool.
6.4.3.2.6. model_info¶
6.4.3.2.6.1. 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
6.4.3.2.6.2. Description¶
This section contains a sample of the model validation tool.
6.4.3.2.7. mobilenet_bgr¶
6.4.3.2.7.1. 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
6.4.3.2.7.2. Description¶
This is a sample of the MobileNetv1 model whose input_type_rt is specified as bgr.
6.4.3.2.8. mobilenet_yuv444¶
6.4.3.2.8.1. 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
6.4.3.2.8.2. Description¶
This is a sample of the MobileNetv1 model whose input_type_rt is specified as yuv444.
6.4.3.3. User Custom OP Sample¶
6.4.3.3.1. 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
6.4.3.3.2. 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.