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

๋‹ค์Œ์„ ์‚ฌ์šฉํ•œ ๋ถ„์„ Ultralytics YOLO11

์†Œ๊ฐœ

์ด ๊ฐ€์ด๋“œ์—์„œ๋Š” ์„  ๊ทธ๋ž˜ํ”„, ๋ง‰๋Œ€ํ˜• ์ฐจํŠธ, ์›ํ˜• ์ฐจํŠธ์˜ ์„ธ ๊ฐ€์ง€ ๊ธฐ๋ณธ ๋ฐ์ดํ„ฐ ์‹œ๊ฐํ™” ์œ ํ˜•์— ๋Œ€ํ•œ ํฌ๊ด„์ ์ธ ๊ฐœ์š”๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๊ฐ ์„น์…˜์—๋Š” Python ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋Ÿฌํ•œ ์‹œ๊ฐํ™”๋ฅผ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ๋‹จ๊ณ„๋ณ„ ์ง€์นจ๊ณผ ์ฝ”๋“œ ์Šค๋‹ˆํŽซ์ด ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.



Watch: Ultralytics | ์„  ๊ทธ๋ž˜ํ”„, ๋ง‰๋Œ€ ๊ทธ๋ž˜ํ”„, ๋ฉด์  ๋ฐ ํŒŒ์ด ์ฐจํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ถ„์„ ๊ทธ๋ž˜ํ”„๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•

์‹œ๊ฐ์  ์ƒ˜ํ”Œ

์„  ๊ทธ๋ž˜ํ”„ ๋ง‰๋Œ€ ํ”Œ๋กฏ ํŒŒ์ด ์ฐจํŠธ
์„  ๊ทธ๋ž˜ํ”„ ๋ง‰๋Œ€ ํ”Œ๋กฏ ํŒŒ์ด ์ฐจํŠธ

๊ทธ๋ž˜ํ”„๊ฐ€ ์ค‘์š”ํ•œ ์ด์œ 

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

๋ถ„์„ ์˜ˆ์ œ

 yolo solutions analytics show=True

# pass the source
yolo solutions analytics source="path/to/video/file.mp4"

# generate the pie chart
yolo solutions analytics analytics_type="pie" show=True

# generate the bar plots
yolo solutions analytics analytics_type="bar" show=True

# generate the area plots
yolo solutions analytics analytics_type="area" show=True
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
out = cv2.VideoWriter(
    "ultralytics_analytics.avi",
    cv2.VideoWriter_fourcc(*"MJPG"),
    fps,
    (1920, 1080),  # This is fixed
)

# Init analytics
analytics = solutions.Analytics(
    show=True,  # Display the output
    analytics_type="line",  # Pass the analytics type, could be "pie", "bar" or "area".
    model="yolo11n.pt",  # Path to the YOLO11 model file
    # classes=[0, 2],  # If you want to count specific classes i.e person and car with COCO pretrained model.
)

# Process video
frame_count = 0
while cap.isOpened():
    success, im0 = cap.read()
    if success:
        frame_count += 1
        im0 = analytics.process_data(im0, frame_count)  # update analytics graph every frame
        out.write(im0)  # write the video file
    else:
        break

cap.release()
out.release()
cv2.destroyAllWindows()

์ธ์ˆ˜ Analytics

๋‹ค์Œ์€ ํ‘œ์ž…๋‹ˆ๋‹ค. Analytics ์ธ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค:

์ด๋ฆ„ ์œ ํ˜• ๊ธฐ๋ณธ๊ฐ’ ์„ค๋ช…
analytics_type str line ๊ทธ๋ž˜ํ”„ ์œ ํ˜•(์˜ˆ: "์„ ", "๋ง‰๋Œ€", "๋ฉด์ ", "ํŒŒ์ด")
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 ์• ๋„๋ฆฌํ‹ฑ์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ผ์ธ ๊ทธ๋ž˜ํ”„๋ฅผ ๋งŒ๋“ค๋ ค๋ฉด ๋‹ค์Œ ๋‹จ๊ณ„๋ฅผ ๋”ฐ๋ฅด์„ธ์š”:

  1. YOLO11 ๋ชจ๋ธ์„ ๋กœ๋“œํ•˜๊ณ  ๋™์˜์ƒ ํŒŒ์ผ์„ ์—ฝ๋‹ˆ๋‹ค.
  2. ์ดˆ๊ธฐํ™” Analytics ํด๋ž˜์Šค์˜ ์œ ํ˜•์„ "line"์œผ๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
  3. ๋น„๋””์˜ค ํ”„๋ ˆ์ž„์„ ๋ฐ˜๋ณตํ•˜์—ฌ ํ”„๋ ˆ์ž„๋‹น ๊ฐœ์ฒด ์ˆ˜์™€ ๊ฐ™์€ ๊ด€๋ จ ๋ฐ์ดํ„ฐ๋กœ ์„  ๊ทธ๋ž˜ํ”„๋ฅผ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค.
  4. ์„  ๊ทธ๋ž˜ํ”„๊ฐ€ ํ‘œ์‹œ๋œ ์ถœ๋ ฅ ๋™์˜์ƒ์„ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์‹œ:

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))

out = cv2.VideoWriter(
    "ultralytics_analytics.avi",
    cv2.VideoWriter_fourcc(*"MJPG"),
    fps,
    (1920, 1080),  # This is fixed
)

analytics = solutions.Analytics(
    analytics_type="line",
    show=True,
)

frame_count = 0
while cap.isOpened():
    success, im0 = cap.read()
    if success:
        frame_count += 1
        im0 = analytics.process_data(im0, frame_count)  # update analytics graph every frame
        out.write(im0)  # write the video file
    else:
        break

cap.release()
out.release()
cv2.destroyAllWindows()

๊ตฌ์„ฑ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ Analytics ํด๋ž˜์Šค๋ฅผ ๋ฐฉ๋ฌธํ•˜์‹ญ์‹œ์˜ค. Ultralytics YOLO11 ๐Ÿ“Š์„ ์‚ฌ์šฉํ•œ ๋ถ„์„ ์„น์…˜์œผ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

๋ง‰๋Œ€ํ˜• ์ฐจํŠธ ์ƒ์„ฑ์— Ultralytics YOLO11 ์„ ์‚ฌ์šฉํ•˜๋ฉด ์–ด๋–ค ์ด์ ์ด ์žˆ๋‚˜์š”?

๋ง‰๋Œ€ํ˜• ์ฐจํŠธ ์ƒ์„ฑ์— Ultralytics YOLO11 ์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ช‡ ๊ฐ€์ง€ ์ด์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค:

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

๋‹ค์Œ ์˜ˆ์ œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ง‰๋Œ€ํ˜• ์ฐจํŠธ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค:

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))

out = cv2.VideoWriter(
    "ultralytics_analytics.avi",
    cv2.VideoWriter_fourcc(*"MJPG"),
    fps,
    (1920, 1080),  # This is fixed
)

analytics = solutions.Analytics(
    analytics_type="bar",
    show=True,
)

frame_count = 0
while cap.isOpened():
    success, im0 = cap.read()
    if success:
        frame_count += 1
        im0 = analytics.process_data(im0, frame_count)  # update analytics graph every frame
        out.write(im0)  # write the video file
    else:
        break

cap.release()
out.release()
cv2.destroyAllWindows()

์ž์„ธํ•œ ๋‚ด์šฉ์€ ๊ฐ€์ด๋“œ์˜ ๋ง‰๋Œ€ํ˜• ์ฐจํŠธ ์„น์…˜์„ ์ฐธ์กฐํ•˜์„ธ์š”.

๋ฐ์ดํ„ฐ ์‹œ๊ฐํ™” ํ”„๋กœ์ ํŠธ์—์„œ ํŒŒ์ด ์ฐจํŠธ๋ฅผ ๋งŒ๋“ค ๋•Œ Ultralytics YOLO11 ์„ ์‚ฌ์šฉํ•ด์•ผ ํ•˜๋Š” ์ด์œ ๋Š” ๋ฌด์—‡์ธ๊ฐ€์š”?

Ultralytics YOLO11 ๋Š” ํŒŒ์ด ์ฐจํŠธ๋ฅผ ๋งŒ๋“œ๋Š” ๋ฐ ํƒ์›”ํ•œ ์„ ํƒ์ž…๋‹ˆ๋‹ค:

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

๋‹ค์Œ์€ ๊ฐ„๋‹จํ•œ ์˜ˆ์ž…๋‹ˆ๋‹ค:

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))

out = cv2.VideoWriter(
    "ultralytics_analytics.avi",
    cv2.VideoWriter_fourcc(*"MJPG"),
    fps,
    (1920, 1080),  # This is fixed
)

analytics = solutions.Analytics(
    analytics_type="pie",
    show=True,
)

frame_count = 0
while cap.isOpened():
    success, im0 = cap.read()
    if success:
        frame_count += 1
        im0 = analytics.process_data(im0, frame_count)  # update analytics graph every frame
        out.write(im0)  # write the video file
    else:
        break

cap.release()
out.release()
cv2.destroyAllWindows()

์ž์„ธํ•œ ๋‚ด์šฉ์€ ๊ฐ€์ด๋“œ์˜ ํŒŒ์ด ์ฐจํŠธ ์„น์…˜์„ ์ฐธ์กฐํ•˜์„ธ์š”.

Ultralytics YOLO11 ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐœ์ฒด๋ฅผ ์ถ”์ ํ•˜๊ณ  ๋น„์ฃผ์–ผ๋ฆฌ์ œ์ด์…˜์„ ๋™์ ์œผ๋กœ ์—…๋ฐ์ดํŠธํ•  ์ˆ˜ ์žˆ๋‚˜์š”?

์˜ˆ, Ultralytics 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))

out = cv2.VideoWriter(
    "ultralytics_analytics.avi",
    cv2.VideoWriter_fourcc(*"MJPG"),
    fps,
    (1920, 1080),  # This is fixed
)

analytics = solutions.Analytics(
    analytics_type="line",
    show=True,
)

frame_count = 0
while cap.isOpened():
    success, im0 = cap.read()
    if success:
        frame_count += 1
        im0 = analytics.process_data(im0, frame_count)  # update analytics graph every frame
        out.write(im0)  # write the video file
    else:
        break

cap.release()
out.release()
cv2.destroyAllWindows()

์ „์ฒด ๊ธฐ๋Šฅ์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๋ ค๋ฉด ์ถ”์  ์„น์…˜์„ ์ฐธ์กฐํ•˜์„ธ์š”.

Ultralytics YOLO11 ์ด ๋‹ค๋ฅธ ๊ฐ์ฒด ๊ฐ์ง€ ์†”๋ฃจ์…˜๊ณผ ๋‹ค๋ฅธ ์ ์€ ๋ฌด์—‡์ž…๋‹ˆ๊นŒ? TensorFlow?

Ultralytics YOLO11 ๋Š” ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ์ด์œ ๋กœ OpenCV๋‚˜ TensorFlow ๊ฐ™์€ ๋‹ค๋ฅธ ๊ฐ์ฒด ๊ฐ์ง€ ์†”๋ฃจ์…˜๊ณผ ์ฐจ๋ณ„ํ™”๋ฉ๋‹ˆ๋‹ค:

  1. ์ตœ์ฒจ๋‹จ ์ •ํ™•๋„: YOLO11 ๋Š” ๋ฌผ์ฒด ๊ฐ์ง€, ์„ธ๋ถ„ํ™” ๋ฐ ๋ถ„๋ฅ˜ ์ž‘์—…์—์„œ ๋›ฐ์–ด๋‚œ ์ •ํ™•๋„๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
  2. ์‚ฌ์šฉ ํŽธ์˜์„ฑ: ์‚ฌ์šฉ์ž ์นœํ™”์ ์ธ API๋ฅผ ํ†ตํ•ด ๊ด‘๋ฒ”์œ„ํ•œ ์ฝ”๋”ฉ ์—†์ด๋„ ๋น ๋ฅด๊ฒŒ ๊ตฌํ˜„ํ•˜๊ณ  ํ†ตํ•ฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  3. ์‹ค์‹œ๊ฐ„ ์„ฑ๋Šฅ: ์‹ค์‹œ๊ฐ„ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ์ ํ•ฉํ•œ ๊ณ ์† ์ถ”๋ก ์— ์ตœ์ ํ™”๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
  4. ๋‹ค์–‘ํ•œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜: ๋‹ค์ค‘ ๊ฐ์ฒด ์ถ”์ , ์‚ฌ์šฉ์ž ์ง€์ • ๋ชจ๋ธ ํ›ˆ๋ จ, ONNX, TensorRT, CoreML ๊ณผ ๊ฐ™์€ ๋‹ค์–‘ํ•œ ํ˜•์‹์œผ๋กœ ๋‚ด๋ณด๋‚ด๊ธฐ ๋“ฑ ๋‹ค์–‘ํ•œ ์ž‘์—…์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
  5. ์ข…ํ•ฉ์ ์ธ ๋ฌธ์„œ: ๋ชจ๋“  ๋‹จ๊ณ„๋ฅผ ์•ˆ๋‚ดํ•˜๋Š” ๋ฐฉ๋Œ€ํ•œ ๋ฌธ์„œ์™€ ๋ธ”๋กœ๊ทธ ๋ฆฌ์†Œ์Šค.

์ž์„ธํ•œ ๋น„๊ต ๋ฐ ์‚ฌ์šฉ ์‚ฌ๋ก€๋Š” Ultralytics ๋ธ”๋กœ๊ทธ์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

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

๋Œ“๊ธ€