Skip to content

Référence pour ultralytics/models/rtdetr/model.py

Note

Ce fichier est disponible à l'adresse https://github.com/ultralytics/ ultralytics/blob/main/ ultralytics/models/rtdetr/model .py. Si tu repères un problème, aide à le corriger en contribuant à une Pull Request 🛠️. Merci 🙏 !



ultralytics.models.rtdetr.model.RTDETR

Bases : Model

Interface pour le modèle RT-DETR de Baidu. Ce détecteur d'objets basé sur Vision Transformer offre une performance en temps réel avec une grande précision. Il prend en charge un codage hybride efficace, une sélection de requêtes tenant compte de l'expérience utilisateur et une vitesse d'inférence adaptable.

Attributs :

Nom Type Description
model str

Chemin d'accès au modèle pré-entraîné. La valeur par défaut est 'rtdetr-l.pt'.

Code source dans ultralytics/models/rtdetr/model.py
class RTDETR(Model):
    """
    Interface for Baidu's RT-DETR model. This Vision Transformer-based object detector provides real-time performance
    with high accuracy. It supports efficient hybrid encoding, IoU-aware query selection, and adaptable inference speed.

    Attributes:
        model (str): Path to the pre-trained model. Defaults to 'rtdetr-l.pt'.
    """

    def __init__(self, model="rtdetr-l.pt") -> None:
        """
        Initializes the RT-DETR model with the given pre-trained model file. Supports .pt and .yaml formats.

        Args:
            model (str): Path to the pre-trained model. Defaults to 'rtdetr-l.pt'.

        Raises:
            NotImplementedError: If the model file extension is not 'pt', 'yaml', or 'yml'.
        """
        super().__init__(model=model, task="detect")

    @property
    def task_map(self) -> dict:
        """
        Returns a task map for RT-DETR, associating tasks with corresponding Ultralytics classes.

        Returns:
            dict: A dictionary mapping task names to Ultralytics task classes for the RT-DETR model.
        """
        return {
            "detect": {
                "predictor": RTDETRPredictor,
                "validator": RTDETRValidator,
                "trainer": RTDETRTrainer,
                "model": RTDETRDetectionModel,
            }
        }

task_map: dict property

Renvoie une carte des tâches pour RT-DETR, en associant les tâches aux classes Ultralytics correspondantes.

Retourne :

Nom Type Description
dict dict

Un dictionnaire qui fait correspondre les noms des tâches aux classes de tâches de Ultralytics pour le modèle RT-DETR .

__init__(model='rtdetr-l.pt')

Initialise le modèle RT-DETR avec le fichier de modèle pré-entraîné donné. Prend en charge les formats .pt et .yaml.

Paramètres :

Nom Type Description DĂ©faut
model str

Chemin d'accès au modèle pré-entraîné. La valeur par défaut est 'rtdetr-l.pt'.

'rtdetr-l.pt'

Augmente :

Type Description
NotImplementedError

Si l'extension du fichier de modèle n'est pas 'pt', 'yaml' ou 'yml'.

Code source dans ultralytics/models/rtdetr/model.py
def __init__(self, model="rtdetr-l.pt") -> None:
    """
    Initializes the RT-DETR model with the given pre-trained model file. Supports .pt and .yaml formats.

    Args:
        model (str): Path to the pre-trained model. Defaults to 'rtdetr-l.pt'.

    Raises:
        NotImplementedError: If the model file extension is not 'pt', 'yaml', or 'yml'.
    """
    super().__init__(model=model, task="detect")





Créé le 2023-11-12, Mis à jour le 2024-05-08
Auteurs : Burhan-Q (1), glenn-jocher (3)