Browse Source

Remove redundant downloads mirror (#1461)

5.0
Glenn Jocher GitHub 4 years ago
parent
commit
a70e554fc3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions
  1. +1
    -1
      test.py
  2. +1
    -1
      utils/autoanchor.py
  3. +2
    -0
      utils/google_utils.py

+ 1
- 1
test.py View File

y.append(r + t) # results and times y.append(r + t) # results and times
np.savetxt(f, y, fmt='%10.4g') # save np.savetxt(f, y, fmt='%10.4g') # save
os.system('zip -r study.zip study_*.txt') os.system('zip -r study.zip study_*.txt')
# utils.general.plot_study_txt(f, x) # plot
# utils.plots.plot_study_txt(f, x) # plot

+ 1
- 1
utils/autoanchor.py View File

k: kmeans evolved anchors k: kmeans evolved anchors


Usage: Usage:
from utils.general import *; _ = kmean_anchors()
from utils.autoanchor import *; _ = kmean_anchors()
""" """
thr = 1. / thr thr = 1. / thr



+ 2
- 0
utils/google_utils.py View File



msg = weights + ' missing, try downloading from https://github.com/ultralytics/yolov5/releases/' msg = weights + ' missing, try downloading from https://github.com/ultralytics/yolov5/releases/'
models = ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt'] # available models models = ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt'] # available models
redundant = False # offer second download option


if file in models and not os.path.isfile(weights): if file in models and not os.path.isfile(weights):
# Google Drive # Google Drive
assert os.path.exists(weights) and os.path.getsize(weights) > 1E6 # check assert os.path.exists(weights) and os.path.getsize(weights) > 1E6 # check
except Exception as e: # GCP except Exception as e: # GCP
print('Download error: %s' % e) print('Download error: %s' % e)
assert redundant, 'No secondary mirror'
url = 'https://storage.googleapis.com/ultralytics/yolov5/ckpt/' + file url = 'https://storage.googleapis.com/ultralytics/yolov5/ckpt/' + file
print('Downloading %s to %s...' % (url, weights)) print('Downloading %s to %s...' % (url, weights))
r = os.system('curl -L %s -o %s' % (url, weights)) # torch.hub.download_url_to_file(url, weights) r = os.system('curl -L %s -o %s' % (url, weights)) # torch.hub.download_url_to_file(url, weights)

Loading…
Cancel
Save