poppinace / indexnet_matting

(ICCV'19) Indices Matter: Learning to Index for Deep Image Matting
Other
389 stars 90 forks source link

Number of parameters inconsistent with the paper? #11

Closed kungtalon closed 4 years ago

kungtalon commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

Problem solved. Thanks anyway : )