コンテンツへスキップ

参考 ultralytics/models/rtdetr/model.py

このファイルはhttps://github.com/ultralytics/ultralytics/blob/main/ ultralytics/models/rtdetr/model .py にあります。もし問題を発見したら、Pull Request🛠️ を投稿して修正にご協力ください。ありがとうございました!



ultralytics.models.rtdetr.model.RTDETR

ベース: Model

BaiduのRT-DETR モデル用インターフェース。このVision Transformerベースの物体検出器は、高精度のリアルタイム性能を提供します。 を提供する。効率的なハイブリッドエンコーディング、IoUを意識したクエリ選択、適応可能な推論速度をサポートする。

属性:

名称 タイプ 説明
model str

訓練済みモデルへのパス。デフォルトは 'rtdetr-l.pt' です。

ソースコード 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

タスクと対応するUltralytics クラスを関連付けた、RT-DETR のタスクマップを返します。

リターンズ

名称 タイプ 説明
dict dict

タスク名をRT-DETR モデルのUltralytics タスククラスにマッピングする辞書。

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

与えられた訓練済みモデルファイルでRT-DETR モデルを初期化します。.pt と .yaml 形式をサポートします。

パラメーター

名称 タイプ 説明 デフォルト
model str

訓練済みモデルへのパス。デフォルトは 'rtdetr-l.pt' です。

'rtdetr-l.pt'

レイズ

タイプ 説明
NotImplementedError

モデルファイルの拡張子が'pt'、'yaml'、'yml'でない場合。

ソースコード 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")





作成 2023-11-12 更新 2024-05-08
著者Burhan-Q(1),glenn-jocher(3)