Skip to content

Latest commit

History

History
32 lines (23 loc) 路 1.93 KB

model_export.md

File metadata and controls

32 lines (23 loc) 路 1.93 KB

English | 涓枃

Model Export

You can use the trtyolo CLI tool provided by tensorrt_yolo to export ONNX models and perform post-processing with the EfficientNMS plugin. You can check the specific export command using trtyolo export --help.

When exporting ONNX models for PP-YOLOE and PP-YOLOE+, only the batch dimension will be modified, while the height and width dimensions will remain unchanged. You need to set this in PaddleDetection, defaulting to 640.

The official repositories for YOLOv6, YOLOv7 and YOLOv9 provide ONNX model exports with the EfficientNMS plugin included. Therefore, there is no need to re-provide these exports here.

# Use remote repository for yolov5
trtyolo export -w yolov3.pt -v yolov3 -o output

# Use local repository for yolov5
trtyolo export -w yolov5s.pt -v yolov5 -o output --repo_dir your_local_yolovs_repository

# Use ultralytics trained YOLO series models (yolov3, yolov5, yolov6, yolov8, yolov9), and specify EfficientNMS plugin parameters with dynamic batch
trtyolo export -w yolov8s.pt -v ultralytics -o output --max_boxes 100 --iou_thres 0.45 --conf_thres 0.25 -b -1

# PP-YOLOE, PP-YOLOE+
trtyolo export --model_dir modeldir --model_filename model.pdmodel --params_filename model.pdiparams -o output

The generated ONNX models can be exported as TensorRT models using the trtexec tool.

# Static
trtexec --onnx=model.onnx --saveEngine=model.engine --fp16
# Dynamic
trtexec --onnx=model.onnx --saveEngine=model.engine --minShapes=images:1x3x640x640 --optShapes=images:4x3x640x640 --maxShapes=images:8x3x640x640 --fp16