Skip to content

Commit

Permalink
Check 'onnxruntime-gpu' if torch.has_cuda (#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 authored Oct 13, 2021
1 parent 20a809d commit b754525
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 b754525

Please sign in to comment.