랭킹으로 돌아가기

Linaom1214/TensorRT-For-YOLO-Series

Python

tensorrt for yolo series (YOLOv11,YOLOv10,YOLOv9,YOLOv8,YOLOv7,YOLOv6,YOLOX,YOLOv5), nms plugin support

tensorrtyolov7yolov6yoloxyolov3yolov5yolov8yolov10yolov9yolo11yoloyolo12
스타 성장
스타
1.2k
포크
191
주간 성장
이슈
50
5001k
2022년 4월2023년 9월2025년 2월2026년 7월
아티팩트PyPIpip install tensorrt-for-yolo-series
README

YOLO Series TensorRT Python/C++

Support

YOLOv11, YOLOV12YOLOv10YOLOv9YOLOv8YOLOv7YOLOv6YOLOXYOLOV5YOLOv3

  • YOLOv12
  • YOLOv11
  • YOLOv10
  • YOLOv9
  • YOLOv8
  • YOLOv7
  • YOLOv6
  • YOLOX
  • YOLOv5
  • YOLOv3

Update

  • 2025.3.14 Support YOLOv12
  • 2024.11.24 Support YOLOv11, fix the bug causing YOLOv8 accuracy misalignment
  • 2024.6.16 Support YOLOv9, YOLOv10, changing the TensorRT version to 10.0
  • 2023.8.15 Support cuda-python
  • 2023.5.12 Update
  • 2023.1.7 support YOLOv8
  • 2022.11.29 fix some bug thanks @JiaPai12138
  • 2022.8.13 rename reop、 public new version、 C++ for end2end
  • 2022.8.11 nms plugin support ==> Now you can set --end2end flag while use export.py get a engine file
  • 2022.7.8 support YOLOv7
  • 2022.7.3 support TRT int8 post-training quantization

Prepare TRT Env

Install via Python

pip install tensorrt
pip install cuda-python

Install via C++

By Docker

YOLO12

Export ONNX

pip install ultralytics
from ultralytics import YOLO
model = YOLO("yolo12n.pt")
model.export(format='onnx')

Generate TRT File

python export.py  -o yolo112n.onnx -e yolo12n.trt --end2end --v8 -p fp32

Inference

python trt.py -e yolo12n.trt  -i src/1.jpg -o yolo12-1.jpg --end2end 

YOLO11

Export ONNX

pip install ultralytics
from ultralytics import YOLO
model = YOLO("yolo11n.pt")
model.export(format='onnx')

Generate TRT File

python export.py  -o yolo11n.onnx -e yolov11n.trt --end2end --v8 -p fp32

Inference

python trt.py -e yolov11n.trt  -i src/1.jpg -o yolov11-1.jpg --end2end 

YOLOv10

Generate TRT File

python export.py  -o yolov10n.onnx -e yolov10.trt --end2end --v10 -p fp32

Inference

python trt.py -e yolov10.trt  -i src/1.jpg -o yolov10-1.jpg --end2end 

YOLOv9

Generate TRT File

python export.py  -o yolov9-c.onnx -e yolov9.trt --end2end --v8 -p fp32

Inference

python trt.py -e yolov9.trt  -i src/1.jpg -o yolov9-1.jpg --end2end 

Python Demo

Expand
  1. YOLOv5
  2. YOLOx
  3. YOLOv6
  4. YOLOv7
  5. YOLOv8

YOLOv8

Install && Download Weights

pip install ultralytics

Export ONNX

from ultralytics import YOLO

model = YOLO("yolov8s.pt")
model.fuse()  
model.info(verbose=False)  # Print model information
model.export(format='onnx')  # TODO: 

Generate TRT File

python export.py -o yolov8n.onnx -e yolov8n.trt --end2end --v8 --fp32

Inference

python trt.py -e yolov8n.trt  -i src/1.jpg -o yolov8n-1.jpg --end2end 

YOLOv5

!git clone https://github.com/ultralytics/yolov5.git
!wget https://github.com/ultralytics/yolov5/releases/download/v6.1/yolov5n.pt
!python yolov5/export.py --weights yolov5n.pt --include onnx --simplify --inplace 

include NMS Plugin

!python export.py -o yolov5n.onnx -e yolov5n.trt --end2end
!python trt.py -e yolov5n.trt  -i src/1.jpg -o yolov5n-1.jpg --end2end 

exclude NMS Plugin

!python export.py -o yolov5n.onnx -e yolov5n.trt 
!python trt.py -e yolov5n.trt  -i src/1.jpg -o yolov5n-1.jpg 

YOLOX

!git clone https://github.com/Megvii-BaseDetection/YOLOX.git
!wget https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_s.pth
!cd YOLOX && pip3 install -v -e . --user
!cd YOLOX && python tools/export_onnx.py --output-name ../yolox_s.onnx -n yolox-s -c ../yolox_s.pth --decode_in_inference

include NMS Plugin

!python export.py -o yolox_s.onnx -e yolox_s.trt --end2end
!python trt.py -e yolox_s.trt  -i src/1.jpg -o yolox-1.jpg --end2end 

exclude NMS Plugin

!python export.py -o yolox_s.onnx -e yolox_s.trt 
!python trt.py -e yolox_s.trt  -i src/1.jpg -o yolox-1.jpg 

YOLOv6

!wget https://github.com/meituan/YOLOv6/releases/download/0.1.0/yolov6s.onnx

include NMS Plugin

!python export.py -o yolov6s.onnx -e yolov6s.trt --end2end
!python trt.py -e yolov6s.trt  -i src/1.jpg -o yolov6s-1.jpg --end2end

exclude NMS Plugin

!python export.py -o yolov6s.onnx -e yolov6s.trt 
!python trt.py -e yolov6s.trt  -i src/1.jpg -o yolov6s-1.jpg 

YOLOv7

!git clone https://github.com/WongKinYiu/yolov7.git
!wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-tiny.pt
!pip install -r yolov7/requirements.txt
!python yolov7/export.py --weights yolov7-tiny.pt --grid  --simplify

include NMS Plugin

!python export.py -o yolov7-tiny.onnx -e yolov7-tiny.trt --end2end
!python trt.py -e yolov7-tiny.trt  -i src/1.jpg -o yolov7-tiny-1.jpg --end2end

exclude NMS Plugin

!python export.py -o yolov7-tiny.onnx -e yolov7-tiny-norm.trt
!python trt.py -e yolov7-tiny-norm.trt  -i src/1.jpg -o yolov7-tiny-norm-1.jpg

C++ Demo

support NMS plugin show in C++ Demo

Citing

If you use this repo in your publication, please cite it by using the following BibTeX entry.

@Misc{yolotrt2022,
  author =       {Jian Lin},
  title =        {YOLOTRT: tensorrt for yolo series},
  howpublished = {\url{[https://github.com/Linaom1214/TensorRT-For-YOLO-Series]}},
  year =         {2022}
}

Buy me a cup of coffee

관련 저장소
ultralytics/yolov5

Ultralytics YOLOv5 in PyTorch for object detection, instance segmentation, classification, training, and export.

PythonPyPIGNU Affero General Public License v3.0yolov5object-detection
docs.ultralytics.com/yolov5/
57.7k17.5k
NVIDIA/TensorRT

NVIDIA® TensorRT™ is an SDK for high-performance deep learning inference on NVIDIA GPUs. This repository contains the open source components of TensorRT.

C++Apache License 2.0tensorrtnvidia
developer.nvidia.com/tensorrt
13.2k2.4k
ultralytics/yolov3

PyTorch implementation of YOLOv3, YOLOv3-SPP, and YOLOv3-tiny for real-time object detection with training, validation, inference, and multi-format export.

PythonPyPIGNU Affero General Public License v3.0yolov3object-detection
docs.ultralytics.com/models/yolov3/
10.6k3.4k
Megvii-BaseDetection/YOLOX

YOLOX is a high-performance anchor-free YOLO, exceeding yolov3~v5 with MegEngine, ONNX, TensorRT, ncnn, and OpenVINO supported. Documentation: https://yolox.readthedocs.io/

PythonPyPIApache License 2.0yoloxyolov3
10.5k2.5k
dusty-nv/jetson-inference

Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.

C++MIT Licensedeep-learninginference
developer.nvidia.com/embedded/twodaystoademo
8.9k3.1k
mikel-brostrom/boxmot

BoxMOT: Pluggable python and c++ SOTA multi-object tracking modules with support for axis-aligned and oriented bounding boxes

PythonPyPIGNU Affero General Public License v3.0strongsortbytetrack
mikel-brostrom.github.io/boxmot/
8.2k1.9k
wang-xinyu/tensorrtx

Implementation of popular deep learning networks with TensorRT network definition API

C++MIT Licensetensorrtmnasnet
7.8k1.9k
RapidAI/RapidOCR

📄 Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.

PythonPyPIApache License 2.0ocronnxruntime
rapidai.github.io/RapidOCRDocs
7.2k681
NVIDIA-AI-IOT/torch2trt

An easy to use PyTorch to TensorRT converter

PythonPyPIMIT Licensejetson-nanojetson-tx2
4.9k696
Tencent/TNN

TNN: developed by Tencent Youtu Lab and Guangying Lab, a uniform deep learning inference framework for mobile、desktop and server. TNN is distinguished by several outstanding features, including its cross-platform capability, high performance, model compression and code pruning. Based on ncnn and Rapidnet, TNN further strengthens the support and performance optimization for mobile devices, and also draws on the advantages of good extensibility and high performance from existed open source efforts. TNN has been deployed in multiple Apps from Tencent, such as Mobile QQ, Weishi, Pitu, etc. Contributions are welcome to work in collaborative with us and make TNN a better framework.

C++Otherdeep-learningmnn
4.6k772
TingsongYu/PyTorch-Tutorial-2nd

《Pytorch实用教程》(第二版)无论是零基础入门,还是CV、NLP、LLM项目应用,或是进阶工程化部署落地,在这里都有。相信在本书的帮助下,读者将能够轻松掌握 PyTorch 的使用,成为一名优秀的深度学习工程师。

Jupyter Notebookcomputer-visiondeepsort
tingsongyu.github.io/PyTorch-Tutorial-2nd/
4.6k486
OAID/Tengine

Tengine is a lite, high performance, modular inference engine for embedded device

C++Apache License 2.0armmachine-learning
4.5k980