Menu

🚀Deploy Custom Model in Tofu6

Download

1.Model quantization

The model quantization method is exactly the same as that used by Ultralytics.
We have modified the original code of export model to adapt it for model inference with the Tofu6 module.
The model input is at a resolution of 3x640x640, model type is yolov8s, supports detection models with up to 4 classes.

You can modify the export_nnie.py file to export your own model.

python Copy
from ultralytics import YOLO
model = YOLO("./model/yolov8s.pt")
success = model.export(format="onnx", opset=13)

Please note that the code we referenced uses ONNX opset version 13.
When using it,please isolate the environment with Anaconda from the training environment,and do not install Ultralytics in the environment to avoid calling the wrong functions for export.

After model quantization,please use Netron to view the ONNX network.
The correct network should end as shown in the figure below.

2.Deploy Custom Model

This function is based on the Tofu6 VMware image.
Recommanded VMware version is VMware® Workstation 16 Pro or later version.

2.1 Environment Check

Use the administrator account, the default password is 123.

bash Copy
sudo su
123
atc --version

Check the current ATC version.
The printing environment is correct.
Printing the following information indicates that the environment is correct.

bash Copy
Mapper Version 1.0.0.0_B010 (PICO_1.0) 2311021147192e53b(CPU) (INST_2.0.9)

2.2 Prepare Files

  1. Onnx file which is transfered from .pt to .onnx.
    We provided the reference .onnx file located in /home/littro/Model/yolov8/
  2. Reference images and .txt image list file.
    We provided the reference images and .txt file located in /home/littro/Model/coco/
  3. Foulder used for locate the export model.

2.3 Export Model

Use the administrator account.

bash Copy
sudo su
123

Run the code after modifying the content.

🟢 Reference command:

bash Copy
atc  --dump_data=0 --input_shape="images:1,3,640,640" \
--input_type="images:UINT8" --log_level=0 --online_model_type=0 --batch_num=1 \
--input_format=NCHW \
--output="/root/modelzoo/yolov8s_output/SS928V100/yolov8s_output" \
--soc_version=SS928V100 \
--insert_op_conf=/root/modelzoo/yolov8s/SS928V100/insert_op.cfg \
--framework=5 --compile_mode=0 --save_original_model=false \
--model="/home/littro/Model/yolov8/yolov8s.onnx" \
--image_list="images:/home/littro/Model/coco/imagelist_20240611134217.txt" 

Sections that need to be modified manually:

🟢 output: The output path.
The refence in the code is:

bash Copy
--output="/root/modelzoo/yolov8s_output/SS928V100/yolov8s_output"

🟢 model: The path and name of the ONNX model.
The refence in the code is:

bash Copy
--model="/home/littro/Model/yolov8/yolov8s.onnx"

🟢 image_list: A list of image files used as references for model generation.
It should include 20 to 50 images from the training dataset.
The refence in the code is:

bash Copy
--image_list="images:/home/littro/Model/coco/imagelist_20240611134217.txt"

The image list is saved as a.txtfile,with the format as follows:

text Copy
/home/littro/Model/coco/000000000036.jpg
/home/littro/Model/coco/000000000049.jpg
/home/littro/Model/coco/000000000061.jpg
/home/littro/Model/coco/000000000074.jpg
/home/littro/Model/coco/000000000077.jpg
/home/littro/Model/coco/000000000086.jpg
/home/littro/Model/coco/000000000109.jpg
/home/littro/Model/coco/000000000110.jpg

We provided the reference images and .txt file located in /home/littro/Model/coco/.
The model export process will take several minutes.
Once the export is successful,the resulting file will be in the .omformat.

2.4 Model Packaging

Run the packaging script.
Script path:/home/littro/Model/yolov8/

bash Copy
./encryptmodel yolov8s_output.om model_custom.ir

After running, the packaged model file named model_custom.ir will be obtained.

2.5 Create an Upgrade Package

Script path:/home/littro/Model/updpkg_custom_script

Copy the generated model_custom.ir model to the specified path and run the script.

Please note that the model was generated by an administrator.If you copy the file using a regular user,please use the command chmod 777 file_name to grant other users permission to edit the file.

bash Copy
./updpkg_custom_model_vis.sh ./model_custom.ir

After running,the .dev upgrade package will be generated automatically.
This upgrade package can be used for remote upgrades on Tofu6.
For detailed upgrade procedures[click here] ,please refer to the TVMS software user manual.


Previous
🌐Multispectral Device IP Change Instructions
Next
Protocols
Last modified: 2025-07-28