Skip to content

Commit

Permalink
Initial YOLO implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguelmelon committed Apr 26, 2024
1 parent 11b9f66 commit ca73978
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions people_tracking_v2/src/people_tracking/yolo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python

import cv2
from ultralytics import YOLO
import supervision as sv





def main():
cap = cv2.VideoCapture(0)

model = YOLO("yolov8l.pt")

box_annotator = sv.BoxAnnotator(
thickness=2,
text_thickness=2,
text_scale=1
)

while True:
ret, frame = cap.read()
cv2.imshow("yolov8", frame)

result = model(frame)[0]
detections = sv.Detections.from_yolov8(result)

frame = box_annotator.annotate(scene=frame, detections=detections)

if (cv2.waitKey(30) == 27):
break

if __name__ == "__main__":
main()

0 comments on commit ca73978

Please sign in to comment.