Overslaan naar inhoud

Referentie voor ultralytics/models/rtdetr/model.py

Opmerking

Dit bestand is beschikbaar op https://github.com/ultralytics/ ultralytics/blob/main/ ultralytics/models/rtdetr/model .py. Als je een probleem ziet, help het dan oplossen door een Pull Request 🛠️ bij te dragen. Bedankt 🙏!



ultralytics.models.rtdetr.model.RTDETR

Basis: Model

Interface voor Baidu's RT-DETR model. Deze op Vision Transformer gebaseerde objectdetector levert realtime prestaties met hoge nauwkeurigheid. Het ondersteunt efficiënte hybride codering, IoU-bewuste vraagselectie en aanpasbare inferentiesnelheid.

Kenmerken:

Naam Type Beschrijving
model str

Pad naar het voorgetrainde model. Wordt standaard ingesteld op 'rtdetr-l.pt'.

Broncode 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

Geeft een takenmap terug voor RT-DETR, die taken koppelt aan de bijbehorende klassen van Ultralytics .

Retourneert:

Naam Type Beschrijving
dict dict

Een woordenboek waarin taaknamen worden toegewezen aan Ultralytics taakklassen voor het RT-DETR model.

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

Initialiseert het RT-DETR model met het gegeven voorgetrainde modelbestand. Ondersteunt .pt en .yaml formaten.

Parameters:

Naam Type Beschrijving Standaard
model str

Pad naar het voorgetrainde model. Wordt standaard ingesteld op 'rtdetr-l.pt'.

'rtdetr-l.pt'

Verhogingen:

Type Beschrijving
NotImplementedError

Als de extensie van het modelbestand niet 'pt', 'yaml' of 'yml' is.

Broncode 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")





Gemaakt 2023-11-12, Bijgewerkt 2024-05-08
Auteurs: Burhan-Q (1), glenn-jocher (3)