据说yolov5原来的FLOPS计算脚本有bug,因此这个大神推荐使用thop库进行计算,代码如下:

input = torch.randn(1, 3, 416, 416)
flops, params = thop.profile(model, inputs=(input,))
print('flops:', flops / 900000000*2)
print('params:', params)

收藏在这里,方便以后需要算yolov5等模型的FLOPS时使用;

本文章来源

  1. 知乎poggYOLOv5-Lite:更轻更快易于部署的YOLOv5