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

Ultralytics Docs: ์Šฌ๋ผ์ด์‹ฑ ์ถ”๋ก ์— SAHI์™€ ํ•จ๊ป˜ YOLO11 ์‚ฌ์šฉ

SAHI (์Šฌ๋ผ์ด์‹ฑ ์ง€์› ํ•˜์ดํผ ์ถ”๋ก )์™€ YOLO11 ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ Ultralytics ๋ฌธ์„œ์— ์˜ค์‹  ๊ฒƒ์„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค. ์ด ํฌ๊ด„์ ์ธ ๊ฐ€์ด๋“œ๋Š” YOLO11 ์™€ ํ•จ๊ป˜ SAHI๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ๋ชจ๋“  ํ•„์ˆ˜ ์ง€์‹์„ ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์„ ๋ชฉํ‘œ๋กœ ํ•ฉ๋‹ˆ๋‹ค. SAHI๊ฐ€ ๋ฌด์—‡์ธ์ง€, ์Šฌ๋ผ์ด์Šค ์ถ”๋ก ์ด ๋Œ€๊ทœ๋ชจ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ์ค‘์š”ํ•œ ์ด์œ ์™€ ์ด๋Ÿฌํ•œ ๊ธฐ๋Šฅ์„ YOLO11 ์™€ ํ†ตํ•ฉํ•˜์—ฌ ๊ฐœ์ฒด ๊ฐ์ง€ ์„ฑ๋Šฅ์„ ํ–ฅ์ƒ์‹œํ‚ค๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์‚ดํŽด๋ด…๋‹ˆ๋‹ค.

SAHI ์Šฌ๋ผ์ด์Šค ์ถ”๋ก  ๊ฐœ์š”

SAHI ์†Œ๊ฐœ

SAHI(์Šฌ๋ผ์ด์‹ฑ ์ง€์› ํ•˜์ดํผ ์ถ”๋ก )๋Š” ๋Œ€๊ทœ๋ชจ ๊ณ ํ•ด์ƒ๋„ ์ด๋ฏธ์ง€์˜ ๊ฐ์ฒด ๊ฐ์ง€ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์ตœ์ ํ™”ํ•˜๋„๋ก ์„ค๊ณ„๋œ ํ˜์‹ ์ ์ธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ž…๋‹ˆ๋‹ค. ํ•ต์‹ฌ ๊ธฐ๋Šฅ์€ ์ด๋ฏธ์ง€๋ฅผ ๊ด€๋ฆฌ ๊ฐ€๋Šฅํ•œ ์Šฌ๋ผ์ด์Šค๋กœ ๋ถ„ํ• ํ•˜๊ณ  ๊ฐ ์Šฌ๋ผ์ด์Šค์—์„œ ๊ฐ์ฒด ๊ฐ์ง€๋ฅผ ์‹คํ–‰ํ•œ ๋‹ค์Œ ๊ฒฐ๊ณผ๋ฅผ ๋‹ค์‹œ ์—ฐ๊ฒฐํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. SAHI๋Š” YOLO ์‹œ๋ฆฌ์ฆˆ๋ฅผ ๋น„๋กฏํ•œ ๋‹ค์–‘ํ•œ ๋ฌผ์ฒด ๊ฐ์ง€ ๋ชจ๋ธ๊ณผ ํ˜ธํ™˜๋˜๋ฏ€๋กœ ์ปดํ“จํŒ… ๋ฆฌ์†Œ์Šค๋ฅผ ์ตœ์ ํ™”ํ•˜์—ฌ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์œ ์—ฐ์„ฑ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.



Watch: SAHI(์Šฌ๋ผ์ด์‹ฑ ์ง€์› ํ•˜์ดํผ ์ถ”๋ก )๋ฅผ ์‚ฌ์šฉํ•œ ์ถ”๋ก (์Šฌ๋ผ์ด์‹ฑ ์ง€์› ํ•˜์ดํผ ์ถ”๋ก ) Ultralytics YOLO11

SAHI์˜ ์ฃผ์š” ๊ธฐ๋Šฅ

  • ์›ํ™œํ•œ ํ†ตํ•ฉ: SAHI๋Š” YOLO ๋ชจ๋ธ๊ณผ ์†์‰ฝ๊ฒŒ ํ†ตํ•ฉ๋˜๋ฏ€๋กœ ๋งŽ์€ ์ฝ”๋“œ ์ˆ˜์ • ์—†์ด๋„ ์Šฌ๋ผ์ด์‹ฑ ๋ฐ ํƒ์ง€๋ฅผ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๋ฆฌ์†Œ์Šค ํšจ์œจ์„ฑ: SAHI๋Š” ํฐ ์ด๋ฏธ์ง€๋ฅผ ์ž‘์€ ๋ถ€๋ถ„์œผ๋กœ ๋‚˜๋ˆ„์–ด ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋Ÿ‰์„ ์ตœ์ ํ™”ํ•˜์—ฌ ๋ฆฌ์†Œ์Šค๊ฐ€ ์ œํ•œ๋œ ํ•˜๋“œ์›จ์–ด์—์„œ ๊ณ ํ’ˆ์งˆ ํƒ์ง€๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.
  • ๋†’์€ ์ •ํ™•๋„: SAHI๋Š” ์Šค๋งˆํŠธ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ์Šคํ‹ฐ์นญ ํ”„๋กœ์„ธ์Šค ์ค‘์— ๊ฒน์น˜๋Š” ๊ฐ์ง€ ์ƒ์ž๋ฅผ ๋ณ‘ํ•ฉํ•จ์œผ๋กœ์จ ๊ฐ์ง€ ์ •ํ™•๋„๋ฅผ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.

์Šฌ๋ผ์ด์Šค ์ถ”๋ก ์ด๋ž€ ๋ฌด์—‡์ธ๊ฐ€์š”?

์Šฌ๋ผ์ด์Šค ์ถ”๋ก ์€ ํฐ ์ด๋ฏธ์ง€๋‚˜ ๊ณ ํ•ด์ƒ๋„ ์ด๋ฏธ์ง€๋ฅผ ์ž‘์€ ์„ธ๊ทธ๋จผํŠธ(์Šฌ๋ผ์ด์Šค)๋กœ ์„ธ๋ถ„ํ™”ํ•˜๊ณ , ์ด๋Ÿฌํ•œ ์Šฌ๋ผ์ด์Šค์—์„œ ๊ฐ์ฒด ๊ฐ์ง€๋ฅผ ์ˆ˜ํ–‰ํ•œ ๋‹ค์Œ, ์Šฌ๋ผ์ด์Šค๋ฅผ ๋‹ค์‹œ ์ปดํŒŒ์ผํ•˜์—ฌ ์›๋ณธ ์ด๋ฏธ์ง€์—์„œ ๊ฐ์ฒด ์œ„์น˜๋ฅผ ์žฌ๊ตฌ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋งํ•ฉ๋‹ˆ๋‹ค. ์ด ๊ธฐ์ˆ ์€ ์ปดํ“จํŒ… ๋ฆฌ์†Œ์Šค๊ฐ€ ์ œํ•œ๋˜์–ด ์žˆ๊ฑฐ๋‚˜ ๋ฉ”๋ชจ๋ฆฌ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ์ดˆ๊ณ ํ•ด์ƒ๋„ ์ด๋ฏธ์ง€๋กœ ์ž‘์—…ํ•  ๋•Œ ๋งค์šฐ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.

์Šฌ๋ผ์ด์Šค ์ถ”๋ก ์˜ ์ด์ 

  • ์ปดํ“จํŒ… ๋ถ€๋‹ด ๊ฐ์†Œ: ์ด๋ฏธ์ง€ ์Šฌ๋ผ์ด์Šค๊ฐ€ ์ž‘์„์ˆ˜๋ก ์ฒ˜๋ฆฌ ์†๋„๊ฐ€ ๋นจ๋ผ์ง€๊ณ  ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋Ÿ‰์ด ์ ์–ด์ ธ ์ €์‚ฌ์–‘ ํ•˜๋“œ์›จ์–ด์—์„œ ๋” ์›ํ™œํ•˜๊ฒŒ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

  • ๋ณด์กด๋œ ๊ฐ์ง€ ํ’ˆ์งˆ: ๊ฐ ์Šฌ๋ผ์ด์Šค๋Š” ๋…๋ฆฝ์ ์œผ๋กœ ์ฒ˜๋ฆฌ๋˜๋ฏ€๋กœ, ์Šฌ๋ผ์ด์Šค๊ฐ€ ๊ด€์‹ฌ ์žˆ๋Š” ๋ฌผ์ฒด๋ฅผ ์บก์ฒ˜ํ•  ์ˆ˜ ์žˆ์„ ๋งŒํผ ์ถฉ๋ถ„ํžˆ ํฐ ๊ฒฝ์šฐ ๋ฌผ์ฒด ๊ฐ์ง€ ํ’ˆ์งˆ์ด ์ €ํ•˜๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

  • ํ–ฅ์ƒ๋œ ํ™•์žฅ์„ฑ: ์ด ๊ธฐ์ˆ ์„ ์‚ฌ์šฉํ•˜๋ฉด ์ด๋ฏธ์ง€์˜ ํฌ๊ธฐ์™€ ํ•ด์ƒ๋„์— ๋”ฐ๋ผ ๋ฌผ์ฒด ๊ฐ์ง€ ๊ธฐ๋Šฅ์„ ๋ณด๋‹ค ์‰ฝ๊ฒŒ ํ™•์žฅํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์œ„์„ฑ ์ด๋ฏธ์ง€๋ถ€ํ„ฐ ์˜๋ฃŒ ์ง„๋‹จ์— ์ด๋ฅด๊ธฐ๊นŒ์ง€ ๋‹ค์–‘ํ•œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ์ด์ƒ์ ์ž…๋‹ˆ๋‹ค.

YOLO11 SAHI ์—†์Œ YOLO11 SAHI์™€ ํ•จ๊ป˜
YOLO11 SAHI ์—†์Œ YOLO11 SAHI์™€ ํ•จ๊ป˜

์„ค์น˜ ๋ฐ ์ค€๋น„

์„ค์น˜

์‹œ์ž‘ํ•˜๋ ค๋ฉด ์ตœ์‹  ๋ฒ„์ „์˜ SAHI ๋ฐ Ultralytics ์„ ์„ค์น˜ํ•˜์„ธ์š”:

pip install -U ultralytics sahi

๋ชจ๋“ˆ ๊ฐ€์ ธ์˜ค๊ธฐ ๋ฐ ๋ฆฌ์†Œ์Šค ๋‹ค์šด๋กœ๋“œ

ํ•„์š”ํ•œ ๋ชจ๋“ˆ์„ ๊ฐ€์ ธ์˜ค๊ณ  YOLO11 ๋ชจ๋ธ๊ณผ ๋ช‡ ๊ฐ€์ง€ ํ…Œ์ŠคํŠธ ์ด๋ฏธ์ง€๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:

from sahi.utils.file import download_from_url
from sahi.utils.yolov8 import download_yolov8s_model

# Download YOLO11 model
model_path = "models/yolo11s.pt"
download_yolov8s_model(model_path)

# Download test images
download_from_url(
    "https://raw.githubusercontent.com/obss/sahi/main/demo/demo_data/small-vehicles1.jpeg",
    "demo_data/small-vehicles1.jpeg",
)
download_from_url(
    "https://raw.githubusercontent.com/obss/sahi/main/demo/demo_data/terrain2.png",
    "demo_data/terrain2.png",
)

ํ‘œ์ค€ ์ถ”๋ก ์„ ์‚ฌ์šฉํ•œ YOLO11

๋ชจ๋ธ ์ธ์Šคํ„ด์Šคํ™”

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์ฒด ๊ฐ์ง€๋ฅผ ์œ„ํ•ด YOLO11 ๋ชจ๋ธ์„ ์ธ์Šคํ„ด์Šคํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

from sahi import AutoDetectionModel

detection_model = AutoDetectionModel.from_pretrained(
    model_type="yolov8",
    model_path=yolov8_model_path,
    confidence_threshold=0.3,
    device="cpu",  # or 'cuda:0'
)

ํ‘œ์ค€ ์˜ˆ์ธก ์ˆ˜ํ–‰

์ด๋ฏธ์ง€ ๊ฒฝ๋กœ ๋˜๋Š” ๋ฉ์–ด๋ฆฌ ์ด๋ฏธ์ง€๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ‘œ์ค€ ์ถ”๋ก ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

from sahi.predict import get_prediction

# With an image path
result = get_prediction("demo_data/small-vehicles1.jpeg", detection_model)

# With a numpy image
result = get_prediction(read_image("demo_data/small-vehicles1.jpeg"), detection_model)

๊ฒฐ๊ณผ ์‹œ๊ฐํ™”

์˜ˆ์ธก๋œ ๋ฐ”์šด๋”ฉ ๋ฐ•์Šค์™€ ๋งˆ์Šคํฌ๋ฅผ ๋‚ด๋ณด๋‚ด๊ณ  ์‹œ๊ฐํ™”ํ•ฉ๋‹ˆ๋‹ค:

result.export_visuals(export_dir="demo_data/")
Image("demo_data/prediction_visual.png")

์Šฌ๋ผ์ด์Šค ์ถ”๋ก ์„ ์‚ฌ์šฉํ•œ YOLO11

์Šฌ๋ผ์ด์Šค ํฌ๊ธฐ์™€ ๊ฒน์นจ ๋น„์œจ์„ ์ง€์ •ํ•˜์—ฌ ์Šฌ๋ผ์ด์Šค ์ถ”๋ก ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค:

from sahi.predict import get_sliced_prediction

result = get_sliced_prediction(
    "demo_data/small-vehicles1.jpeg",
    detection_model,
    slice_height=256,
    slice_width=256,
    overlap_height_ratio=0.2,
    overlap_width_ratio=0.2,
)

์˜ˆ์ธก ๊ฒฐ๊ณผ ์ฒ˜๋ฆฌ

SAHI๋Š” PredictionResult ๊ฐ์ฒด๋ฅผ ๋‹ค์–‘ํ•œ ์–ด๋…ธํ…Œ์ด์…˜ ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

# Access the object prediction list
object_prediction_list = result.object_prediction_list

# Convert to COCO annotation, COCO prediction, imantics, and fiftyone formats
result.to_coco_annotations()[:3]
result.to_coco_predictions(image_id=1)[:3]
result.to_imantics_annotations()[:3]
result.to_fiftyone_detections()[:3]

๋ฐฐ์น˜ ์˜ˆ์ธก

์ด๋ฏธ์ง€ ๋””๋ ‰ํ† ๋ฆฌ์— ๋Œ€ํ•œ ์ผ๊ด„ ์˜ˆ์ธก์˜ ๊ฒฝ์šฐ:

from sahi.predict import predict

predict(
    model_type="yolov8",
    model_path="path/to/yolo11n.pt",
    model_device="cpu",  # or 'cuda:0'
    model_confidence_threshold=0.4,
    source="path/to/dir",
    slice_height=256,
    slice_width=256,
    overlap_height_ratio=0.2,
    overlap_width_ratio=0.2,
)

์ด์ œ ๋๋‚ฌ์Šต๋‹ˆ๋‹ค! ์ด์ œ ํ‘œ์ค€ ์ถ”๋ก ๊ณผ ์Šฌ๋ผ์ด์Šค ์ถ”๋ก  ๋ชจ๋‘์— YOLO11 ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์ธ์šฉ ๋ฐ ๊ฐ์‚ฌ

์—ฐ๊ตฌ ๋˜๋Š” ๊ฐœ๋ฐœ ์ž‘์—…์— SAHI๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ, ์›๋ณธ SAHI ๋…ผ๋ฌธ์„ ์ธ์šฉํ•˜๊ณ  ์ €์ž๋ฅผ ์ธ์ •ํ•ด ์ฃผ์„ธ์š”:

@article{akyon2022sahi,
  title={Slicing Aided Hyper Inference and Fine-tuning for Small Object Detection},
  author={Akyon, Fatih Cagatay and Altinuc, Sinan Onur and Temizel, Alptekin},
  journal={2022 IEEE International Conference on Image Processing (ICIP)},
  doi={10.1109/ICIP46576.2022.9897990},
  pages={966-970},
  year={2022}
}

์ปดํ“จํ„ฐ ๋น„์ „ ์ปค๋ฎค๋‹ˆํ‹ฐ๋ฅผ ์œ„ํ•ด ์ด ๊ท€์ค‘ํ•œ ๋ฆฌ์†Œ์Šค๋ฅผ ๋งŒ๋“ค๊ณ  ์œ ์ง€ ๊ด€๋ฆฌํ•ด ์ฃผ์‹  SAHI ์—ฐ๊ตฌ ๊ทธ๋ฃน์— ๊ฐ์‚ฌ์˜ ๋ง์”€์„ ์ „ํ•ฉ๋‹ˆ๋‹ค. SAHI์™€ ์ œ์ž‘์ž์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ SAHI GitHub ๋ฆฌํฌ์ง€ํ† ๋ฆฌ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

์ž์ฃผ ๋ฌป๋Š” ์งˆ๋ฌธ

๊ฐ์ฒด ๊ฐ์ง€์—์„œ ์Šฌ๋ผ์ด์Šค ์ถ”๋ก ์„ ์œ„ํ•ด YOLO11 ์„ SAHI์™€ ํ†ตํ•ฉํ•˜๋ ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผ ํ•˜๋‚˜์š”?

Ultralytics YOLO11 ์„ ์Šฌ๋ผ์ด์Šค ์ถ”๋ก ์„ ์œ„ํ•œ SAHI(์Šฌ๋ผ์ด์‹ฑ ์ง€์› ํ•˜์ดํผ ์ถ”๋ก )์™€ ํ†ตํ•ฉํ•˜๋ฉด ๊ณ ํ•ด์ƒ๋„ ์ด๋ฏธ์ง€๋ฅผ ๊ด€๋ฆฌ ๊ฐ€๋Šฅํ•œ ์Šฌ๋ผ์ด์Šค๋กœ ๋ถ„ํ• ํ•˜์—ฌ ๊ฐ์ฒด ๊ฐ์ง€ ์ž‘์—…์„ ์ตœ์ ํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ์ ‘๊ทผ ๋ฐฉ์‹์€ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋Ÿ‰์„ ๊ฐœ์„ ํ•˜๊ณ  ๋†’์€ ๊ฐ์ง€ ์ •ํ™•๋„๋ฅผ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค. ์‹œ์ž‘ํ•˜๋ ค๋ฉด ultralytics ๋ฐ sahi ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:

pip install -U ultralytics sahi

๊ทธ๋Ÿฐ ๋‹ค์Œ YOLO11 ๋ชจ๋ธ์„ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ์ด๋ฏธ์ง€๋ฅผ ํ…Œ์ŠคํŠธํ•ฉ๋‹ˆ๋‹ค:

from sahi.utils.file import download_from_url
from sahi.utils.yolov8 import download_yolov8s_model

# Download YOLO11 model
model_path = "models/yolo11s.pt"
download_yolov8s_model(model_path)

# Download test images
download_from_url(
    "https://raw.githubusercontent.com/obss/sahi/main/demo/demo_data/small-vehicles1.jpeg",
    "demo_data/small-vehicles1.jpeg",
)

์ž์„ธํ•œ ์ง€์นจ์€ ์Šฌ๋ผ์ด์Šค ์ถ”๋ก  ๊ฐ€์ด๋“œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

ํฐ ์ด๋ฏธ์ง€์—์„œ ๋ฌผ์ฒด ๊ฐ์ง€๋ฅผ ์œ„ํ•ด YOLO11 ์™€ ํ•จ๊ป˜ SAHI๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•˜๋Š” ์ด์œ ๋Š” ๋ฌด์—‡์ธ๊ฐ€์š”?

ํฐ ์ด๋ฏธ์ง€์—์„œ ๋ฌผ์ฒด ๊ฐ์ง€๋ฅผ ์œ„ํ•ด Ultralytics YOLO11 ๊ณผ ํ•จ๊ป˜ SAHI๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ช‡ ๊ฐ€์ง€ ์ด์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค:

  • ์ปดํ“จํŒ… ๋ถ€๋‹ด ๊ฐ์†Œ: ์Šฌ๋ผ์ด์Šค๊ฐ€ ์ž‘์„์ˆ˜๋ก ์ฒ˜๋ฆฌ ์†๋„๊ฐ€ ๋น ๋ฅด๊ณ  ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋Ÿ‰์ด ์ ์–ด ๋ฆฌ์†Œ์Šค๊ฐ€ ์ œํ•œ๋œ ํ•˜๋“œ์›จ์–ด์—์„œ๋„ ๊ณ ํ’ˆ์งˆ ํƒ์ง€๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ํƒ์ง€ ์ •ํ™•๋„ ์œ ์ง€: SAHI๋Š” ์ง€๋Šฅํ˜• ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฒน์น˜๋Š” ์ƒ์ž๋ฅผ ๋ณ‘ํ•ฉํ•˜์—ฌ ํƒ์ง€ ํ’ˆ์งˆ์„ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.
  • ํ–ฅ์ƒ๋œ ํ™•์žฅ์„ฑ: ๋‹ค์–‘ํ•œ ์ด๋ฏธ์ง€ ํฌ๊ธฐ์™€ ํ•ด์ƒ๋„์— ๊ฑธ์ณ ๋ฌผ์ฒด ๊ฐ์ง€ ์ž‘์—…์„ ํ™•์žฅํ•  ์ˆ˜ ์žˆ์–ด ์œ„์„ฑ ์ด๋ฏธ์ง€ ๋ถ„์„ ๋ฐ ์˜๋ฃŒ ์ง„๋‹จ๊ณผ ๊ฐ™์€ ๋‹ค์–‘ํ•œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ์ด์ƒ์ ์ž…๋‹ˆ๋‹ค.

๋ฌธ์„œ์—์„œ ์Šฌ๋ผ์ด์Šค ์ถ”๋ก ์˜ ์ด์ ์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด์„ธ์š”.

SAHI์—์„œ YOLO11 ์„ ์‚ฌ์šฉํ•  ๋•Œ ์˜ˆ์ธก ๊ฒฐ๊ณผ๋ฅผ ์‹œ๊ฐํ™”ํ•  ์ˆ˜ ์žˆ๋‚˜์š”?

์˜ˆ, SAHI์—์„œ YOLO11 ์„ ์‚ฌ์šฉํ•˜๋ฉด ์˜ˆ์ธก ๊ฒฐ๊ณผ๋ฅผ ์‹œ๊ฐํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฒฐ๊ณผ๋ฅผ ๋‚ด๋ณด๋‚ด๊ณ  ์‹œ๊ฐํ™”ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:

from IPython.display import Image

result.export_visuals(export_dir="demo_data/")
Image("demo_data/prediction_visual.png")

์ด ๋ช…๋ น์€ ์‹œ๊ฐํ™”๋œ ์˜ˆ์ธก์„ ์ง€์ •๋œ ๋””๋ ‰ํ„ฐ๋ฆฌ์— ์ €์žฅํ•œ ๋‹ค์Œ ์ด๋ฏธ์ง€๋ฅผ ๋กœ๋“œํ•ด ๋…ธํŠธ๋ถ์ด๋‚˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๊ฐ€์ด๋“œ๋Š” ํ‘œ์ค€ ์ถ”๋ก  ์„น์…˜์„ ์ฐธ์กฐํ•˜์„ธ์š”.

SAHI๋Š” YOLO11 ๊ฐ์ฒด ๊ฐ์ง€๋ฅผ ๊ฐœ์„ ํ•˜๊ธฐ ์œ„ํ•ด ์–ด๋–ค ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋‚˜์š”?

SAHI(์Šฌ๋ผ์ด์‹ฑ ์ง€์› ํ•˜์ดํผ ์ถ”๋ก )๋Š” ๊ฐ์ฒด ๊ฐ์ง€๋ฅผ ์œ„ํ•ด Ultralytics YOLO11 ์„ ๋ณด์™„ํ•˜๋Š” ๋ช‡ ๊ฐ€์ง€ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค:

  • ์›ํ™œํ•œ ํ†ตํ•ฉ: SAHI๋Š” YOLO ๋ชจ๋ธ๊ณผ ์‰ฝ๊ฒŒ ํ†ตํ•ฉ๋˜๋ฏ€๋กœ ์ตœ์†Œํ•œ์˜ ์ฝ”๋“œ ์กฐ์ •๋งŒ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
  • ๋ฆฌ์†Œ์Šค ํšจ์œจ์„ฑ: ํฐ ์ด๋ฏธ์ง€๋ฅผ ์ž‘์€ ์กฐ๊ฐ์œผ๋กœ ๋ถ„ํ• ํ•˜์—ฌ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋Ÿ‰๊ณผ ์†๋„๋ฅผ ์ตœ์ ํ™”ํ•ฉ๋‹ˆ๋‹ค.
  • ๋†’์€ ์ •ํ™•๋„: ์Šคํ‹ฐ์นญ ๊ณผ์ •์—์„œ ๊ฒน์น˜๋Š” ๊ฐ์ง€ ์ƒ์ž๋ฅผ ํšจ๊ณผ์ ์œผ๋กœ ๋ณ‘ํ•ฉํ•จ์œผ๋กœ์จ SAHI๋Š” ๋†’์€ ๊ฐ์ง€ ์ •ํ™•๋„๋ฅผ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.

๋” ์ž์„ธํžˆ ์•Œ์•„๋ณด๋ ค๋ฉด SAHI์˜ ์ฃผ์š” ๊ธฐ๋Šฅ์— ๋Œ€ํ•ด ์ฝ์–ด๋ณด์„ธ์š”.

YOLO11 ๋ฐ SAHI๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋Œ€๊ทœ๋ชจ ์ถ”๋ก  ํ”„๋กœ์ ํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋ ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผ ํ•˜๋‚˜์š”?

YOLO11 ๋ฐ SAHI๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋Œ€๊ทœ๋ชจ ์ถ”๋ก  ํ”„๋กœ์ ํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋ชจ๋ฒ” ์‚ฌ๋ก€๋ฅผ ๋”ฐ๋ฅด์„ธ์š”:

  1. ํ•„์ˆ˜ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค: ultralytics ๋ฐ sahi์˜ ์ตœ์‹  ๋ฒ„์ „์ด ์„ค์น˜๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
  2. ์Šฌ๋ผ์ด์Šค ์ถ”๋ก ์„ ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค: ํŠน์ • ํ”„๋กœ์ ํŠธ์— ๋งž๋Š” ์ตœ์ ์˜ ์Šฌ๋ผ์ด์Šค ํฌ๊ธฐ์™€ ๊ฒน์นจ ๋น„์œจ์„ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค.
  3. ์ผ๊ด„ ์˜ˆ์ธก ์‹คํ–‰: SAHI์˜ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋ฏธ์ง€ ๋””๋ ‰ํ† ๋ฆฌ์— ๋Œ€ํ•œ ์ผ๊ด„ ์˜ˆ์ธก์„ ์ˆ˜ํ–‰ํ•˜๋ฉด ํšจ์œจ์„ฑ์ด ํ–ฅ์ƒ๋ฉ๋‹ˆ๋‹ค.

๋ฐฐ์น˜ ์˜ˆ์ธก์˜ ์˜ˆ์ž…๋‹ˆ๋‹ค:

from sahi.predict import predict

predict(
    model_type="yolov8",
    model_path="path/to/yolo11n.pt",
    model_device="cpu",  # or 'cuda:0'
    model_confidence_threshold=0.4,
    source="path/to/dir",
    slice_height=256,
    slice_width=256,
    overlap_height_ratio=0.2,
    overlap_width_ratio=0.2,
)

์ž์„ธํ•œ ๋‹จ๊ณ„๋Š” ๋ฐฐ์น˜ ์˜ˆ์ธก ์„น์…˜์„ ์ฐธ์กฐํ•˜์„ธ์š”.

๐Ÿ“…1 ๋…„ ์ „ ์ƒ์„ฑ๋จ โœ๏ธ 2๊ฐœ์›” ์ „ ์—…๋ฐ์ดํŠธ๋จ

๋Œ“๊ธ€