EfficientNet-PyTorch
EfficientNet-PyTorch copied to clipboard
How to compute the params?
Hi! luke. We are curious about how to calculate the parameter size. When we calculate the parameter size through thop, it is far from what is listed in your Readme file. Here is the code and result
if __name__ == '__main__':
from thop import profile
a = torch.Tensor(2,3,224,224)
model = EfficientNet.from_pretrained('efficientnet-b0', num_classes=100)
flops, params = profile(model, (a,))
print('flops: {:,}\tparams: {:,}'.format(flops, params))
.......
[WARN] Cannot find rule for <class 'torch.nn.modules.container.ModuleList'>. Treat it as zero Macs and zero Params.
[INFO] Register count_adap_avgpool() for <class 'torch.nn.modules.pooling.AdaptiveAvgPool2d'>.
[INFO] Register zero_ops() for <class 'torch.nn.modules.dropout.Dropout'>.
[INFO] Register count_linear() for <class 'torch.nn.modules.linear.Linear'>.
[WARN] Cannot find rule for <class '__main__.EfficientNet'>. Treat it as zero Macs and zero Params.
flops: 27,334,784.0 params: 170,116.0
We can see that the result shows that the parameter size is less than 1MB! Can you help me solve this problem?
@linlll I meet the same problem previously,for the FLOPs counter,I use this tool and get the correct answer. [https://github.com/1adrianb/pytorch-estimate-flops](flops tool) and I think the most important thing is that input size is variable for different models(efficientnet-b0,efficientnet-b1...etc.),not (3,224,224) all the time.