Skip to content

RTDETRModel

sahi.models.rtdetr

Classes

RTDetrDetectionModel

Bases: UltralyticsDetectionModel

Source code in sahi/models/rtdetr.py
class RTDetrDetectionModel(UltralyticsDetectionModel):
    def check_dependencies(self) -> None:
        check_requirements(["ultralytics"])

    def load_model(self):
        """
        Detection model is initialized and set to self.model.
        """

        from ultralytics import RTDETR

        try:
            model = RTDETR(self.model_path)
            model.to(self.device)

            self.set_model(model)
        except Exception as e:
            raise TypeError("model_path is not a valid rtdet model path: ", e)
Functions
load_model()

Detection model is initialized and set to self.model.

Source code in sahi/models/rtdetr.py
def load_model(self):
    """
    Detection model is initialized and set to self.model.
    """

    from ultralytics import RTDETR

    try:
        model = RTDETR(self.model_path)
        model.to(self.device)

        self.set_model(model)
    except Exception as e:
        raise TypeError("model_path is not a valid rtdet model path: ", e)

Functions