参考 :
https://blog.csdn.net/weixin_45292794/article/details/108227437
https://blog.csdn.net/jzwong/article/details/110954725
=======================================================
两个pytorch的网络参数统计工具:
1. torchstat
pip install torchstat
2. torchsummary
两种安装方式,测试发现均可使用:
pip install torchsummary
或
pip install torch-summary
===============================================
使用方式:
1. torchstat
from torchstat import stat import torchvision.models as models model = models.resnet152() stat(model, (3, 224, 224))
2. torchsummary
import torchvision.models as models from torchsummary import summary model = models.resnet152() summary(model.cuda(),input_size=(3,32,32),batch_size=-1)
如果安装方式:
pip install torchsummary
那么打印结果没有层次感:
如果安装方式:
pip install torch-summary
那么打印结果有层次感:
使用起来还是 pip install torch-summary 显示结果简洁清爽,不过功能强大上还是 pip install torchstat 更胜一筹。
建议配合使用:
torch-summary只能看到网络结构和参数数量:
torchstat 可以看到更多的信息,如参数的内存大小:
关于计算指标:
FLOPS、MAdds、MACC指标:
https://blog.csdn.net/sunlanchang/article/details/103666342
========================================================