參考 :
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
========================================================
