Skip to content

Is there a way to hide/suppress any console output when loading and inferencing via PyTorch Hub? #2862

@haimat

Description

@haimat

❔Question

I would like to use YOLOv5 in a custom project, so I need to be in control of what will be printed to the console. Currently I am loading the model and using it like described in your wiki:

model = torch.hub.load("ultralytics/yolov5", "custom", path_or_model=args.model)
model.conf = args.confidence
model.iou = args.iou
img = Image.open(args,image)
results = model(img, size=args.size, augment=True)
preds = results.pandas().xyxy[0]

However, these line result in some console output (like network layout, autoShape info, etc.)
Is there any way to hide all these standad console output?

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleStale and schedule for closing soonquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions