首先
pip install thop
然后
from basicsr.archs import yourmodel
from thop import profile
model = resnet50()
input = torch.randn(1, 3, 224, 224)
flops, params = profile(model, inputs=(input, ))
print('flops:', flops)
print('params:', params)
这里文件的位置我随便写的,使用时换成自己的模型路径就ok