You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在YOLOv5/v8中获取视频处理的平均单帧检测速度?

YOLOv5/YOLOv8 获取视频帧平均检测速度的方法

YOLOv5

  • 无需额外参数,视频推理完成后,终端默认会输出平均检测速度。处理结束后会看到类似这样的输出:

    Speed: 0.5ms pre-process, 82.3ms inference, 0.2ms NMS per image at shape (1, 3, 640, 640)
    其中82.3ms inference就是所有帧的平均检测(推理)耗时。

  • 若需要更详细的性能统计,可添加--verbose参数,运行时会输出更多阶段的耗时细节,最终也会汇总平均数据。

YOLOv8

  • 同样默认在视频推理结束后输出平均速度,终端最后会显示类似:

    Speed: 0.3ms preprocess, 78.5ms inference, 0.1ms postprocess per image
    这里的78.5ms inference即为所有帧的平均检测速度。

  • 加--verbose参数可以查看更实时的性能数据,最终也会给出汇总的平均耗时。

如果需要保存这些结果,可将终端输出重定向到文件,比如:

  • YOLOv5:python detect.py --source /home/human/yolov5/video.mp4 > speed_stats.txt
  • YOLOv8:yolo detect source=/home/human/yolov5/video.mp4 > speed_stats.txt
    之后从文件中提取平均速度即可。

内容的提问来源于stack exchange,提问作者angel_30

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 02:55:10