update google_utils.py
parent
76ca367a01
commit
bd3e389130
|
@ -25,9 +25,14 @@ def attempt_download(weights):
|
||||||
if file in d:
|
if file in d:
|
||||||
r = gdrive_download(id=d[file], name=weights)
|
r = gdrive_download(id=d[file], name=weights)
|
||||||
|
|
||||||
|
if not (r == 0 and os.path.exists(weights) and os.path.getsize(weights) > 1E6): # weights exist and > 1MB
|
||||||
|
os.remove(weights) if os.path.exists(weights) else None # remove partial downloads
|
||||||
|
s = "curl -L -o %s 'https://storage.googleapis.com/ultralytics/yolov5/ckpt/%s'" % (weights, file)
|
||||||
|
r = os.system(s) # execute, capture return values
|
||||||
|
|
||||||
# Error check
|
# Error check
|
||||||
if not (r == 0 and os.path.exists(weights) and os.path.getsize(weights) > 1E6): # weights exist and > 1MB
|
if not (r == 0 and os.path.exists(weights) and os.path.getsize(weights) > 1E6): # weights exist and > 1MB
|
||||||
os.system('rm ' + weights) # remove partial downloads
|
os.remove(weights) if os.path.exists(weights) else None # remove partial downloads
|
||||||
raise Exception(msg)
|
raise Exception(msg)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue