-
-
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
additions and tests for torchscript inference (#5161) #5215
Conversation
Fixes out of bounds labels that seem to affect ~10% of images in dataset.
@andreiionutdamian thanks for the PR! This looks interesting, but I'm not sure embedding metadata in the filename is best practices. Is there a way to embed this metadata within the model itself? |
@dependabot rebase |
/rebase experiment after #5251 GH actions bump to 1.5 |
/rebase experiment after #5255 adding Organization secret ACTIONS_TOKEN |
True that. I added a small json |
@andreiionutdamian in the past we've seen user error on trying to load weights files with associated configuration files due to incorrect pairings, i.e. darknet YOLO that required weights and cfg files separately to load a model. Users invariably pair incorrect weight and cfg and then raise bug report on error. I think if we want to store additional metadata that we can not incorporate directly into the model then we should save a dictionary with model and metadata fields, similar to how we handle pytorch model saving now: Lines 371 to 382 in 692be75
I searched around online and also found the |
Hi @glenn-jocher, you are perfectly right, the less dependencies the better so now it is all within the jit graph file. |
@andreiionutdamian thanks for the updates! batch size variable is unused in detect.py, should we omit from config variables? |
@glenn-jocher frankly I would leave it there so you can use it if need be (if using a "graph" traced with batch size 1 doesn't allow forward with bigger batch size). In my tests I did not have this problem - all is restricted to H,W (as it should be) but I guess |
@glenn-jocher I eliminated batch size from config vars loading. |
@andreiionutdamian thanks for the updates! Can you merge master please by running the following code? /rebase action appears to not work. git remote add upstream https://github.com/ultralytics/yolov5.git
git fetch upstream
git checkout feature # <----- replace 'feature' with local branch name
git merge upstream/master
git push -u origin -f |
@andreiionutdamian since I've been unable to rebase this PR I've integrated your TorchScript updates into upcoming DetectMultiBackend PR #5549. Closing this PR, using #5549 as replacement. @andreiionutdamian thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐ |
@glenn-jocher thank you and I do hope I will continue to contribute. |
Support for torchscript inference added in
detect.py
. Alsoexport.py
received a minor modification: torchscript files are name-encoded based on device, batch, stride and resolution in order to restore and enforce same input while using indetect.py
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Refinement of TorchScript model loading and export processes in YOLOv5.
📊 Key Changes
🎯 Purpose & Impact