zhangyi-3 / KBNet

KBNet: Kernel Basis Network for Image Restoration
MIT License
199 stars 25 forks source link

GMACs doesn't match with the paper. #5

Open Mohan2351999 opened 1 year ago

Mohan2351999 commented 1 year ago

I tried to compute the GMAC's for the KBNet_s, using thop and ptflops the MACs is: 69.09 GMACs. But in the paper the presented MACs are 57.8 GMACs for SIDD task

Could you let me know, which model version has 57.8 GMACs?

Also the KBNet structure looks very similar to NAFNet. Just looking at the code, I felt like you have just added an extra module of the Mutli-axis feature fusion block. If this is the case, how could this have fewer GMACs than the NAFNet? Also could you justify what is the reason for having fewer GMACs than the NAFNet?

zhangyi-3 commented 1 year ago

Thanks for your question! I guess you tested the KBNet_s with the default setting, which exactly matchs the MACs in Table 1 & 2 of our paper. The config for smaller version can be found here. Our paper did not focus on inter-block design, so we used existing designs. This actually helps to explicitly demonstrate the sources of gain.

Mohan2351999 commented 1 year ago

Thank you for your response!

Could you please confirm the following setting for SIDD dataset.

KBNet_s: width = 32 ffn_scale = 1.5 lightweight= True -> This setting has 57.8 GMACs and PSNR: 40.35

NAFNet: width = 64 ffn_scale = 2 -> This setting has 65 GMACs and PSNR: 40.30

Both the networks has same number of encode, decoder and the middle blocks.

Could you please let me know if the above is correct, If not, could you please update here.

iPrayerr commented 1 year ago

Thank you for your response!

Could you please confirm the following setting for SIDD dataset.

KBNet_s: width = 32 ffn_scale = 1.5 lightweight= True -> This setting has 57.8 GMACs and PSNR: 40.35

NAFNet: width = 64 ffn_scale = 2 -> This setting has 65 GMACs and PSNR: 40.30

Both the networks has same number of encode, decoder and the middle blocks.

Could you please let me know if the above is correct, If not, could you please update here.

Hi, I've got the same problem. Do you mean that the 57.8 GMACs is obtained on the input with resolution 32x32? The authors claimed that they got 57.8 GMACs on resolution 4000x3000. For I need to do raw image denoising, I tested inputs with 4 channels and 256x256 resolution, and it has got 260.64 GMACs according to thop.

Sounds really weird:( @zhangyi-3