From be6bb2aca78ee00dd1675df27093061d06440502 Mon Sep 17 00:00:00 2001 From: Laughing <61612323+Laughing-q@users.noreply.github.com> Date: Mon, 6 May 2024 21:14:33 +0800 Subject: [PATCH] YOLO-World: Fix verbose (#11686) --- ultralytics/models/yolo/model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ultralytics/models/yolo/model.py b/ultralytics/models/yolo/model.py index 0b49d672..d54fedc9 100644 --- a/ultralytics/models/yolo/model.py +++ b/ultralytics/models/yolo/model.py @@ -15,7 +15,7 @@ class YOLO(Model): """Initialize YOLO model, switching to YOLOWorld if model filename contains '-world'.""" path = Path(model) if "-world" in path.stem and path.suffix in {".pt", ".yaml", ".yml"}: # if YOLOWorld PyTorch model - new_instance = YOLOWorld(path) + new_instance = YOLOWorld(path, verbose=verbose) self.__class__ = type(new_instance) self.__dict__ = new_instance.__dict__ else: @@ -62,14 +62,14 @@ class YOLO(Model): class YOLOWorld(Model): """YOLO-World object detection model.""" - def __init__(self, model="yolov8s-world.pt") -> None: + def __init__(self, model="yolov8s-world.pt", verbose=False) -> None: """ Initializes the YOLOv8-World model with the given pre-trained model file. Supports *.pt and *.yaml formats. Args: model (str | Path): Path to the pre-trained model. Defaults to 'yolov8s-world.pt'. """ - super().__init__(model=model, task="detect") + super().__init__(model=model, task="detect", verbose=verbose) # Assign default COCO class names when there are no custom names if not hasattr(self.model, "names"):