Skip to content

Commit

Permalink
Update hubconf.py to reset LOGGER.level after load (#8674)
Browse files Browse the repository at this point in the history
Resolves silent outputs after model load
  • Loading branch information
glenn-jocher committed Jul 22, 2022
1 parent 4c1784b commit 38721de
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hubconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
from utils.general import LOGGER, check_requirements, intersect_dicts, logging
from utils.torch_utils import select_device

level = LOGGER.level
if not verbose:
LOGGER.setLevel(logging.WARNING)
check_requirements(exclude=('tensorboard', 'thop', 'opencv-python'))
Expand All @@ -57,6 +58,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
model.names = ckpt['model'].names # set class names attribute
if autoshape:
model = AutoShape(model) # for file/URI/PIL/cv2/np inputs and NMS
LOGGER.setLevel(level)
return model.to(device)

except Exception as e:
Expand Down

0 comments on commit 38721de

Please sign in to comment.