Update hubconf.py to reset LOGGER.level after load (#8674)

Resolves silent outputs after model load
This commit is contained in:
Glenn Jocher 2022-07-22 11:54:31 +02:00 committed by GitHub
parent 4c1784bd15
commit 38721de7ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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'))
@ -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: