4.1.3.3. Other Algorithm Model Samples¶
Other algorithm model samples refer to the samples in the 05_miscellaneous/ and 06_custom_op/ folders. Amongst, 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 receives YUV data at Runtime using D-Robotics’ 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.
Usages and directories of the above mentioned samples please refer to below contents.
4.1.3.3.1. How to Use¶
Each sample is encapsulated into a shell script in order. Run shell scripts in order to understand usage of corresponding tools, API features and usage etc.
4.1.3.3.2. Miscellaneous Samples¶
4.1.3.3.2.1. lenet_gray¶
4.1.3.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 // Check model validity
├── 02_get_mnist.sh // Obtain the calibration dataset
├── 03_build.sh // Convert the debugging model
├── 04_inference.sh // Run inference using the onnx runtime
├── README.md
├── lenet_gray_config.yaml
├── postprocess.py
├── preprocess.py
└── process_mnist.py
4.1.3.3.2.1.2. Description¶
This section contains model conversion, simulator runtime and on-board runtime samples of gray image models.
4.1.3.3.2.2. resnet50_feature¶
4.1.3.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 // Check model validity
├── 02_build.sh // Convert the debugging model
├── 03_inference.sh // Run inference using the onnx runtime
├── README.md
├── inference.py
└── resnet50_feature_config.yaml
4.1.3.3.2.2.2. Description¶
This section contains model conversion, simulator runtime and on-board runtime samples of resnet50_feature.
4.1.3.3.2.3. vector-diff¶
4.1.3.3.2.3.1. Directory¶
03_vector_diff
.
└── mobilenet_mapper
├── 01_inference_rt.sh
├── 02_vec_diff.sh // Analyze output data using the vec_diff tool
├── ILSVRC2012_val_00000001.bin
└── README.md
4.1.3.3.2.3.2. Output List¶
Some CSV list(s) whose filename(s) is/are specified by the vec_diff -o command. In which: Left Files, Right Files, Cosine Similarity,Relative Euclidean Distance, Max Absolute Error and Mean Square Error.
See below:
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 |
4.1.3.3.2.4. multi_input_example¶
4.1.3.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 // Check model validity
├── 02_preprocess.sh // Run model preprocess
├── 03_build.sh // Convert the debugging model
├── 04_inference.sh // Inference a single image
├── README.md
├── data_preprocess.py
├── data_transformer.py
├── inference.py
└── mobilenetv2_multi_config.yaml
4.1.3.3.2.4.2. Description¶
This section contains model conversion, simulator runtime and on-board runtime samples of multi-input models.
4.1.3.3.2.5. model_verifier¶
4.1.3.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 // Run model preprocess
├── 02_build.sh // Convert the debugging model
├── 03_model_verify.sh // Run model verification
├── calibration_data_feature
├── preprocess.py
├── README.md
├── mobilenet_config_bgr.yaml
├── mobilenet_config_yuv444.yaml
└── resnet50_featuremap_config.yaml
4.1.3.3.2.5.2. Description¶
This section contains samples of model verification tool.
4.1.3.3.2.6. model_info¶
4.1.3.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 // Run model preprocess
├── 02_build.sh // Convert the debugging model
├── 03_model_info_check.sh // Obtain and print model information
├── README.md
├── mobilenet_config.yaml
└── preprocess.py
4.1.3.3.2.6.2. Description¶
This section contains a samples of the model validation tool.
4.1.3.3.2.7. mobilenet_bgr¶
4.1.3.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 // Check model validity
├── 02_preprocess.sh // Preprocess the dataset
├── 03_build.sh // Convert the debugging model
├── 04_inference.sh // Inference a single image
├── README.md
├── mobilenet_config.yaml
├── postprocess.py
└── preprocess.py
4.1.3.3.2.7.2. Description¶
This is a sample of the MobileNetv1 model whose input_type_rt is specified as bgr.
4.1.3.3.2.8. mobilenet_yuv444¶
4.1.3.3.2.8.1. Directory¶
10_mobilenet_yuv444
.
└── mapper
├── 00_init.sh // Obtain the model and calibration dataset required for the current sample
├── 01_check.sh // Check model validity
├── 02_preprocess.sh // Preprocess the dataset
├── 03_build.sh // Convert the debugging model
├── 04_inference.sh // Inference a single image
├── README.md
├── mobilenet_config.yaml
├── postprocess.py
└── preprocess.py
4.1.3.3.2.8.2. Description¶
This is a sample of the MobileNetv1 model whose input_type_rt is specified as yuv444.
4.1.3.3.3. User Custom OP Sample¶
4.1.3.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
4.1.3.3.3.2. Description¶
When converting the open-source framework trained floating-point model into fixed-point model, the conversion will fail if there are Toolchain unsupported OP(s). In such case, developers can still convert the model by adding custom OP using the custom OP feature.
The mapper folder contains the scripts and configuration file required by running this sample.