Skip to content

RF-DETR ONNX

RF-DETR detection demo

RF-DETR ONNX is a modular, production-ready library for running RF-DETR object detection and instance segmentation with ONNX Runtime — in both Python and C++.

Developed as a fork of PierreMarieCurie/rf-detr-onnx, it adds a modular architecture, manual device selection, performance metrics, and a high-performance C++ library.


Features

  • Python & C++ implementations — from prototyping to production
  • Automatic provider selection — TensorRT → CUDA → CPU fallback
  • 📊 Detailed timing breakdown — preprocess, inference, postprocess
  • 🔧 Optimized C++ implementation — high-performance library for production deployment
  • 🎯 Instance segmentation — supports models with mask outputs
  • 🏎️ FP16 & mixed-precision support — convert models to float16 for ~2× GPU speedup and half the memory footprint
  • 📦 Modular library — install as a static C++ library or Python package

Quick Start

git clone https://github.com/imessam/rf-detr-onnx.git
cd rf-detr-onnx
uv sync
uv run python python/inference.py \
    --model models/rf-detr-nano/rf-detr-nano.sim.onnx \
    --image assets/drone.jpg \
    --device cpu

See Getting Started → Quick Start for more usage examples.


Demo Results

Original Image Torch Reference ONNX Inference
Original Reference ONNX Result

Project Layout

rf-detr-onnx/
├── python/             # Python library and CLI
│   ├── inference.py    # CLI demo script
│   └── modules/        # RFDETRModel, OnnxRuntimeSession, utils
├── cpp/                # C++ library
│   ├── include/        # Header files
│   ├── src/            # Source files
│   └── CMakeLists.txt  # Build system
├── benchmarks/         # Automated benchmarking suite
├── tools/              # Export and model conversion scripts
├── tests/              # Accuracy validation pipeline
└── assets/             # Demo images