-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
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
Still unable to detect with TorchScript model #5161
Comments
@iumyx2612 thanks for the bug report! You probably want to connect with @andreiionutdamian who knows more about torchscript inference than I do. |
@iumyx2612 there are quite a few issues. This particular issue and other similar ones (such as constants that are not saved in torchscript file) will be solved in a PR that I will submit however there are bigger show-stoppers I am trying to figure out such as #5070 . I will post updates asap. |
The proposed modifications should enable a minimal export of torchscript graph including "locked" (traced) input size and required stride for image resize (although due to the fact that HW are fixed the stride is not actually used). Be aware that inference batch-size should be the same as during tracing (exporting) if running on GPU (running on CPU allows variable batch size it seems) |
👋 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 ⭐! |
Before submitting a bug report, please be aware that your issue must be reproducible with all of the following,
otherwise it is non-actionable, and we can not help you:
git fetch && git status -uno
to check andgit pull
to update repoOn branch master
Your branch is up to date with 'origin/master'.
If this is a custom dataset/training question you must include your
train*.jpg
,val*.jpg
andresults.png
figures, or we can not help you. You can generate these with
utils.plot_results()
.🐛 Bug
Cannot run inference with TorchScript model
To Reproduce (REQUIRED)
I export your pretrained yolov5s.pt to yolov5s.torchscript.pt using
export.py
python3 export.py --weights="yolov5/weights/yolov5s.pt" --device=0 --optimize --include=torchscript
Then I run inference with yolov5s.torchscript.pt using
detect.py
python3 detect.py --weights="yolov5/weights/yolov5s.torchscript.pt" --source="Test/ok1.mp4" --conf-thres=0.82 --device=0 --view-img --nosave --classes=0
Output:
Expected behavior
Normal detection like yolov5s.pt
Environment
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: