HRNet / HRNet-Image-Classification

Train the HRNet model on ImageNet
https://jingdongwang2017.github.io/Projects/HRNet/
MIT License
968 stars 215 forks source link

How to use the scripts modelsummary.py to compute the HRNet 's imformation? #2

Closed monk42 closed 5 years ago

monk42 commented 5 years ago

Thanks !

wondervictor commented 5 years ago

Summary of parameters and GFLOPs will show before training, you can see it in train.py https://github.com/HRNet/HRNet-Image-Classification/blob/d698921d00358a7f37e1cf28f50c15ec1d3f3866/tools/train.py#L90

Or you can initialize your model and create an input like this:

# first you need define your model
x = torch.randn((1, 3, 224, 224))
print(get_model_summary(model, x))
monk42 commented 5 years ago

Thanks ,Why computs for Convolution and Linear Layers only ? what about relu layer and bn layer?

wondervictor commented 5 years ago

When inference, BN can be combined with convolution. And GFLOPs of nonlinearity will not be involved in. For more details, you can refer to these papers: ShuffleNetV2, Pruning Convolutional Neural Networks for Resource Efficient Inference, etc.

monk42 commented 5 years ago

Thanks!