Skip to content

Latest commit

 

History

History
86 lines (76 loc) · 1.78 KB

File metadata and controls

86 lines (76 loc) · 1.78 KB

Object Segmentation

Overview

Object segmentation 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-seg.pt --format=onnx --opset=12
  1. Convert to TensorRT engine:
trtexec --onnx=data/yolo11n-seg.onnx --saveEngine=data/yolo11n-seg.engine --fp16

Configure

In data folder, add your config.json:

YOLOv8
{
  "segmenter": {
    "architecture": "yolo",
    "name": "yolov8",
    "confidence_threshold": 0.25,
    "nms_threshold": 0.45,
    "engine": {
      "model_path": "./data/yolov8n-seg.engine",
      "batch_size": 1,
      "precision": 16
    },
    "class_names": [
      // fill in the class names
    ]
  }
}
YOLOv11
{
  "segmenter": {
    "architecture": "yolo",
    "name": "yolov11",
    "confidence_threshold": 0.25,
    "nms_threshold": 0.45,
    "engine": {
      "model_path": "./data/yolo11n-seg.engine",
      "batch_size": 1,
      "precision": 16
    },
    "class_names": [
      // fill in the class names
    ]
  }
}

Compile

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

Run

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