Skip to content

YoloWorld Model

sahi.models.yolo-world

YOLO-World detection model wrapper for SAHI.

Provides integration with Ultralytics YOLO-World open-vocabulary detection models.

Classes

YOLOWorldDetectionModel

Bases: UltralyticsDetectionModel

YOLO-World object detection model.

An open-vocabulary object detector that can detect custom classes at test-time.

Source code in sahi/models/yolo-world.py
class YOLOWorldDetectionModel(UltralyticsDetectionModel):
    """YOLO-World object detection model.

    An open-vocabulary object detector that can detect custom classes at test-time.
    """

    def load_model(self) -> None:
        """Detection model is initialized and set to self.model."""
        from ultralytics import YOLOWorld

        try:
            model_source = self.model_path or "yolov8s-worldv2.pt"
            model = YOLOWorld(model_source)
            model.to(self.device)
            self.set_model(model)
        except Exception as e:
            raise TypeError("model_path is not a valid yolo world model path: ", e)
Functions
load_model()

Detection model is initialized and set to self.model.

Source code in sahi/models/yolo-world.py
def load_model(self) -> None:
    """Detection model is initialized and set to self.model."""
    from ultralytics import YOLOWorld

    try:
        model_source = self.model_path or "yolov8s-worldv2.pt"
        model = YOLOWorld(model_source)
        model.to(self.device)
        self.set_model(model)
    except Exception as e:
        raise TypeError("model_path is not a valid yolo world model path: ", e)