跳至内容

参考资料 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

用于百度RT-DETR 模型的接口。这种基于视觉变换器的物体检测器具有实时性能 高精度。它支持高效的混合编码、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

返回RT-DETR 的任务映射,将任务与相应的Ultralytics 类关联起来。

返回:

名称 类型 说明
dict dict

将任务名称映射到Ultralytics 任务类别的字典,用于RT-DETR 模型。

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

使用给定的预训练模型文件初始化RT-DETR 模型。支持 .pt 和 .yaml 格式。

参数

名称 类型 说明 默认值
model str

预训练模型的路径。默认为 "rtdetr-l.pt"。

'rtdetr-l.pt'

加薪:

类型 说明
NotImplementedError

如果模型文件扩展名不是 "pt"、"yml "或 "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")





Created 2023-11-12, Updated 2024-06-02
Authors: glenn-jocher (5), Burhan-Q (1)