Skip to content

Commit

Permalink
better exception handling for hublike loading (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcakyon authored Oct 27, 2022
1 parent 3abe7cf commit d943925
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions yolov5/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ def load_model(model_path, device=None, autoshape=True, verbose=False):
LOGGER.warning('WARNING ⚠️ YOLOv5 SegmentationModel is not yet AutoShape compatible. '
'You will not be able to run inference with this model.')
else:
model = AutoShape(model) # for file/URI/PIL/cv2/np inputs and NMS
except Exception:
try:
model = AutoShape(model) # for file/URI/PIL/cv2/np inputs and NMS
except Exception as e:
LOGGER.warning(f'WARNING ⚠️ autoshape failed: {e}')
except Exception as e:
LOGGER.warning(f'WARNING ⚠️ DetectMultiBackend failed: {e}')
model = attempt_load(model_path, device=device, fuse=False) # arbitrary model

if not verbose:
Expand Down

0 comments on commit d943925

Please sign in to comment.