Skip to content

YoloWorld Model

sahi.models.yolo-world

Classes

YOLOWorldDetectionModel

Bases: UltralyticsDetectionModel

Source code in sahi/models/yolo-world.py
class YOLOWorldDetectionModel(UltralyticsDetectionModel):
    def load_model(self):
        """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):
    """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)