# YOLO Series TensorRT Python/C++
## [简体中文](README_CN.md)
## Support
[YOLOv8](https://v8docs.ultralytics.com/)、[YOLOv7](https://github.com/WongKinYiu/yolov7)、[YOLOv6](https://github.com/meituan/YOLOv6)、 [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX)、 [YOLOV5](https://github.com/ultralytics/yolov5)、[YOLOv3](https://github.com/ultralytics/yolov3)
- [x] YOLOv8
- [x] YOLOv7
- [x] YOLOv6
- [x] YOLOX
- [x] YOLOv5
- [x] YOLOv3
## Update
- 2023.8.15 Support [cuda-python](https://github.com/Linaom1214/TensorRT-For-YOLO-Series/tree/cuda-python)
- 2023.5.12 Update
- 2023.1.7 support YOLOv8
- 2022.11.29 fix some bug thanks @[JiaPai12138](https://github.com/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 --upgrade setuptools pip --user
pip install nvidia-pyindex
pip install --upgrade nvidia-tensorrt
pip install pycuda
pip install cuda-python
```
`Install via C++`
[By Docker](https://github.com/NVIDIA/TensorRT/blob/main/docker/ubuntu-20.04.Dockerfile)
## Try YOLOv8
### Install && Download [Weights](https://github.com/ultralytics/assets/)
```shell
pip install ultralytics
```
### Export ONNX
```Python
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
```shell
python export.py -o yolov8n.onnx -e yolov8n.trt --end2end --v8 --fp32
```
### Inference
```shell
python trt.py -e yolov8n.trt -i src/1.jpg -o yolov8n-1.jpg --end2end
```
## Python Demo
<details><summary> <b>Expand</b> </summary>
1. [YOLOv5](#YOLOv5)
2. [YOLOx](#YOLOX)
3. [YOLOv6](#YOLOv6)
4. [YOLOv7](#YOLOv7)
## YOLOv5 <span id="YOLOv5"><span>
```python
!git clone https://github.com/ultralytics/yolov5.git
```
```python
!wget https://github.com/ultralytics/yolov5/releases/download/v6.1/yolov5n.pt
```
```python
!python yolov5/export.py --weights yolov5n.pt --include onnx --simplify --inplace
```
### include NMS Plugin
```python
!python export.py -o yolov5n.onnx -e yolov5n.trt --end2end
```
```python
!python trt.py -e yolov5n.trt -i src/1.jpg -o yolov5n-1.jpg --end2end
```
### exclude NMS Plugin
```python
!python export.py -o yolov5n.onnx -e yolov5n.trt
```
```python
!python trt.py -e yolov5n.trt -i src/1.jpg -o yolov5n-1.jpg
```
## YOLOX <span id="YOLOX"><span>
```python
!git clone https://github.com/Megvii-BaseDetection/YOLOX.git
```
```python
!wget https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_s.pth
```
```python
!cd YOLOX && pip3 install -v -e . --user
```
```python
!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
!python export.py -o yolox_s.onnx -e yolox_s.trt --end2end
```
```python
!python trt.py -e yolox_s.trt -i src/1.jpg -o yolox-1.jpg --end2end
```
### exclude NMS Plugin
```python
!python export.py -o yolox_s.onnx -e yolox_s.trt
```
```python
!python trt.py -e yolox_s.trt -i src/1.jpg -o yolox-1.jpg
```
## YOLOv6 <span id="YOLOv6"><span>
```python
!wget https://github.com/meituan/YOLOv6/releases/download/0.1.0/yolov6s.onnx
```
### include NMS Plugin
```python
!python export.py -o yolov6s.onnx -e yolov6s.trt --end2end
```
```python
!python trt.py -e yolov6s.trt -i src/1.jpg -o yolov6s-1.jpg --end2end
```
### exclude NMS Plugin
```python
!python export.py -o yolov6s.onnx -e yolov6s.trt
```
```python
!python trt.py -e yolov6s.trt -i src/1.jpg -o yolov6s-1.jpg
```
## YOLOv7 <span id="YOLOv7"><span>
```python
!git clone https://github.com/WongKinYiu/yolov7.git
```
```python
!wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-tiny.pt
```
```python
!pip install -r yolov7/requirements.txt
```
```python
!python yolov7/export.py --weights yolov7-tiny.pt --grid --simplify
```
### include NMS Plugin
```python
!python export.py -o yolov7-tiny.onnx -e yolov7-tiny.trt --end2end
```
```python
!python trt.py -e yolov7-tiny.trt -i src/1.jpg -o yolov7-tiny-1.jpg --end2end
```
### exclude NMS Plugin
```python
!python export.py -o yolov7-tiny.onnx -e yolov7-tiny-norm.trt
```
```python
!python trt.py -e yolov7-tiny-norm.trt -i src/1.jpg -o yolov7-tiny-norm-1.jpg
```
</details>
## C++ Demo
support **NMS plugin**
show in [C++ Demo](cpp/README.MD)
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
TensorRT部署YOLO_YOLOv8_YOLOv7_v6_x_v5_v3_超全YOLO部署全家桶_优质项目源码.zip (19个子文件)
TensorRT部署YOLO_YOLOv8_YOLOv7_v6_x_v5_v3_超全YOLO部署全家桶_优质项目源码
src
2.jpg 20KB
Sponsor.png 91KB
1.jpg 113KB
video1.mp4 76MB
2.jpeg 10KB
3.jpg 112KB
export.py 15KB
utils
utils.py 11KB
__init__.py 0B
image_batch.py 8KB
cpp
norm
CMakeLists.txt 957B
yolo.hpp 16KB
logging.h 16KB
main.cpp 573B
README.MD 1KB
end2end
CMakeLists.txt 992B
main.cpp 10KB
trt.py 1KB
README.md 5KB
共 19 条
- 1
资源评论
__AtYou__
- 粉丝: 3512
- 资源: 2175
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功