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

์„ค๋ช…: Ultralytics YOLO OBB ํŠธ๋ ˆ์ด๋„ˆ๋ฅผ ๋งˆ์Šคํ„ฐํ•˜์„ธ์š”: ์˜ค๋ฆฌ์—”ํ‹ฐ๋“œ ๋ฐ”์šด๋”ฉ ๋ฐ•์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ YOLO ๋ชจ๋ธ์„ ํ›ˆ๋ จํ•˜๊ธฐ ์œ„ํ•œ ์ „๋ฌธ ๋„๊ตฌ์ž…๋‹ˆ๋‹ค. ์ž์„ธํ•œ ์‚ฌ์šฉ๋ฒ•, ๋ชจ๋ธ ์ดˆ๊ธฐํ™” ๋ฐ ํ›ˆ๋ จ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ํ‚ค์›Œ๋“œ Ultralytics, YOLO OBB ํŠธ๋ ˆ์ด๋„ˆ, ์˜ค๋ฆฌ์—”ํ‹ฐ๋“œ ๋ฐ”์šด๋”ฉ ๋ฐ•์Šค, OBB ๋ชจ๋ธ ํ›ˆ๋ จ, YOLO ๋ชจ๋ธ ํ›ˆ๋ จ, ์ปดํ“จํ„ฐ ๋น„์ „, ๋”ฅ๋Ÿฌ๋‹, ๋จธ์‹ ๋Ÿฌ๋‹, YOLO ๊ฐ์ฒด ๊ฐ์ง€, ๋ชจ๋ธ ์ดˆ๊ธฐํ™”, YOLO ํ›ˆ๋ จ ํ”„๋กœ์„ธ์Šค


์ฐธ์กฐ ultralytics/models/yolo/obb/train.py

์ฐธ๊ณ 

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



ultralytics.models.yolo.obb.train.OBBTrainer

๊ธฐ์ง€: DetectionTrainer

OBB(Oriented Bounding Box) ๋ชจ๋ธ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ›ˆ๋ จํ•˜๊ธฐ ์œ„ํ•ด DetectionTrainer ํด๋ž˜์Šค๋ฅผ ํ™•์žฅํ•œ ํด๋ž˜์Šค์ž…๋‹ˆ๋‹ค.

์˜ˆ์ œ
from ultralytics.models.yolo.obb import OBBTrainer

args = dict(model='yolov8n-obb.pt', data='dota8.yaml', epochs=3)
trainer = OBBTrainer(overrides=args)
trainer.train()
์˜ ์†Œ์Šค ์ฝ”๋“œ ultralytics/models/yolo/obb/train.py
class OBBTrainer(yolo.detect.DetectionTrainer):
    """
    A class extending the DetectionTrainer class for training based on an Oriented Bounding Box (OBB) model.

    Example:
        ```python
        from ultralytics.models.yolo.obb import OBBTrainer

        args = dict(model='yolov8n-obb.pt', data='dota8.yaml', epochs=3)
        trainer = OBBTrainer(overrides=args)
        trainer.train()
        ```
    """

    def __init__(self, cfg=DEFAULT_CFG, overrides=None, _callbacks=None):
        """Initialize a OBBTrainer object with given arguments."""
        if overrides is None:
            overrides = {}
        overrides["task"] = "obb"
        super().__init__(cfg, overrides, _callbacks)

    def get_model(self, cfg=None, weights=None, verbose=True):
        """Return OBBModel initialized with specified config and weights."""
        model = OBBModel(cfg, ch=3, nc=self.data["nc"], verbose=verbose and RANK == -1)
        if weights:
            model.load(weights)

        return model

    def get_validator(self):
        """Return an instance of OBBValidator for validation of YOLO model."""
        self.loss_names = "box_loss", "cls_loss", "dfl_loss"
        return yolo.obb.OBBValidator(self.test_loader, save_dir=self.save_dir, args=copy(self.args))

__init__(cfg=DEFAULT_CFG, overrides=None, _callbacks=None)

์ฃผ์–ด์ง„ ์ธ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ OBBTrainer ๊ฐ์ฒด๋ฅผ ์ดˆ๊ธฐํ™”ํ•ฉ๋‹ˆ๋‹ค.

์˜ ์†Œ์Šค ์ฝ”๋“œ ultralytics/models/yolo/obb/train.py
def __init__(self, cfg=DEFAULT_CFG, overrides=None, _callbacks=None):
    """Initialize a OBBTrainer object with given arguments."""
    if overrides is None:
        overrides = {}
    overrides["task"] = "obb"
    super().__init__(cfg, overrides, _callbacks)

get_model(cfg=None, weights=None, verbose=True)

์ง€์ •๋œ ๊ตฌ์„ฑ๊ณผ ๊ฐ€์ค‘์น˜๋กœ ์ดˆ๊ธฐํ™”๋œ OBBModel์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

์˜ ์†Œ์Šค ์ฝ”๋“œ ultralytics/models/yolo/obb/train.py
def get_model(self, cfg=None, weights=None, verbose=True):
    """Return OBBModel initialized with specified config and weights."""
    model = OBBModel(cfg, ch=3, nc=self.data["nc"], verbose=verbose and RANK == -1)
    if weights:
        model.load(weights)

    return model

get_validator()

YOLO ๋ชจ๋ธ์˜ ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ๋ฅผ ์œ„ํ•ด OBBValidator์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

์˜ ์†Œ์Šค ์ฝ”๋“œ ultralytics/models/yolo/obb/train.py
def get_validator(self):
    """Return an instance of OBBValidator for validation of YOLO model."""
    self.loss_names = "box_loss", "cls_loss", "dfl_loss"
    return yolo.obb.OBBValidator(self.test_loader, save_dir=self.save_dir, args=copy(self.args))





์ƒ์„ฑ๋จ 2024-01-05, ์—…๋ฐ์ดํŠธ๋จ 2024-01-12
์ž‘์„ฑ์ž: glenn-jocher (2)