glenn-jocher commited on
Commit
bd3e389
1 Parent(s): 76ca367

update google_utils.py

Browse files
Files changed (1) hide show
  1. utils/google_utils.py +8 -3
utils/google_utils.py CHANGED
@@ -25,10 +25,15 @@ def attempt_download(weights):
25
  if file in d:
26
  r = gdrive_download(id=d[file], name=weights)
27
 
28
- # Error check
29
  if not (r == 0 and os.path.exists(weights) and os.path.getsize(weights) > 1E6): # weights exist and > 1MB
30
- os.system('rm ' + weights) # remove partial downloads
31
- raise Exception(msg)
 
 
 
 
 
 
32
 
33
 
34
  def gdrive_download(id='1HaXkef9z6y5l4vUnCYgdmEAj61c6bfWO', name='coco.zip'):
 
25
  if file in d:
26
  r = gdrive_download(id=d[file], name=weights)
27
 
 
28
  if not (r == 0 and os.path.exists(weights) and os.path.getsize(weights) > 1E6): # weights exist and > 1MB
29
+ os.remove(weights) if os.path.exists(weights) else None # remove partial downloads
30
+ s = "curl -L -o %s 'https://storage.googleapis.com/ultralytics/yolov5/ckpt/%s'" % (weights, file)
31
+ r = os.system(s) # execute, capture return values
32
+
33
+ # Error check
34
+ if not (r == 0 and os.path.exists(weights) and os.path.getsize(weights) > 1E6): # weights exist and > 1MB
35
+ os.remove(weights) if os.path.exists(weights) else None # remove partial downloads
36
+ raise Exception(msg)
37
 
38
 
39
  def gdrive_download(id='1HaXkef9z6y5l4vUnCYgdmEAj61c6bfWO', name='coco.zip'):