Skip to content

Commit

Permalink
Check 'onnxruntime-gpu' if torch.has_cuda (ultralytics#5087)
Browse files Browse the repository at this point in the history
* Check `'onnxruntime-gpu' if torch.has_cuda`

* fix indent
  • Loading branch information
glenn-jocher committed Oct 13, 2021
1 parent 1384355 commit 2ad33cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def run(weights=ROOT / 'yolov5s.pt', # model.pt path(s)
# check_requirements(('opencv-python>=4.5.4',))
net = cv2.dnn.readNetFromONNX(w)
else:
check_requirements(('onnx', 'onnxruntime'))
check_requirements(('onnx', 'onnxruntime-gpu' if torch.has_cuda else 'onnxruntime'))
import onnxruntime
session = onnxruntime.InferenceSession(w, None)
else: # TensorFlow models
Expand Down

0 comments on commit 2ad33cc

Please sign in to comment.