Closed xscapex closed 2 years ago
👋 Hello @xscapex, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.
If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.
For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com.
Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.
@xscapex TRT export code is shown in notebook Appendix section. I just tested this right now and everything works correctly:
!pip install -U nvidia-tensorrt --index-url https://pypi.ngc.nvidia.com # install
!python export.py --weights yolov5s.pt --include engine --imgsz 640 640 --device 0 # export
!python detect.py --weights yolov5s.engine --imgsz 640 640 --device 0 # inference
I installed it again.And the problem disappeared I think it's probably because it's not installed.
@glenn-jocher
Thank you for the prompt reply. Because we're using Colab, our GPU might be different and sometimes the export might not work.
For someone who has the same problem on Colab, try this:
!nvidia-smi
If your GPU is Tesla k80, install nvidia-tensorrt with 8.0.3.4 version, then can successfully export the file.
!pip install nvidia-tensorrt==8.0.3.4 --index-url https://pypi.ngc.nvidia.com
Or just swift the GPU to Tesla T4, it also works for me.
Search before asking
Question
Hi ultralytics,
I'm trying to export a trained YOLOv5 model from PyTorch to TensorRT format by using YoloV5 tutorial .
I could successfully export to .onnx file but could not export to .engine file and got this error ' GPU error during getBestTactic: Conv_3 : an illegal memory access was encountered'.
I notice that nvidia-tensorrt have upadated these days, not sure if this is the problem. Do you have the recommended version of nvidia-tensorrt?
Code:
!git clone https://github.com/ultralytics/yolov5
%cd yolov5
%pip install -qr requirements.txt # install
import torch
from yolov5 import utils
display = utils.notebook_init() # checks
!pip install -U nvidia-tensorrt --index-url https://pypi.ngc.nvidia.com # install
!python export.py --weights yolov5s.pt --include engine --imgsz 640 640 --device 0 # export
logs:
Many thanks.
Additional
YOLOv5:V6 OS:Ubuntu 18.04 python:3.7.12 tensorrt: 8.2.3.0
colab link with logs: https://colab.research.google.com/drive/1kCxK0w95_rELdugtJuNtDg_0OxfYLMjS?usp=sharing