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

Ultralytics YOLOv8 ๐Ÿš€์„ ์ด์šฉํ•œ ์ฃผ์ฐจ ๊ด€๋ฆฌ

์ฃผ์ฐจ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ์ด๋ž€ ๋ฌด์—‡์ธ๊ฐ€์š”?

์ฃผ์ฐจ ๊ด€๋ฆฌ Ultralytics YOLOv8 ๋Š” ๊ณต๊ฐ„์„ ๊ตฌ์„ฑํ•˜๊ณ  ๊ฐ€์šฉ์„ฑ์„ ๋ชจ๋‹ˆํ„ฐ๋งํ•˜์—ฌ ํšจ์œจ์ ์ด๊ณ  ์•ˆ์ „ํ•œ ์ฃผ์ฐจ๋ฅผ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค. YOLOv8 ์‹ค์‹œ๊ฐ„ ์ฐจ๋Ÿ‰ ๊ฐ์ง€ ๋ฐ ์ฃผ์ฐจ ์ ์œ ์œจ์— ๋Œ€ํ•œ ์ธ์‚ฌ์ดํŠธ๋ฅผ ํ†ตํ•ด ์ฃผ์ฐจ์žฅ ๊ด€๋ฆฌ๋ฅผ ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.



Watch: Ultralytics YOLOv8 ๐Ÿš€์„ ์‚ฌ์šฉํ•˜์—ฌ ์ฃผ์ฐจ ๊ด€๋ฆฌ๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐฉ๋ฒ•

์ฃผ์ฐจ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ์˜ ์žฅ์ ์€?

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

์‹ค์ œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜

์ฃผ์ฐจ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ ์ฃผ์ฐจ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ
์ฃผ์ฐจ์žฅ ๋ถ„์„ ์‚ฌ์šฉ Ultralytics YOLOv8 ๋‹ค์Œ์„ ์‚ฌ์šฉํ•œ ์ฃผ์ฐจ ๊ด€๋ฆฌ ํ‰๋ฉด๋„ Ultralytics YOLOv8
์ฃผ์ฐจ ๊ด€๋ฆฌ ๋‹ค์Œ์„ ์‚ฌ์šฉํ•œ ์กฐ๊ฐ๋„ Ultralytics YOLOv8 ๋‹ค์Œ์„ ์‚ฌ์šฉํ•œ ์ฃผ์ฐจ ๊ด€๋ฆฌ ํ‰๋ฉด๋„ Ultralytics YOLOv8

์ฃผ์ฐจ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ ์ฝ”๋“œ ์›Œํฌํ”Œ๋กœ์šฐ

ํฌ์ธํŠธ ์„ ํƒ

์ด์ œ ํฌ์ธํŠธ ์„ ํƒ์ด ์‰ฌ์›Œ์กŒ์Šต๋‹ˆ๋‹ค.

์ฃผ์ฐจ ์ง€์  ์„ ํƒ์€ ์ฃผ์ฐจ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ์—์„œ ๋งค์šฐ ์ค‘์š”ํ•˜๊ณ  ๋ณต์žกํ•œ ์ž‘์—…์ž…๋‹ˆ๋‹ค. Ultralytics ์—์„œ๋Š” ์ฃผ์ฐจ์žฅ ๊ตฌ์—ญ์„ ์ •์˜ํ•  ์ˆ˜ ์žˆ๋Š” ๋„๊ตฌ๋ฅผ ์ œ๊ณตํ•˜์—ฌ ์ด ํ”„๋กœ์„ธ์Šค๋ฅผ ๊ฐ„์†Œํ™”ํ•˜๊ณ , ๋‚˜์ค‘์— ์ถ”๊ฐ€ ์ฒ˜๋ฆฌ์— ํ™œ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ์ฃผ์ฐจ์žฅ์„ ๊ด€๋ฆฌํ•˜๋ ค๋Š” ๋น„๋””์˜ค ๋˜๋Š” ์นด๋ฉ”๋ผ ์ŠคํŠธ๋ฆผ์—์„œ ํ”„๋ ˆ์ž„์„ ์บก์ฒ˜ํ•ฉ๋‹ˆ๋‹ค.
  • ์ œ๊ณต๋œ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ทธ๋ž˜ํ”ฝ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์‹œ์ž‘ํ•˜๋ฉด ์ด๋ฏธ์ง€๋ฅผ ์„ ํƒํ•˜๊ณ  ๋งˆ์šฐ์Šค ํด๋ฆญ์œผ๋กœ ์ฃผ์ฐจ ๊ตฌ์—ญ์˜ ์œค๊ณฝ์„ ๊ทธ๋ ค ๋‹ค๊ฐํ˜•์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด๋ฏธ์ง€ ํฌ๊ธฐ

์ตœ๋Œ€ ์ด๋ฏธ์ง€ ํฌ๊ธฐ 1920 * 1080 ์ง€์›

์ฃผ์ฐจ ์Šฌ๋กฏ ์ฃผ์„๊ธฐ Ultralytics YOLOv8

from ultralytics import solutions

solutions.ParkingPtsSelection()
  • ๋‹ค๊ฐํ˜•์œผ๋กœ ์ฃผ์ฐจ ๊ตฌ์—ญ์„ ์ •์˜ํ•œ ํ›„ ๋‹ค์Œ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. save ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ž‘์—… ๋””๋ ‰ํ„ฐ๋ฆฌ์— ๋ฐ์ดํ„ฐ๊ฐ€ ํฌํ•จ๋œ JSON ํŒŒ์ผ์„ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

Ultralytics YOLOv8 ํฌ์ธํŠธ ์„ ํƒ ๋ฐ๋ชจ

Python ์ฃผ์ฐจ ๊ด€๋ฆฌ ๊ทœ์ •

YOLOv8 ์˜ˆ์ œ๋ฅผ ์‚ฌ์šฉํ•œ ์ฃผ์ฐจ ๊ด€๋ฆฌ

import cv2

from ultralytics import solutions

# Path to json file, that created with above point selection app
polygon_json_path = "bounding_boxes.json"

# Video capture
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("parking management.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))

# Initialize parking management object
management = solutions.ParkingManagement(model_path="yolov8n.pt")

while cap.isOpened():
    ret, im0 = cap.read()
    if not ret:
        break

    json_data = management.parking_regions_extraction(polygon_json_path)
    results = management.model.track(im0, persist=True, show=False)

    if results[0].boxes.id is not None:
        boxes = results[0].boxes.xyxy.cpu().tolist()
        clss = results[0].boxes.cls.cpu().tolist()
        management.process_data(json_data, im0, boxes, clss)

    management.display_frames(im0)
    video_writer.write(im0)

cap.release()
video_writer.release()
cv2.destroyAllWindows()

์„ ํƒ์  ์ธ์ˆ˜ ParkingManagement

์ด๋ฆ„ ์œ ํ˜• ๊ธฐ๋ณธ๊ฐ’ ์„ค๋ช…
model_path str None YOLOv8 ๋ชจ๋ธ ๊ฒฝ๋กœ์ž…๋‹ˆ๋‹ค.
txt_color tuple (0, 0, 0) ํ…์ŠคํŠธ์šฉ RGB ์ปฌ๋Ÿฌ ํŠœํ”Œ์ž…๋‹ˆ๋‹ค.
bg_color tuple (255, 255, 255) ๋ฐฐ๊ฒฝ์šฉ RGB ์ปฌ๋Ÿฌ ํŠœํ”Œ์ž…๋‹ˆ๋‹ค.
occupied_region_color tuple (0, 255, 0) ์ ์œ  ์˜์—ญ์— ๋Œ€ํ•œ RGB ์ปฌ๋Ÿฌ ํŠœํ”Œ์ž…๋‹ˆ๋‹ค.
available_region_color tuple (0, 0, 255) ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์ง€์—ญ์— ๋Œ€ํ•œ RGB ์ƒ‰์ƒ ํŠœํ”Œ์ž…๋‹ˆ๋‹ค.
margin int 10 ํ…์ŠคํŠธ ํ‘œ์‹œ๋ฅผ ์œ„ํ•œ ์—ฌ๋ฐฑ.

์ธ์ˆ˜ model.track

์ธ์ˆ˜ ์œ ํ˜• ๊ธฐ๋ณธ๊ฐ’ ์„ค๋ช…
source str None Specifies the source directory for images or videos. Supports file paths and URLs.
persist bool False Enables persistent tracking of objects between frames, maintaining IDs across video sequences.
tracker str botsort.yaml Specifies the tracking algorithm to use, e.g., bytetrack.yaml ๋˜๋Š” botsort.yaml.
conf float 0.3 Sets the confidence threshold for detections; lower values allow more objects to be tracked but may include false positives.
iou float 0.5 Sets the Intersection over Union (IoU) threshold for filtering overlapping detections.
classes list None Filters results by class index. For example, classes=[0, 2, 3] only tracks the specified classes.
verbose bool True Controls the display of tracking results, providing a visual output of tracked objects.

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

Ultralytics YOLOv8 ์ฃผ์ฐจ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ์„ ์–ด๋–ป๊ฒŒ ๊ฐœ์„ ํ•˜๋‚˜์š”?

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

์Šค๋งˆํŠธ ์ฃผ์ฐจ๋ฅผ ์œ„ํ•ด Ultralytics YOLOv8 ์„ ์‚ฌ์šฉํ•˜๋ฉด ์–ด๋–ค ์ด์ ์ด ์žˆ๋‚˜์š”?

Ultralytics YOLOv8 ์Šค๋งˆํŠธ ์ฃผ์ฐจ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋‹ค์–‘ํ•œ ์ด์ ์„ ๋ˆ„๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

  • ํšจ์œจ์„ฑ: ์ฃผ์ฐจ ๊ณต๊ฐ„ ์‚ฌ์šฉ์„ ์ตœ์ ํ™”ํ•˜๊ณ  ํ˜ผ์žก์„ ์ค„์ž…๋‹ˆ๋‹ค.
  • ์•ˆ์ „ ๋ฐ ๋ณด์•ˆ: ๊ฐ์‹œ๋ฅผ ๊ฐ•ํ™”ํ•˜๊ณ  ์ฐจ๋Ÿ‰๊ณผ ๋ณดํ–‰์ž์˜ ์•ˆ์ „์„ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค.
  • ํ™˜๊ฒฝ ์˜ํ–ฅ: ์ฐจ๋Ÿ‰ ์œ ํœด ์‹œ๊ฐ„์„ ์ตœ์†Œํ™”ํ•˜์—ฌ ๋ฐฐ๊ธฐ๊ฐ€์Šค๋ฅผ ์ค„์ด๋Š” ๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค. ์ด์ ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ์—ฌ๊ธฐ์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Ultralytics YOLOv8 ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ฃผ์ฐจ ๊ณต๊ฐ„์„ ์ •์˜ํ•˜๋ ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผ ํ•˜๋‚˜์š”?

์ฃผ์ฐจ ๊ณต๊ฐ„ ์ •์˜๋Š” Ultralytics YOLOv8 ์œผ๋กœ ๊ฐ„๋‹จํ•˜๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

  1. ๋™์˜์ƒ ๋˜๋Š” ์นด๋ฉ”๋ผ ์ŠคํŠธ๋ฆผ์—์„œ ํ”„๋ ˆ์ž„์„ ์บก์ฒ˜ํ•ฉ๋‹ˆ๋‹ค.
  2. ์ œ๊ณต๋œ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋ฏธ์ง€๋ฅผ ์„ ํƒํ•˜๊ณ  ๋‹ค๊ฐํ˜•์„ ๊ทธ๋ ค ์ฃผ์ฐจ ๊ณต๊ฐ„์„ ์ •์˜ํ•˜๋Š” GUI๋ฅผ ์‹คํ–‰ํ•˜์„ธ์š”.
  3. ์ถ”๊ฐ€ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด ๋ ˆ์ด๋ธ”์ด ์ง€์ •๋œ ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•์‹์œผ๋กœ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ์ง€์นจ์€ ํฌ์ธํŠธ ์„ ํƒ ์„น์…˜์„ ์ฐธ์กฐํ•˜์„ธ์š”.

ํŠน์ • ์ฃผ์ฐจ ๊ด€๋ฆฌ ์š”๊ตฌ ์‚ฌํ•ญ์— ๋งž๊ฒŒ YOLOv8 ๋ชจ๋ธ์„ ์‚ฌ์šฉ์ž ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‚˜์š”?

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

์ฃผ์ฐจ์žฅ ๊ด€๋ฆฌ์—์„œ Ultralytics YOLOv8 ์˜ ์‹ค์ œ ์ ์šฉ ์‚ฌ๋ก€์—๋Š” ์–ด๋–ค ๊ฒƒ์ด ์žˆ๋‚˜์š”?

Ultralytics YOLOv8 ๋ฅผ ๋น„๋กฏํ•œ ๋‹ค์–‘ํ•œ ์‹ค์ œ ์ฃผ์ฐจ์žฅ ๊ด€๋ฆฌ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ํ™œ์šฉ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค:

  • ์ฃผ์ฐจ ๊ณต๊ฐ„ ๊ฐ์ง€: ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๊ณต๊ฐ„๊ณผ ์ ์œ  ๊ณต๊ฐ„์„ ์ •ํ™•ํ•˜๊ฒŒ ํŒŒ์•…ํ•ฉ๋‹ˆ๋‹ค.
  • ๊ฐ์‹œ: ์‹ค์‹œ๊ฐ„ ๋ชจ๋‹ˆํ„ฐ๋ง์„ ํ†ตํ•ด ๋ณด์•ˆ์„ ๊ฐ•ํ™”ํ•ฉ๋‹ˆ๋‹ค.
  • ํŠธ๋ž˜ํ”ฝ ํ๋ฆ„ ๊ด€๋ฆฌ: ํšจ์œจ์ ์ธ ํŠธ๋ž˜ํ”ฝ ์ฒ˜๋ฆฌ๋กœ ์œ ํœด ์‹œ๊ฐ„ ๋ฐ ํ˜ผ์žก์„ ์ค„์ž…๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋ณด์—ฌ์ฃผ๋Š” ์ด๋ฏธ์ง€๋Š” ์‹ค์ œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ“… Created 4 months ago โœ๏ธ Updated 5 days ago

๋Œ“๊ธ€