ultralytics/yolov5

Run yolov5 using tensor rt

Opened this issue · 2 comments

Search before asking

Question

I exported Tensor RT weights (last.engine). When i use the weights in yolov5 detect it generates an error

File "detect.py", line 112, in run model = DetectMultiBackend(weights, device=device, dnn=dnn, data=data, fp16=half) File "C:\Users\shen\yolov5\models\common.py", line 426, in __init__ with open(w, "rb") as f, trt.Runtime(logger) as runtime: TypeError: pybind11::init(): factory function returned nullptr

Additional

No response

Hello! 😊 It looks like you're encountering an issue with deploying a TensorRT model in YOLOv5. This error often indicates a problem initializing the TensorRT engine from the .engine file. Here are a few suggestions that might help:

  1. Ensure the TensorRT engine was correctly built for your specific platform and GPU. Engines are not portable across different GPU architectures or TensorRT versions.
  2. Verify that your environment has the necessary dependencies for TensorRT inference, including the correct version of TensorRT installed.
  3. Check if the path to the .engine file in your detect.py invocation is correct and accessible.

If the issue persists, consider re-exporting your model to the TensorRT engine format, confirming each step's success. For guidance on model conversion and deployment using TensorRT with YOLOv5, our documentation can offer further insights: https://docs.ultralytics.com/yolov5/.

Feel free to share more details if you're still facing challenges. Good luck!

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO 🚀 and Vision AI ⭐