-
-
Notifications
You must be signed in to change notification settings - Fork 16.5k
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
detect.py fails without internet connection, always tries to load pre-trained model weights #2799
Comments
👋 Hello @r-blmnr, 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 [email protected]. 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. |
@r-blmnr hi, thanks for the feature request! Models are already only searched for online if they are not found locally in L23 below. This feature has been in place for several months. Please git pull or git clone to use the latest code. Lines 19 to 53 in aff03be
|
@glenn-jocher thanks for the quick reply. I have been using version 4.0.12 from PyPI, where line 25 from the code excerpt in your reply was still executed before checking whether the weight file exists. However, I just saw that this has been fixed in release 5.0.0 (issue #1890). While working on this I found another problem with my project structure: Upgrading to version 5.0.0 and converting directory names to lower case solved my issue. Thanks again. |
@r-blmnr ah! The .lower() must be the root cause of your issue. Can you submit a PR for it's removal please? |
done. |
First of all, thanks for this great piece of software!
Problem
Without internet connection, calling detect.py fails. It seems that even when a local copy of weights is available, the code still tries to load a set of weights from an online resource.
Commenting this line prevents the error and the code runs as expected:
yolov5/models/experimental.py
Line 117 in e5d7122
However, as I am using the yolov5 version from PyPI, which is dynamically installed into a virtual environment, commenting is not a long-term option.
Request
@glenn-jocher Would it be possible to include a switch, where the code only tries to load weights from an online resource if the weights are not found locally? This would also be in line with the comment at:
yolov5/utils/google_utils.py
Line 20 in e5d7122
Thanks in advance!
The text was updated successfully, but these errors were encountered: