보μ 경보 μμ€ν νλ‘μ νΈ μ¬μ© Ultralytics YOLO11
Ultralytics YOLO11 μ νμ©ν 보μ 경보 μμ€ν νλ‘μ νΈλ κ³ κΈ μ»΄ν¨ν° λΉμ κΈ°λ₯μ ν΅ν©νμ¬ λ³΄μ μ‘°μΉλ₯Ό κ°νν©λλ€. YOLO11 Ultralytics μμ κ°λ°ν μ΄ μμ€ν μ μ€μκ° λ¬Όμ²΄ κ°μ§ κΈ°λ₯μ μ 곡νμ¬ μ μ¬μ μΈ λ³΄μ μνμ μ¦μ μλ³νκ³ λμν μ μμ΅λλ€. μ΄ νλ‘μ νΈλ λͺ κ°μ§ μ₯μ μ μ 곡ν©λλ€:
- μ€μκ° νμ§: YOLO11 μ ν¨μ¨μ±μ ν΅ν΄ 보μ 경보 μμ€ν μ 보μ μ¬κ³ λ₯Ό μ€μκ°μΌλ‘ νμ§νκ³ λμνμ¬ λμ μκ°μ μ΅μνν μ μμ΅λλ€.
- μ νλ: YOLO11 λ 물체 κ°μ§ μ νλκ° λ°μ΄λ μ€νμ μ€μ΄κ³ 보μ 경보 μμ€ν μ μ λ’°μ±μ ν₯μμν€λ κ²μΌλ‘ μ λͺ ν©λλ€.
- ν΅ν© κΈ°λ₯: μ΄ νλ‘μ νΈλ κΈ°μ‘΄ 보μ μΈνλΌμ μννκ² ν΅ν©λμ΄ μ κ·Έλ μ΄λλ μ§λ₯ν κ°μ κ³μΈ΅μ μ 곡ν μ μμ΅λλ€.
Watch: 보μ 경보 μμ€ν
νλ‘μ νΈ Ultralytics YOLO11 물체 κ°μ§
μ½λ
λ©μμ§ λ§€κ°λ³μ μ€μ
μ°Έκ³
μ± λΉλ°λ²νΈ μμ± νμ
- μ± λΉλ°λ²νΈ μμ±κΈ°λ‘ μ΄λνμ¬ '보μ νλ‘μ νΈ'μ κ°μ μ± μ΄λ¦μ μ§μ νκ³ 16μ리 λΉλ°λ²νΈλ₯Ό μ»μ΅λλ€. μ΄ λΉλ°λ²νΈλ₯Ό 볡μ¬νμ¬ μλ΄μ λ°λΌ μ§μ λ λΉλ°λ²νΈ μ λ ₯λμ λΆμ¬λ£μ΅λλ€.
password = ""
from_email = "" # must match the email used to generate the password
to_email = "" # receiver email
μλ² μμ± λ° μΈμ¦
import smtplib
server = smtplib.SMTP("smtp.gmail.com: 587")
server.starttls()
server.login(from_email, password)
μ΄λ©μΌ 보λ΄κΈ° κΈ°λ₯
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def send_email(to_email, from_email, object_detected=1):
"""Sends an email notification indicating the number of objects detected; defaults to 1 object."""
message = MIMEMultipart()
message["From"] = from_email
message["To"] = to_email
message["Subject"] = "Security Alert"
# Add in the message body
message_body = f"ALERT - {object_detected} objects has been detected!!"
message.attach(MIMEText(message_body, "plain"))
server.sendmail(from_email, to_email, message.as_string())
κ°μ²΄ κ°μ§ λ° μλ¦Ό λ°μ μ
from time import time
import cv2
import torch
from ultralytics import YOLO
from ultralytics.utils.plotting import Annotator, colors
class ObjectDetection:
def __init__(self, capture_index):
"""Initializes an ObjectDetection instance with a given camera index."""
self.capture_index = capture_index
self.email_sent = False
# model information
self.model = YOLO("yolo11n.pt")
# visual information
self.annotator = None
self.start_time = 0
self.end_time = 0
# device information
self.device = "cuda" if torch.cuda.is_available() else "cpu"
def predict(self, im0):
"""Run prediction using a YOLO model for the input image `im0`."""
results = self.model(im0)
return results
def display_fps(self, im0):
"""Displays the FPS on an image `im0` by calculating and overlaying as white text on a black rectangle."""
self.end_time = time()
fps = 1 / round(self.end_time - self.start_time, 2)
text = f"FPS: {int(fps)}"
text_size = cv2.getTextSize(text, cv2.FONT_HERSHEY_SIMPLEX, 1.0, 2)[0]
gap = 10
cv2.rectangle(
im0,
(20 - gap, 70 - text_size[1] - gap),
(20 + text_size[0] + gap, 70 + gap),
(255, 255, 255),
-1,
)
cv2.putText(im0, text, (20, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0, 0, 0), 2)
def plot_bboxes(self, results, im0):
"""Plots bounding boxes on an image given detection results; returns annotated image and class IDs."""
class_ids = []
self.annotator = Annotator(im0, 3, results[0].names)
boxes = results[0].boxes.xyxy.cpu()
clss = results[0].boxes.cls.cpu().tolist()
names = results[0].names
for box, cls in zip(boxes, clss):
class_ids.append(cls)
self.annotator.box_label(box, label=names[int(cls)], color=colors(int(cls), True))
return im0, class_ids
def __call__(self):
"""Run object detection on video frames from a camera stream, plotting and showing the results."""
cap = cv2.VideoCapture(self.capture_index)
assert cap.isOpened()
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
frame_count = 0
while True:
self.start_time = time()
ret, im0 = cap.read()
assert ret
results = self.predict(im0)
im0, class_ids = self.plot_bboxes(results, im0)
if len(class_ids) > 0: # Only send email If not sent before
if not self.email_sent:
send_email(to_email, from_email, len(class_ids))
self.email_sent = True
else:
self.email_sent = False
self.display_fps(im0)
cv2.imshow("YOLO11 Detection", im0)
frame_count += 1
if cv2.waitKey(5) & 0xFF == 27:
break
cap.release()
cv2.destroyAllWindows()
server.quit()
κ°μ²΄ κ°μ§ ν΄λμ€λ₯Ό νΈμΆνκ³ μΆλ‘ μ μ€νν©λλ€.
λμ λλ€! μ½λλ₯Ό μ€ννλ©΄ κ°μ²΄κ° κ°μ§λλ©΄ μ΄λ©μΌλ‘ ν λ²μ μλ¦Όμ λ°κ² λ©λλ€. μλ¦Όμ λ°λ³΅μ μΌλ‘ μ μ‘λμ§ μκ³ μ¦μ μ μ‘λ©λλ€. νμ§λ§ νλ‘μ νΈ μꡬ μ¬νμ λ§κ² μ½λλ₯Ό μμ λ‘κ² μ¬μ©μ μ§μ ν μ μμ΅λλ€.
μ΄λ©μΌ μμ μν
μμ£Ό 묻λ μ§λ¬Έ
Ultralytics YOLO11 보μ 경보 μμ€ν μ μ νλλ₯Ό μ΄λ»κ² κ°μ νλμ?
Ultralytics YOLO11 λ λμ μ νλμ μ€μκ° κ°μ²΄ νμ§ κΈ°λ₯μ μ 곡νμ¬ λ³΄μ 경보 μμ€ν μ κ°νν©λλ€. κ³ κΈ μκ³ λ¦¬μ¦μ μ€νμ ν¬κ² μ€μ¬ μμ€ν μ΄ μ§μ§ μνμλ§ λμνλλ‘ λ³΄μ₯ν©λλ€. μ΄λ κ² ν₯μλ μμ μ±μ κΈ°μ‘΄ 보μ μΈνλΌμ μννκ² ν΅ν©λμ΄ μ λ°μ μΈ λ³΄μ κ°μ νμ§μ μ κ·Έλ μ΄λν μ μμ΅λλ€.
Ultralytics YOLO11 μ κΈ°μ‘΄ 보μ μΈνλΌμ ν΅ν©ν μ μλμ?
μ, Ultralytics YOLO11 κΈ°μ‘΄ 보μ μΈνλΌμ μννκ² ν΅ν©ν μ μμ΅λλ€. μ΄ μμ€ν μ λ€μν λͺ¨λλ₯Ό μ§μνκ³ μ¬μ©μ μ§μ μ μ μ°μ±μ μ 곡νλ―λ‘ κ³ κΈ κ°μ²΄ κ°μ§ κΈ°λ₯μΌλ‘ κΈ°μ‘΄ μ€μ μ ν₯μμν¬ μ μμ΅λλ€. νλ‘μ νΈμ YOLO11 λ₯Ό ν΅ν©νλ λ°©λ²μ λν μμΈν μ§μΉ¨μ ν΅ν© μΉμ μ μ°Έμ‘°νμΈμ.
Ultralytics YOLO11 μ μ€ννκΈ° μν μ€ν λ¦¬μ§ μꡬ μ¬νμ 무μμΈκ°μ?
νμ€ μ€μ μμ Ultralytics YOLO11 μ μ€ννλ €λ©΄ μΌλ°μ μΌλ‘ μ½ 5GBμ λμ€ν¬ μ¬μ 곡κ°μ΄ νμν©λλ€. μ¬κΈ°μλ YOLO11 λͺ¨λΈ λ° μΆκ° μ’ μμ±μ μ μ₯νκΈ° μν 곡κ°μ΄ ν¬ν¨λ©λλ€. ν΄λΌμ°λ κΈ°λ° μ루μ μ κ²½μ° Ultralytics HUBλ ν¨μ¨μ μΈ νλ‘μ νΈ κ΄λ¦¬ λ° λ°μ΄ν° μΈνΈ μ²λ¦¬λ₯Ό μ 곡νμ¬ μ€ν λ¦¬μ§ μꡬ μ¬νμ μ΅μ νν μ μμ΅λλ€. νμ₯ μ€ν 리μ§λ₯Ό ν¬ν¨ν ν₯μλ κΈ°λ₯μ λν νλ‘ μκΈμ μ λν΄ μμΈν μμ보μΈμ.
Ultralytics YOLO11 λ€λ₯Έ κ°μ²΄ κ°μ§ λͺ¨λΈ(μ: Faster R-CNN λλ SSD)κ³Ό λ€λ₯Έ μ μ 무μμΈκ°μ?
Ultralytics YOLO11 λ μ€μκ° κ°μ§ κΈ°λ₯κ³Ό λμ μ νλλ‘ Faster R-CNNμ΄λ SSDμ κ°μ λͺ¨λΈλ³΄λ€ μ°μλ₯Ό μ ν©λλ€. κ³ μ ν μν€ν μ²λ₯Ό ν΅ν΄ μ λ°λ μ ν μμ΄ μ΄λ―Έμ§λ₯Ό ν¨μ¬ λΉ λ₯΄κ² μ²λ¦¬ν μ μμ΄ λ³΄μ 경보 μμ€ν κ³Ό κ°μ΄ μκ°μ λ―Όκ°ν μ ν리μΌμ΄μ μ μ΄μμ μ λλ€. 물체 κ°μ§ λͺ¨λΈμ λν μ’ ν©μ μΈ λΉκ΅λ κ°μ΄λλ₯Ό μ°Έμ‘°νμΈμ.
Ultralytics YOLO11 μ μ¬μ©νμ¬ λ³΄μ μμ€ν μμ μ€ν λΉλλ₯Ό μ€μ΄λ €λ©΄ μ΄λ»κ² ν΄μΌ νλμ?
μ€νμ μ€μ΄λ €λ©΄ Ultralytics YOLO11 λͺ¨λΈμ΄ λ€μνκ³ μ£Όμμ΄ μ λ¬λ¦° λ°μ΄ν° μΈνΈλ‘ μ μ νκ² νλ ¨λμλμ§ νμΈνμΈμ. νμ΄νΌνλΌλ―Έν°λ₯Ό λ―ΈμΈ μ‘°μ νκ³ μλ‘μ΄ λ°μ΄ν°λ‘ λͺ¨λΈμ μ κΈ°μ μΌλ‘ μ λ°μ΄νΈνλ©΄ νμ§ μ νλλ₯Ό ν¬κ² ν₯μμν¬ μ μμ΅λλ€. μμΈν νμ΄νΌνλΌλ―Έν° νλ κΈ°λ²μ νμ΄νΌνλΌλ―Έν° νλ κ°μ΄λμμ νμΈν μ μμ΅λλ€.