Vai al contenuto

Riferimento per ultralytics/models/rtdetr/model.py

Nota

Questo file è disponibile su https://github.com/ultralytics/ ultralytics/blob/main/ ultralytics/models/rtdetr/model .py. Se riscontri un problema, contribuisci a risolverlo inviando una Pull Request 🛠️. Grazie 🙏!



ultralytics.models.rtdetr.model.RTDETR

Basi: Model

Interfaccia per il modello RT-DETR di Baidu. Questo rilevatore di oggetti basato su Vision Transformer offre prestazioni in tempo reale con un'elevata precisione. Supporta una codifica ibrida efficiente, una selezione delle query consapevole dell'IoU e una velocità di inferenza adattabile.

Attributi:

Nome Tipo Descrizione
model str

Percorso del modello pre-addestrato. Il valore predefinito è 'rtdetr-l.pt'.

Codice sorgente in 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

Restituisce una mappa dei compiti per RT-DETR, associando i compiti alle classi corrispondenti di Ultralytics .

Restituzione:

Nome Tipo Descrizione
dict dict

Un dizionario che mappa i nomi dei compiti alle classi di compiti di Ultralytics per il modello RT-DETR .

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

Inizializza il modello RT-DETR con il file del modello pre-addestrato indicato. Supporta i formati .pt e .yaml.

Parametri:

Nome Tipo Descrizione Predefinito
model str

Percorso del modello pre-addestrato. Il valore predefinito è 'rtdetr-l.pt'.

'rtdetr-l.pt'

Aumenta:

Tipo Descrizione
NotImplementedError

Se l'estensione del file del modello non è 'pt', 'yaml' o 'yml'.

Codice sorgente in 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")





Creato 2023-11-12, Aggiornato 2024-05-08
Autori: Burhan-Q (1), glenn-jocher (3)