diff --git a/basicsr/archs/model_complexity.py b/basicsr/archs/model_complexity.py new file mode 100644 index 0000000..8840559 --- /dev/null +++ b/basicsr/archs/model_complexity.py @@ -0,0 +1,35 @@ +from thop import profile +import torch +from .EFEN_arch import EFEN + +net = EFEN(channels=48, num_DFEB=8, upscale_factor=4) +input = torch.randn(1, 3, 320, 180) +flops, params = profile(net, (input,)) +print('flops[G]: ', flops/1e9, 'params[K]: ', params/1e3) + +#--------------------------*****RFDB-WOA(only)*8(48 channel)(320*180)*****----------------------------------# +# FLOPs: 39298867200.0 = 39.3G # params: 300702.0 = 300.7K +#--------------------------*****EBFB-SRB(only)*8(48 channel)(320*180)*****----------------------------------# +# FLOPs: 38237184000.0 = 38.2G # params: 263838.0 = 263.8K +#--------------------------*****EBFB(only)*8(48 channel)(320*180)*****----------------------------------# +# FLOPs: 17777664000.0 = 17.8G # params: 185886.0 = 185.9K +#--------------------------*****(RFDB-WOA+EMSA)*8(48 channel)(320*180)*****----------------------------------# +# FLOPs: 42118318080.0 = 42.1G # params: 342174.0 = 342.2K +#--------------------------*****(EBFB-SRB+EMSA)*8(48 channel)(320*180)*****----------------------------------# +# FLOPs: 41056634880.0 = 41.1G # params: 305310 = 305.3K +#--------------------------*****(EBFB+EMSA)*8(48 channel)(320*180)*****----------------------------------# +# FLOPs: 20597114880.0 = 20.6G # params: 227358.0 = 227.4K +#--------------------------*****SAFM(only)*8(48 channel)(320*180)*****----------------------------------# +# FLOPs: 3267717120.0 = 3.3G # params: 27294.0 = 27.3K +#--------------------------*****ESA(only)*8(48 channel)(320*180)*****----------------------------------# +# FLOPs: 2928286080.0 = 2.9G # params: 57438.0 = 57.4K +#--------------------------*****EMSA(only)*8(48 channel)(320*180)*****----------------------------------# +# FLOPs: 4959406080.0 = 5.0G # params: 46110.0 = 46.1K +#--------------------------*****(EBFB+ESA)*8(48 channel)(320*180)*****----------------------------------# +# FLOPs: 18565994880.0 = 18.6G # params: 238686.0 = 238.7K +#--------------------------*****(EBFB+SAFM)*8(48 channel)(320*180)*****----------------------------------# +# FLOPs: 18905425920.0 = 18.9G # params: 208542.0 = 208.5K +#--------------------------*****(EBFB+EMSA)*8*****----------------------------------# +# FLOPs: 20597114880.0 = 20.6G # params: 227358.0 = 227.4K (x4)(320*180)(48 channel) +# FLOPs: 33954855840.0 = 34.0G # params: 227418.0 = 227.4K (x3)(426*240)(48 channel) +# FLOPs: 75678451200.0 = 75.7G # params: 227358.0 = 227.4K (x2)(640*360)(48 channel)