JingyunLiang / SwinIR

SwinIR: Image Restoration Using Swin Transformer (official repository)

Home Page:https://arxiv.org/abs/2108.10257

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

print(height, width, model.flops() / 1e9)

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!

ezoic increase your site revenue