Object detection engine using TensorRT for optimized inference.
- Export YOLO model to ONNX:
python3 -m venv venv
./venv/bin/pip3 install ultralytics onnx onnxsimmkdir data
./venv/bin/yolo export --model=data/yolo11n.pt --format=onnx --opset=12- Convert to TensorRT engine:
trtexec --onnx=data/yolo11n.onnx --saveEngine=data/yolo11n.engine --fp16In data folder, add your config.json:
YOLOv7
{
"detector": {
"architecture": "yolo",
"name": "yolov7",
"confidence_threshold": 0.25,
"nms_threshold": 0.45,
"engine": {
"model_path": "./data/yolov7n.engine",
"batch_size": 1,
"precision": 16
},
"class_names": [
// fill in the class names
]
}
}YOLOv8
{
"detector": {
"architecture": "yolo",
"name": "yolov8",
"confidence_threshold": 0.25,
"nms_threshold": 0.45,
"engine": {
"model_path": "./data/yolov8n.engine",
"batch_size": 1,
"precision": 16
},
"class_names": [
// fill in the class names
]
}
}YOLOv11
{
"detector": {
"architecture": "yolo",
"name": "yolov11",
"confidence_threshold": 0.25,
"nms_threshold": 0.45,
"engine": {
"model_path": "./data/yolo11n.engine",
"batch_size": 1,
"precision": 16
},
"class_names": [
// fill in the class names
]
}
}# in root directory
meson setup build -Dbuild_apps=detector
meson compile -C build# in root directory
cd build/app/detector
./detect -i 0 -o data/webcam.mp4 -c data/config.json -d