-1

When using Yolo (v5 or v8) to process a video, it shows the detection speed per frame, like below (e.g. 80.6 ms). Now, is there a flag to get the average speed across all frames?

video 1/1 (563/570) /home/human/yolov5/video.mp4: 384x640 1 human, 80.6ms
video 1/1 (564/570) /home/human/yolov5/video.mp4: 384x640 1 human, 87.1ms
video 1/1 (565/570) /home/human/yolov5/video.mp4: 384x640 1 human, 89.8ms
video 1/1 (566/570) /home/human/yolov5/video.mp4: 384x640 1 human, 81.2ms
video 1/1 (567/570) /home/human/yolov5/video.mp4: 384x640 1 human, 75.5ms
video 1/1 (568/570) /home/human/yolov5/video.mp4: 384x640 1 human, 92.5ms
Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
Tina J
  • 4,983
  • 13
  • 59
  • 125

1 Answers1

0

Using the Ultralytics library, you are getting the average speed per image at the end of the inference ('speed' in the output):

video 1/1 (177/178) /VID.mp4: 640x384 1 person, 1 sports ball, 631.5ms
video 1/1 (178/178) /VID.mp4: 640x384 1 person, 1 sports ball, 345.2ms
Speed: 4.2ms preprocess, 413.7ms inference, 1.6ms postprocess per image at shape (1, 3, 640, 384)

Also, speed information is available as the results attribute:

results = model('VID.mp4')
results[0].speed
# speed (dict): A dictionary of preprocess, inference, and postprocess speeds in milliseconds per image.
hanna_liavoshka
  • 115
  • 1
  • 6