Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number of parameters inconsistent with the paper? #11

Closed
kungtalon opened this issue Nov 19, 2019 · 4 comments
Closed

Number of parameters inconsistent with the paper? #11

kungtalon opened this issue Nov 19, 2019 · 4 comments

Comments

@kungtalon
Copy link

Hello! Thanks for your sharing this awesome repository!
When I try your get_model_summary function in the demo file, with the default model (m2o DIN nonlinear+context) I find the parameter size is 5,953,515.
According to your paper, the parameters should be about 8.15M, right?
And I notice that when setting use_nonlinear=False, the parameters and GFLOPs are the same with the data on your paper (with or without context).
Do you have a clue about this discrepancy?

Here's what the summary function returns:
Total Parameters: 5,953,515

Total Multiply Adds (For Convolution and Linear Layers only): 5.189814209938049 GFLOPs

Number of Layers
Conv2d : 109 layers BatchNorm2d : 88 layers ReLU6 : 71 layers DepthwiseM2OIndexBlock : 5 layers InvertedResidual : 17 layers _ASPPModule : 4 layers AdaptiveAvgPool2d : 1 layers Dropout : 1 layers ASPP : 1 layers IndexedUpsamlping : 7 layers

@poppinace
Copy link
Owner

Hi @yinmustark,
I just run the code on my computer. The model parameter is indeed 8.15M and GFLOPs is 6.2988.
When setting use_nonlinear=False, use_context=False, #Param=4.27M, GFLOPs=4.34; when use_nonlinear=False, use_context=True, #Param=5.12M, GFLOPs=5.82.

Maybe double check your code.

@kungtalon
Copy link
Author

Hi @yinmustark,
I just run the code on my computer. The model parameter is indeed 8.15M and GFLOPs is 6.2988.
When setting use_nonlinear=False, use_context=False, #Param=4.27M, GFLOPs=4.34; when use_nonlinear=False, use_context=True, #Param=5.12M, GFLOPs=5.82.

Maybe double check your code.

Thanks for your reply!
I redownloaded your repo and ran the hlmobilenetv2.py file. I only changed "decoder='indexnet'". The result of "nonlinear+context" is still what I posted,, while the other two results are totally correct.
I think the model itself is nothing wrong because the pretrained model can be loaded successfully.

@poppinace
Copy link
Owner

@yinmustark,
I figure out the problem. You're right.
In my original research code, I doubled the number of channels of the second convolutional layer in the index block under the m2o-depthwise-nonlinear-context setting, which is where I report the #parameters.
Afterwards, I find that this intermediate layer does not affect the performance, so I keep the dimension the same in the final version, but forget to modify the #Param.
This is not a big problem. But still thanks for mentioning this to others.

@kungtalon kungtalon reopened this Nov 24, 2019
@kungtalon
Copy link
Author

Problem solved.
Thanks anyway : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants