from torchsummary import summary # 이거 보다
from torchinfo import summary #이게 좋다고 해서 이걸 사용함
pip install torchinfo # conda는 없는 것 같음
from torchinfo import summary
model = VGG(cfgs["vgg16"], batch_norm=False)
summary(model, input_size=(2,3,224,224))
output ↓
==========================================================================================
Layer (type:depth-idx) Output Shape Param #
==========================================================================================
VGG [2, 1000] --
├─Sequential: 1-1 [2, 512, 7, 7] --
│ └─Conv2d: 2-1 [2, 64, 224, 224] 1,792
│ └─ReLU: 2-2 [2, 64, 224, 224] --
│ └─Conv2d: 2-3 [2, 64, 224, 224] 36,928
│ └─ReLU: 2-4 [2, 64, 224, 224] --
│ └─MaxPool2d: 2-5 [2, 64, 112, 112] --
│ └─Conv2d: 2-6 [2, 128, 112, 112] 73,856
│ └─ReLU: 2-7 [2, 128, 112, 112] --
│ └─Conv2d: 2-8 [2, 128, 112, 112] 147,584
│ └─ReLU: 2-9 [2, 128, 112, 112] --
│ └─MaxPool2d: 2-10 [2, 128, 56, 56] --
│ └─Conv2d: 2-11 [2, 256, 56, 56] 295,168
│ └─ReLU: 2-12 [2, 256, 56, 56] --
│ └─Conv2d: 2-13 [2, 256, 56, 56] 590,080
│ └─ReLU: 2-14 [2, 256, 56, 56] --
│ └─Conv2d: 2-15 [2, 256, 56, 56] 590,080
│ └─ReLU: 2-16 [2, 256, 56, 56] --
│ └─MaxPool2d: 2-17 [2, 256, 28, 28] --
│ └─Conv2d: 2-18 [2, 512, 28, 28] 1,180,160
│ └─ReLU: 2-19 [2, 512, 28, 28] --
│ └─Conv2d: 2-20 [2, 512, 28, 28] 2,359,808
│ └─ReLU: 2-21 [2, 512, 28, 28] --
│ └─Conv2d: 2-22 [2, 512, 28, 28] 2,359,808
│ └─ReLU: 2-23 [2, 512, 28, 28] --
│ └─MaxPool2d: 2-24 [2, 512, 14, 14] --
│ └─Conv2d: 2-25 [2, 512, 14, 14] 2,359,808
│ └─ReLU: 2-26 [2, 512, 14, 14] --
│ └─Conv2d: 2-27 [2, 512, 14, 14] 2,359,808
│ └─ReLU: 2-28 [2, 512, 14, 14] --
│ └─Conv2d: 2-29 [2, 512, 14, 14] 2,359,808
│ └─ReLU: 2-30 [2, 512, 14, 14] --
│ └─MaxPool2d: 2-31 [2, 512, 7, 7] --
├─AdaptiveAvgPool2d: 1-2 [2, 512, 7, 7] --
├─Sequential: 1-3 [2, 1000] --
│ └─Linear: 2-32 [2, 4096] 102,764,544
│ └─ReLU: 2-33 [2, 4096] --
│ └─Dropout: 2-34 [2, 4096] --
│ └─Linear: 2-35 [2, 4096] 16,781,312
│ └─ReLU: 2-36 [2, 4096] --
│ └─Dropout: 2-37 [2, 4096] --
│ └─Linear: 2-38 [2, 1000] 4,097,000
==========================================================================================
Total params: 138,357,544
Trainable params: 138,357,544
Non-trainable params: 0
Total mult-adds (G): 30.97
==========================================================================================
Input size (MB): 1.20
Forward/backward pass size (MB): 216.91
Params size (MB): 553.43
Estimated Total Size (MB): 771.54
==========================================================================================