์ฝ˜ํ…์ธ ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

์ฐธ์กฐ ultralytics/models/rtdetr/model.py

์ฐธ๊ณ 

์ด ํŒŒ์ผ์€ https://github.com/ultralytics/ ultralytics/blob/main/ ultralytics/models/rtdetr/model .py์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฌธ์ œ๋ฅผ ๋ฐœ๊ฒฌํ•˜๋ฉด ํ’€ ๋ฆฌํ€˜์ŠคํŠธ (๐Ÿ› ๏ธ)๋ฅผ ์ œ์ถœํ•˜์—ฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋„๋ก ๋„์™€์ฃผ์„ธ์š”. ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค ๐Ÿ™!



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'.
        """
        if model and model.split(".")[-1] not in ("pt", "yaml", "yml"):
            raise NotImplementedError("RT-DETR only supports creating from *.pt, *.yaml, or *.yml files.")
        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

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'.
    """
    if model and model.split(".")[-1] not in ("pt", "yaml", "yml"):
        raise NotImplementedError("RT-DETR only supports creating from *.pt, *.yaml, or *.yml files.")
    super().__init__(model=model, task="detect")





์ƒ์„ฑ๋จ 2023-11-12, ์—…๋ฐ์ดํŠธ๋จ 2023-11-25
์ž‘์„ฑ์ž: glenn-jocher (3)