一、 含义
FLOPs(计算量):注意s小写,是floating point operations的缩写(这里的小s则表示复数),表示浮点运算数,理解为计算量。可以用来衡量算法/模型的复杂度。
 Params(参数量):表示模型的参数量,也是用来衡量算法/模型的复杂度。
二、 thop安装
pip install thop
三、代码
import torch
#--------------------#
#   计算FLOPs,Parmas
#--------------------#
from thop import profile
from net import YourModel
import config
your_model = YourModel()
input1 = torch.randn(1, 3, 320, 320)
flops, params = profile(your_model, inputs=(input1, ))
#--------------------#
#   计算量
#--------------------#
print('FLOPs = ' + str(flops/1000**3) + 'G')
#--------------------#
#   参数量
#--------------------#
print('Params = ' + str(params/1000**2) + 'M')






![[Windows] Bypass分流抢票 v1.16.25 五一黄金周自动抢票软件(2024.02.08更新)](https://img-blog.csdnimg.cn/direct/5a933d8bb0a44159bbae2b92f80cb2be.png)













