-
-
Notifications
You must be signed in to change notification settings - Fork 16.4k
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
Are pretrained models intended to be downlaoded into /home by torch.hub? #3889
Comments
👋 Hello @johnohagan, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com. RequirementsPython 3.8 or later with all requirements.txt dependencies installed, including $ pip install -r requirements.txt EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@johnohagan hmm that's an interesting idea. I'm not sure if people actually want to see these model.pt files or if they want them hidden away. But sure please submit a PR, thanks! See our Contributing Guide if you have questions on how to submit a PR. |
@johnohagan I think the path code you want is something like this, but you should also be aware that passing a path will download the model to that path also, which is a feature we need to retain: model = torch.hub.load('ultralytics/yolov5', 'custom', 'path/to/download/model.pt') so you probably want to check that name does not include any directories before assigning it to the cache directory with something like: name = Path(__file__).parent / name EDIT: Above comments mainly apply to |
@johnohagan FYI hubconf.py updated slightly in #3894 with unrelated changes today. |
Re issue ultralytics#3889, added code to download model.pt files into ~/.cache/torch/hub/ultralytics_yolov5_master/ instead of ~.
Thanks, I submitted that pull request. I should have made it clear that the line I added was to the _create function and modifies the "name" argument passed to that function. Since then I had a quick look at the where the pytorch/vision repo puts .pt(h) files, and it's ~/.cache/torch/hub/checkpoints. If that was considered better the line would be I've also just learbed from your comment that I don't need the ''.join for Path objects so I'll fix that either way. |
👋 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 ⭐! |
Hi
I'm a python user using pretrained object detection for an art project, so not a developer!
I was using cv2.dnn with yolov3 but recently switched to torch.hub with yolov5. I love how easy it is to use, eg model = torch.hub.load(...), model.conf = 0.5, results = model(image).xyxyn, etc, exactly how software should be!
Something I've noticed when calling torch.hub.load from the ultralytics repo for the first time is that the model zipfiles are downloaded into my home directory. Is this intentional? This is not a big deal obviously, but other torch.hub repos seem to put these in a directory in ~.cache/torch/hub along with the other required files, which seems neater to me.
I added this line to my hubconf.py that fixes this, but obviously it disappears if I call anything with force_reload:
name = ''.join((str(Path(file).parent), '/', name))
Should I submit this as a bug report / feature request?
Thanks
The text was updated successfully, but these errors were encountered: