ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.67k stars 16.33k forks source link

How do i inference with tensorrt model using torch.hub.load? #7679

Closed wookidooki8 closed 2 years ago

wookidooki8 commented 2 years ago

Search before asking

Question

hey all. i’ve exported a pt file to an engine file for better inference speed !detect.py works perfectly with the trt but but get this error msg when trying with torch.hub.load command. can anyone tell me what im missing and what should i do :S? (i’d also appreciate it if you could give me an easy example to follow!)

#model = torch.hub.load('ultralytics/yolov5', 'yolov5s')  # or yolov5m, yolov5l, yolov5x, custom
model = torch.hub.load('./', 'custom', path='./best.engine', source='local')

# Images
img = 'https://ultralytics.com/images/zidane.jpg'  # or file, Path, PIL, OpenCV, numpy, list

# Inference
results = model(img)

# Results
results.print()  # or .show(), .save(), .crop(), .pandas(), etc.

heres the error message i get image

Additional

No response

glenn-jocher commented 2 years ago

@wookidooki8 good news 😃! Your code is out of date and has already been fixed ✅ in a past PR. To receive this update:

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

github-actions[bot] commented 2 years ago

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

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 YOLOv5 🚀 and Vision AI ⭐!