Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use tensor rt in yolov5 detection #12973

Open
1 task done
tasyoooo opened this issue Apr 28, 2024 · 1 comment
Open
1 task done

How to use tensor rt in yolov5 detection #12973

tasyoooo opened this issue Apr 28, 2024 · 1 comment
Labels
question Further information is requested

Comments

@tasyoooo
Copy link

Search before asking

Question

I'm using local machine with gpu rtx3050. I would like to utilize my gpu during the detection process. I am using webcam as a soure and framework tensor rt

Additional

No response

@tasyoooo tasyoooo added the question Further information is requested label Apr 28, 2024
@glenn-jocher
Copy link
Member

Hello there! 👋

Great to hear you're leveraging YOLOv5 with TensorRT for improved performance on your RTX3050 GPU! Using TensorRT, you can significantly speed up inference time by optimizing neural network models.

Here's a general overview of the steps involved:

  1. Export YOLOv5 Model to ONNX: Convert your trained YOLOv5 model to ONNX format. You can do this with the export.py script in the YOLOv5 repository.
python export.py --weights yolov5s.pt --img 640 --batch 1 --device 0 --opset 12 --include onnx
  1. Convert ONNX Model to TensorRT Engine: Use the trtexec command or TensorRT Python API to convert the ONNX model to a TensorRT engine optimized for your GPU.
trtexec --onnx=yolov5s.onnx --saveEngine=yolov5s.engine
  1. Perform Inference with TensorRT: Finally, you can load the TensorRT engine and perform inference. You'll need to handle pre-processing of your webcam feed and post-processing of the detection outputs according to YOLOv5's requirements.

While the above steps provide a high-level overview, specific implementation details can vary. For further guidance, checking documentation and examples specific to TensorRT and YOLOv5 is recommended. Feel free to explore our official documentation for more insights: https://docs.ultralytics.com/yolov5/

Wishing you success in your project! If you have any more questions, feel free to ask. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants