-
-
Notifications
You must be signed in to change notification settings - Fork 17.1k
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Search before asking
- I have searched the YOLOv5 issues and discussions and found no similar questions.
Question
Goody day all!
I am working on a project using YOLOv5 to detect objects. In this project, I would like the console output to have a specific format and be clean. However, when loading a YOLOv5 model with torch.hub.load, it outputs this to the console:
YOLOv5 2024-7-31 Python-3.11.9 torch-2.3.1+cpu CPU
Fusing layers...
Model summary: 157 layers, 1788931 parameters, 0 gradients, 4.2 GFLOPs
Adding AutoShape...
Ive been searching for a way to suppress this output to replace with my own, but I cant seem to find a way that works.
I came across this issue: #2862, which hinted at 3 solutions:
logging.getLogger("utils.general").setLevel(logging.WARNING)
logging.getLogger("yolov5").setLevel(logging.WARNING)
torch.hub.load(verbose=False)
None of these solutions worked for me, I also saw this online:
class SuppressPrint:
def __enter__(self):
self._original_stdout = sys.stdout
sys.stdout = open(os.devnull, 'w')
def __exit__(self, exc_type, exc_val, exc_tb):
sys.stdout.close()
sys.stdout = self._original_stdout
with SuppressPrint():
torch.hub.load()
However, this had no effect either.
If anyone had ideas as to how I could go about solving this, it would be appreciated!
Thanks!
- DylDev
Additional
No response
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested