Spaces:
Runtime error
Runtime error
File size: 525 Bytes
0bdfe9d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | from tracking.tracker import Annotation, Box
def detect_for_video(model, video_file_path, confidence):
raw_results = model.predict(video_file_path, verbose=False, conf=confidence)
return [
parse_yolo_annotations_for_single_frame(raw_results_for_frame)
for raw_results_for_frame in raw_results
]
def parse_yolo_annotations_for_single_frame(raw_results):
return [
Annotation(Box(*box.xyxy[0].tolist()), int(box.cls[0]), float(box.conf[0]))
for box in raw_results.boxes
]
|