About #Parameters in the model
prateek-77 opened this issue · comments
Thanks for providing the code for SwinIR!
I calculated the #Params and #FLOPS for the lightweight SwinIR model using KAIR. However, I'm not able to replicate the numbers mentioned in table 3 of the paper.
For example, I get the #Params as 910.2K instead of 878K in the table. The same happens with #FLOPS too. Could you please guide me on how to reproduce the results? Thanks!
#Params: use
print({sum(map(lambda x: x.numel(), model.parameters())):,d})
# FLOPS: refer to
SwinIR/models/network_swinir.py
Line 862 in 510b756
Thanks for the suggestions! The #Flops for the lightweight SwinIR model are matching, however, the #Params are not. It's coming out to be around 910.2K.
I'm using the following model config for lightweight-SwinIR:
height = (1024 // upscale // window_size + 1) * window_size
width = (720 // upscale // window_size + 1) * window_size
model = SwinIR(upscale=2, in_chans=3, img_size=(height, width), window_size=8,
img_range=1., depths=[6, 6, 6, 6], embed_dim=60, num_heads=[6, 6, 6, 6],
mlp_ratio=2, upsampler='pixelshuffledirect', resi_connection='1conv')
Also, I'm not able to use model.flops() with classic image SR models, since flop calculation is not defined for the Upsample class.
Can you please provide help with these queries? Thanks a lot!
Im facing the same thing. The number of network parameters is 910K!
I found that #params in paper excludes "relative_position_bias_table" parameters. These parameters should be included in #params. But this code print({sum(map(lambda x: x.numel(), model.parameters())):,d})
produces right #params that includes "relative_position_bias_table". I think it should be corrected in your paper.