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

๋‹ค์Œ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ Ultralytics YOLO11

๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ์ด๋ž€ ๋ฌด์—‡์ธ๊ฐ€์š”?

๋‘ ๋ฌผ์ฒด ์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ์„ ์ธก์ •ํ•˜๋Š” ๊ฒƒ์„ ์ง€์ •๋œ ๊ณต๊ฐ„ ๋‚ด์—์„œ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ์˜ ๊ฒฝ์šฐ Ultralytics YOLO11์˜ ๊ฒฝ์šฐ ์‚ฌ์šฉ์ž๊ฐ€ ๊ฐ•์กฐ ํ‘œ์‹œํ•œ ๊ฒฝ๊ณ„ ์ƒ์ž์˜ ๊ฑฐ๋ฆฌ๋ฅผ ๊ณ„์‚ฐํ•˜๊ธฐ ์œ„ํ•ด ๊ฒฝ๊ณ„ ์ƒ์ž ์ค‘์‹ฌ์ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.



Watch: ๋‹ค์Œ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ Ultralytics YOLO11

๋น„์ฃผ์–ผ

๋‹ค์Œ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ Ultralytics YOLO11
Ultralytics YOLO11 ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ

๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ์˜ ์žฅ์ ์€?

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

YOLO11 ์„ ์‚ฌ์šฉํ•œ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ ์˜ˆ์‹œ

import cv2

from ultralytics import solutions

cap = cv2.VideoCapture("Path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))

# Video writer
video_writer = cv2.VideoWriter("distance_calculation.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))

# Init distance-calculation obj
distance = solutions.DistanceCalculation(model="yolo11n.pt", show=True)

# Process video
while cap.isOpened():
    success, im0 = cap.read()
    if not success:
        print("Video frame is empty or video processing has been successfully completed.")
        break
    im0 = distance.calculate(im0)
    video_writer.write(im0)

cap.release()
video_writer.release()
cv2.destroyAllWindows()
์ฐธ๊ณ 
  • ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ํด๋ฆญํ•˜๋ฉด ๊ทธ๋ ค์ง„ ๋ชจ๋“  ์ ์ด ์‚ญ์ œ๋ฉ๋‹ˆ๋‹ค.
  • ๋งˆ์šฐ์Šค ์™ผ์ชฝ ํด๋ฆญ์œผ๋กœ ์ ์„ ๊ทธ๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๊ฑฐ๋ฆฌ๋Š” ์ถ”์ •์น˜์ž…๋‹ˆ๋‹ค.
Distance will be an estimate and may not be fully accurate, as it is calculated using 2-dimensional data, which lacks information about the object's depth.

์ธ์ˆ˜ DistanceCalculation()

Name Type Default ์„ค๋ช…
model str None Ultralytics YOLO ๋ชจ๋ธ ํŒŒ์ผ ๊ฒฝ๋กœ
line_width int 2 ๊ฒฝ๊ณ„ ์ƒ์ž์˜ ์„  ๋‘๊ป˜์ž…๋‹ˆ๋‹ค.
show bool False ๋น„๋””์˜ค ์ŠคํŠธ๋ฆผ ํ‘œ์‹œ ์—ฌ๋ถ€๋ฅผ ์ œ์–ดํ•˜๋Š” ํ”Œ๋ž˜๊ทธ์ž…๋‹ˆ๋‹ค.

์ธ์ˆ˜ model.track

์ธ์ˆ˜ ์œ ํ˜• ๊ธฐ๋ณธ๊ฐ’ ์„ค๋ช…
source str None ์ด๋ฏธ์ง€ ๋˜๋Š” ๋™์˜์ƒ์˜ ์†Œ์Šค ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ํŒŒ์ผ ๊ฒฝ๋กœ ๋ฐ URL์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
persist bool False ํ”„๋ ˆ์ž„ ๊ฐ„ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ง€์†์ ์œผ๋กœ ์ถ”์ ํ•˜์—ฌ ๋น„๋””์˜ค ์‹œํ€€์Šค ์ „์ฒด์—์„œ ID๋ฅผ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
tracker str botsort.yaml ์‚ฌ์šฉํ•  ์ถ”์  ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค(์˜ˆ, bytetrack.yaml ๋˜๋Š” botsort.yaml.
conf float 0.3 ํƒ์ง€ ์‹ ๋ขฐ ์ž„๊ณ„๊ฐ’์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ’์ด ๋‚ฎ์„์ˆ˜๋ก ๋” ๋งŽ์€ ๊ฐœ์ฒด๋ฅผ ์ถ”์ ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ์˜คํƒ์ด ํฌํ•จ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
iou float 0.5 ์ค‘๋ณต ๊ฐ์ง€๋ฅผ ํ•„ํ„ฐ๋งํ•˜๊ธฐ ์œ„ํ•œ IoU( Intersection over Union ) ์ž„๊ณ„๊ฐ’์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
classes list None ํด๋ž˜์Šค ์ธ๋ฑ์Šค๋ณ„๋กœ ๊ฒฐ๊ณผ๋ฅผ ํ•„ํ„ฐ๋งํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด classes=[0, 2, 3] ์ง€์ •๋œ ํด๋ž˜์Šค๋งŒ ์ถ”์ ํ•ฉ๋‹ˆ๋‹ค.
verbose bool True ์ถ”์  ๊ฒฐ๊ณผ์˜ ํ‘œ์‹œ๋ฅผ ์ œ์–ดํ•˜์—ฌ ์ถ”์ ๋œ ๊ฐœ์ฒด์˜ ์‹œ๊ฐ์  ์ถœ๋ ฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

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

Ultralytics YOLO11 ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ์ฒด ๊ฐ„ ๊ฑฐ๋ฆฌ๋ฅผ ๊ณ„์‚ฐํ•˜๋ ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•˜๋‚˜์š”?

๋‹ค์Œ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐœ์ฒด ๊ฐ„ ๊ฑฐ๋ฆฌ๋ฅผ ๊ณ„์‚ฐํ•˜๋ ค๋ฉด Ultralytics YOLO11๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ์ง€๋œ ๊ฐ์ฒด์˜ ๊ฒฝ๊ณ„ ์ƒ์ž ์ค‘์‹ฌ์„ ์‹๋ณ„ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด ํ”„๋กœ์„ธ์Šค์—๋Š” DistanceCalculation ํด๋ž˜์Šค์—์„œ Ultralytics' solutions ๋ชจ๋“ˆ์„ ํ˜ธ์ถœํ•˜๊ณ  ๋ชจ๋ธ์˜ ์ถ”์  ์ถœ๋ ฅ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฑฐ๋ฆฌ๋ฅผ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค. ๊ตฌํ˜„์€ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ ์˜ˆ์‹œ.

Ultralytics YOLO11 ์œผ๋กœ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ์„ ์‚ฌ์šฉํ•˜๋ฉด ์–ด๋–ค ์ด์ ์ด ์žˆ๋‚˜์š”?

Ultralytics YOLO11 ์œผ๋กœ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ช‡ ๊ฐ€์ง€ ์žฅ์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค:

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

Ultralytics YOLO11 ์œผ๋กœ ์‹ค์‹œ๊ฐ„ ๋™์˜์ƒ ์ŠคํŠธ๋ฆผ์—์„œ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋‚˜์š”?

์˜ˆ, Ultralytics YOLO11 ์„ ์‚ฌ์šฉํ•˜์—ฌ ์‹ค์‹œ๊ฐ„ ๋™์˜์ƒ ์ŠคํŠธ๋ฆผ์—์„œ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ณผ์ •์—๋Š” ๋‹ค์Œ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋น„๋””์˜ค ํ”„๋ ˆ์ž„์„ ์บก์ฒ˜ํ•˜๋Š” ๊ฒƒ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค. OpenCV์‹คํ–‰ ์ค‘ YOLO11 ๋ฌผ์ฒด ๊ฐ์ง€๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ DistanceCalculation ํด๋ž˜์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์—ฐ์† ํ”„๋ ˆ์ž„์—์„œ ์˜ค๋ธŒ์ ํŠธ ๊ฐ„์˜ ๊ฑฐ๋ฆฌ๋ฅผ ๊ณ„์‚ฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๊ตฌํ˜„ ๋ฐฉ๋ฒ•์€ ๋น„๋””์˜ค ์ŠคํŠธ๋ฆผ ์˜ˆ์‹œ.

Ultralytics YOLO11 ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ ์ค‘์— ๊ทธ๋ ค์ง„ ํฌ์ธํŠธ๋ฅผ ์‚ญ์ œํ•˜๋ ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•˜๋‚˜์š”?

Ultralytics YOLO11 ์œผ๋กœ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ ์ค‘์— ๊ทธ๋ ค์ง„ ์ ์„ ์‚ญ์ œํ•˜๋ ค๋ฉด ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์ด ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋ฉด ๊ทธ๋ ค์ง„ ๋ชจ๋“  ์ ์ด ์ง€์›Œ์ง‘๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ ์˜ˆ์ œ ์•„๋ž˜์˜ ์ฐธ๊ณ  ์„น์…˜์„ ์ฐธ์กฐํ•˜์„ธ์š”.

Ultralytics YOLO11 ์—์„œ DistanceCalculation ํด๋ž˜์Šค๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๊ธฐ ์œ„ํ•œ ์ฃผ์š” ์ธ์ˆ˜๋Š” ๋ฌด์—‡์ž…๋‹ˆ๊นŒ?

์ดˆ๊ธฐํ™”๋ฅผ ์œ„ํ•œ ์ฃผ์š” ์ธ์ˆ˜๋Š” DistanceCalculation ํด๋ž˜์Šค Ultralytics YOLO11 ํฌํ•จ:

  • model: ๋ชจ๋ธ ํŒŒ์ผ ๊ฒฝ๋กœ.
  • show: ๋น„๋””์˜ค ์ŠคํŠธ๋ฆผ์„ ํ‘œ์‹œํ• ์ง€ ์—ฌ๋ถ€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ํ”Œ๋ž˜๊ทธ์ž…๋‹ˆ๋‹ค.
  • line_width: ๊ฒฝ๊ณ„ ์ƒ์ž์˜ ๋‘๊ป˜์™€ ์ด๋ฏธ์ง€์— ๊ทธ๋ ค์ง„ ์„ ์ž…๋‹ˆ๋‹ค.

์ „์ฒด ๋ชฉ๋ก๊ณผ ๊ธฐ๋ณธ๊ฐ’์€ DistanceCalculation์˜ ์ธ์ˆ˜๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

๐Ÿ“… Created 11 months ago โœ๏ธ Updated 29 days ago

๋Œ“๊ธ€