MCPcopy
hub / github.com/WongKinYiu/PyTorch_YOLOv4 / attempt_load

Function attempt_load

utils/google_utils.py:39–52  ·  view source on GitHub ↗
(weights, map_location=None)

Source from the content-addressed store, hash-verified

37
38
39def attempt_load(weights, map_location=None):
40 # Loads an ensemble of models weights=[a,b,c] or a single model weights=[a] or weights=a
41 model = Ensemble()
42 for w in weights if isinstance(weights, list) else [weights]:
43 attempt_download(w)
44 model.append(torch.load(w, map_location=map_location)['model'].float().fuse().eval()) # load FP32 model
45
46 if len(model) == 1:
47 return model[-1] # return model
48 else:
49 print('Ensemble created with %s\n' % weights)
50 for k in ['names', 'stride']:
51 setattr(model, k, getattr(model[-1], k))
52 return model # return ensemble
53
54
55def gdrive_download(id='1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', name='coco128.zip'):

Callers

nothing calls this directly

Calls 3

EnsembleClass · 0.85
fuseMethod · 0.80
attempt_downloadFunction · 0.70

Tested by

no test coverage detected