YOLOv8、YOLOv7、YOLOv6、 YOLOX、 YOLOV5、YOLOv3
- YOLOv8
- YOLOv7
- YOLOv6
- YOLOX
- YOLOv5
- YOLOv3
- 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
Install via Python
pip install --upgrade setuptools pip --user
pip install nvidia-pyindex
pip install --upgrade nvidia-tensorrt
pip install pycuda
pip install cuda-python
Install via C++
Install && Download Weights
pip install ultralytics
from ultralytics import YOLO
model = YOLO("yolov8s.pt")
model.fuse()
model.info(verbose=False) # Print model information
model.export(format='onnx') # TODO:
python export.py -o yolov8n.onnx -e yolov8n.trt --end2end --v8 --fp32
python trt.py -e yolov8n.trt -i src/1.jpg -o yolov8n-1.jpg --end2end
Expand
!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
!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
!python export.py -o yolov5n.onnx -e yolov5n.trt
!python trt.py -e yolov5n.trt -i src/1.jpg -o yolov5n-1.jpg
!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
!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
!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
!wget https://github.com/meituan/YOLOv6/releases/download/0.1.0/yolov6s.onnx
!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
!python export.py -o yolov6s.onnx -e yolov6s.trt
!python trt.py -e yolov6s.trt -i src/1.jpg -o yolov6s-1.jpg
!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
!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
!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
support NMS plugin show in C++ Demo
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