Easier and faster YOLO-series inference deployment for NVIDIA devices.
Integrates TensorRT plugins, CUDA kernels, and CUDA Graph, supports C++ / Python, and uses a single predict() call for preprocessing, inference, and post-processing.
Benchmark Β· Key advantages Β· Use cases Β· Architecture Β· Quick start Β· Ecosystem Β· Editions
Important
This repository is Community Edition 6.4, licensed under GPL-3.0. The Community inference API is frozen and will not receive a new runtime architecture.
Professional Edition will be released separately, and its source is not included here. Purchasing is not open yet; see Community vs Professional Edition.
End-to-end single-frame latency (preprocessing + inference + postprocessing) for the same YOLO11n Detect weights, FP16, batch 1, 640Γ640, measured on one machine with one process per scheme. Every path runs a TensorRT engine, including Ultralytics via the official format="engine" export (not .pt). Every number is generated by the scripts in benchmarks/ and traces to benchmarks/throughput-summary.json.
| Scheme | Version / commit | Mean latency (ms) | Mean QPS | SD (ms) | QPS vs baseline |
|---|---|---|---|---|---|
| Ultralytics (TensorRT engine) | 8.4.220 | 1.95 | 513.6 | 0.057 | baseline |
| TensorRT-Alpha | v2.0 f7e92a5 | 1.91 | 526.6 | 0.129 | +2.5% |
| TensorRT-YOLO Community | 6.4 a011c1b5 | 1.07 | 939.5 | 0.027 | +82.9% |
| TensorRT-YOLO Professional (dual-frame) | d4f3e97 | 0.90 | 1108.7 | 0.015 | +115.9% |
- Setup: NVIDIA GeForce RTX 3080, 10240 MiB, SM 8.6; CUDA 12.6.20; TensorRT 10.3.0; Linux container; SM 1965 MHz (not locked); YOLO11n Detect, FP16, batch 1, 640Γ640.
- Protocol: 100-frame warmup, then 5 rounds Γ 1000 frames per scheme, one fresh process per round; final value is the mean of the 5 round means, SD across round means.
- Scope: end-to-end single-frame latency = preprocessing + inference + postprocessing; image decoding and result rendering excluded; every scheme uses TensorRT engine inference (not PyTorch
.pt); Community and Professional use CUDA Graph. Timing boundaries differ slightly between the C++ and Python harnesses. Capability and licensing differences are in Community vs Professional Edition. - Reproducible scripts, fixed inputs and raw results:
benchmarks/. Results vary with hardware, driver and software versions.
The optimization target is the complete path from image input to result output, not just the engine.
- GPU pre- and post-processing: CUDA kernels handle LetterBox, SwapRB, and normalization; Detect / Pose / Segment / OBB use dedicated TensorRT plugins.
- CUDA Graph: reduces kernel-launch overhead for stable input shapes.
- One core, two interfaces: the single-header C++ API and pybind11 Python bindings share the same C++ / CUDA implementation.
- Concurrency and edge: use
clone()for independent contexts over a shared engine (with additional GPU memory usage), with Jetson Zero Copy and built-in throughput, CPU / GPU latency profiling.
- Python applications: feed NumPy / OpenCV images and receive
supervisionresults directly. - C++ services: embed the single-header API with explicit resource lifecycles.
- Video analytics: integrate VideoPipe for detection, tracking, and alerting pipelines.
- Concurrent and edge inference: share an engine across threads, or deploy on Jetson and other ARM devices.
The call path is: image input β CUDA preprocessing β TensorRT inference and plugin post-processing β C++ structs / supervision results.
Python and C++ share the same native core, keeping task behavior, preprocessing, and result structures consistent.
Build the library, export a model, and run your first inference.
1. Build TensorRT-YOLO
Requirements: CUDA β₯ 11.0.1, TensorRT β₯ 8.6.1, a C++17 compiler, and CMake β₯ 3.18. This guide builds the Python bindings and requires Python β₯ 3.8; use BUILD_PYTHON=OFF for a C++-only build.
git clone https://github.com/laugh12321/TensorRT-YOLO.git
cd TensorRT-YOLO
pip install "pybind11[global]"
cmake -S . -B build ^
-D TRT_PATH=/your/tensorrt/dir ^
-D BUILD_PYTHON=ON ^
-D CMAKE_INSTALL_PREFIX=/your/tensorrt-yolo/install/dir
cmake --build build --config Release --parallel --target installOn Linux, replace ^ with \. After building with BUILD_PYTHON=ON, build and install the Python wheel:
pip install --upgrade build
python -m build --wheel
pip install dist/trtyolo-*-py3-none-any.whlAdd the installation prefix to CMAKE_PREFIX_PATH, or add the Windows bin directory to PATH.
2. Export ONNX and build a TensorRT engine
Export ONNX with Ultralytics, then use trtyolo-export to adapt the outputs and integrate the required plugins:
yolo export model=yolo11n.pt format=onnx batch=1
trtyolo-export -i yolo11n.onnx -o yolo11n-trtyolo.onnx -s
trtexec --onnx=yolo11n-trtyolo.onnx --saveEngine=yolo11n.engine --fp16Pose / Segment / OBB engines require custom_plugins; see the corresponding task examples for full commands.
3. Python inference
import cv2
from trtyolo import TRTYOLO
model = TRTYOLO("yolo11n.engine", task="detect", device=0)
image = cv2.imread("path/to/image.jpg")
result = model.predict(image)
print(result)task must match the exported task. For profiling, initialize with profile=True and call model.profile().
C++ inference
#include <iostream>
#include <memory>
#include <opencv2/opencv.hpp>
#include "trtyolo.hpp"
int main() {
trtyolo::InferOption option;
option.enableSwapRB();
auto detector = std::make_unique<trtyolo::DetectModel>(
"yolo11n.engine", option);
cv::Mat image = cv2::imread("path/to/image.jpg");
trtyolo::Image input(image.data, image.cols, image.rows);
trtyolo::DetectRes result = detector->predict(input);
std::cout << result << '\n';
return 0;
}Use ClassifyModel, SegmentModel, PoseModel, and OBBModel for classification, segmentation, pose, and oriented object detection.
Supports YOLOv3 through YOLO26, plus YOLO-World, YOLOE, YOLO-Master, and other variants. See the trtyolo-export model support list for the authoritative model and export matrix.
| Integration | Purpose |
|---|---|
| trtyolo-export | ONNX output adaptation and plugin builds |
| Detect / Segment / Classify | Detection, segmentation, and classification examples |
| Pose / OBB | Pose and oriented object detection examples |
| Multithreading / multiprocessing | Concurrent inference examples |
| VideoPipe | Video analytics pipelines |
| nndeploy | Inference workflow integration |
| Dockerfile | Containerized deployment |
Community Edition 6.4 is free and open source, focused on stable synchronous inference. Professional Edition rewrites the execution path with configurable pipelines, multi-model Ensemble, and multiple sessions; its source is not public. The Detect comparison against open-source paths is in Benchmark; the table below adds Community β Professional tier detail for Detect / Segment (same setup as Benchmark).
| Task | Community (sync) | Professional (sync) | Professional (dual-frame) | Gain |
|---|---|---|---|---|
| Detect | 939.5 qps (1.0651 ms) | 1037.8 qps (0.9637 ms) | 1108.7 qps (0.9022 ms) | +18.0% |
| Segment | 261.9 qps (3.8186 ms) | 308.7 qps (3.2398 ms) | 318.3 qps (3.1418 ms) | +21.5% |
| Capability | Community 6.4 | Professional |
|---|---|---|
| Execution | Synchronous predict() |
submit / dequeue with configurable pipeline depth |
| Multi-model Ensemble | Not supported | Multiple models with shared preprocessing |
| Multiple sessions | Create instances with clone() |
Open sessions directly on a loaded model |
| TensorRT | β₯ 8.6.1 | β₯ 10 |
| Source and license | Public source, GPL-3.0 | Closed source, separately licensed |
Professional purchasing is not open yet. See the Professional page for full details.