本文共 2208 字,大约阅读时间需要 7 分钟。
???????YOLOv8?BotSORT??????????????????????????????????
YOLO?You Only Look Once??????????????????????????????????YOLOv1?2015??????????????????Ultralytics???????YOLO????????YOLOv8????????????????????????????????????????
YOLO???????????????????????????????????????????????????????????SxS?????????????????
pip install ultralytics
from ultralytics import YOLOmodel = YOLO('yolov8n.pt')results = model.train(data="config.yaml", epochs=50, patience=5)import cv2from ultralytics import YOLOmodel = YOLO('yolov8n.pt')import cv2from ultralytics import YOLO# ????????model = YOLO('runs/detect/train2/weights/best.pt')# ??????video_path = r"path/to/video"cap = cv2.VideoCapture(video_path)while cap.isOpened(): success, frame = cap.read() if success: # ??YOLOv8?? results = model.track(frame, persist=True, show=True, tracker="botsort.yaml") # ????? annotated_frame = results[0].plot() # ???? cv2.imshow("YOLOv8 Tracking", annotated_frame) if cv2.waitKey(1) & 0xFF == ord("q"): break else: breakcap.release()cv2.destroyAllWindows()????YOLOv8?BotSORT??????????????????????????????????????????????????????????????????????????????????????
转载地址:http://ehsfk.baihongyu.com/