Skip to content

Latest commit

 

History

History
109 lines (98 loc) · 2.23 KB

File metadata and controls

109 lines (98 loc) · 2.23 KB

Object Detection

Overview

Object detection engine using TensorRT for optimized inference.

Supported architectures

YOLO

  1. Export YOLO model to ONNX:
python3 -m venv venv
./venv/bin/pip3 install ultralytics onnx onnxsim
mkdir data
./venv/bin/yolo export --model=data/yolo11n.pt --format=onnx --opset=12
  1. Convert to TensorRT engine:
trtexec --onnx=data/yolo11n.onnx --saveEngine=data/yolo11n.engine --fp16

Configure

In 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
    ]
  }
}

Compile

# in root directory
meson setup build -Dbuild_apps=detector
meson compile -C build

Run

# in root directory
cd build/app/detector
./detect -i 0 -o data/webcam.mp4 -c data/config.json -d