增加对yolov5 4.0的支持

pull/28/head
LYP 2021-02-02 17:06:25 +08:00
parent 62a205f741
commit 1475a96393
1 changed files with 4 additions and 1 deletions

View File

@ -134,7 +134,10 @@ def attempt_load(weights, map_location=None):
model = Ensemble()
for w in weights if isinstance(weights, list) else [weights]:
attempt_download(w)
model.append(torch.load(w, map_location=map_location)['model'].float().fuse().eval()) # load FP32 model
try:
model.append(torch.load(w, map_location=map_location)['model'].float().fuse().eval()) # load FP32 model
except Exception:
model.append(torch.load(w, map_location=map_location).float().fuse().eval()) # load FP32 model
# Compatibility updates
for m in model.modules():