njulj / RFDN

Residual Feature Distillation Network for Lightweight Image Super-Resolution
MIT License
354 stars 43 forks source link

would you like to share your pretrained weights of RFDN_L or RFDN for x2? #9

Open ytao-wang opened 3 years ago

leftdoor commented 3 years ago

and x3. Thank you for your work and sharing.

scutlrr commented 3 years ago

and x4. Thank you for your work and sharing.

Senwang98 commented 3 years ago

Hi, @leftdoor @scutlrr @ytao-wang Have you re-trained the RFDN model? I trained it with 5e-5, and I got 37.90 on Set5 2X.(I don't think use some tricks may gain 0.15 PSNR) Have you reproducted the results in the paper already?

scutlrr commented 3 years ago

@1187697147 I got about 37.99db on Set5 2x.

ytao-wang commented 3 years ago

Hi, @leftdoor @scutlrr @ytao-wang Have you re-trained the RFDN model? I trained it with 5e-5, and I got 37.90 on Set5 2X.(I don't think use some tricks may gain 0.15 PSNR) Have you reproducted the results in the paper already?

Hi, I trained the RFDN_L with params 625,962. I set batch_size = 64, patch_size = 128 and lr = 5e-4(--decay 200-400-600-800) as the paper, and I got 38.03 on Set 5 x2.

Senwang98 commented 3 years ago

Hi, @ytao-wang I thanks for your reply too! My params of RFDN-L is 619662, this is strange! I have shared the RFDB and CCA used in my codes, so do you think is there any wrong with my codes? Or can you share the codes you used to trained, I think it is acceptable that the training result is 0.05 lower than the paper.

ytao-wang commented 3 years ago

Hi, @ytao-wang I thanks for your reply too! My params of RFDN-L is 619662, this is strange! I have shared the RFDB and CCA used in my codes, so do you think is there any wrong with my codes? Or can you share the codes you used to trained, I think it is acceptable that the training result is 0.05 lower than the paper.

Hi, you should set reduction = 4 in CCAlayer (#5 (comment))

Senwang98 commented 3 years ago

Hi, @ytao-wang Thank you very much, maybe I should have seen issues next time!

ytao-wang commented 3 years ago

@1187697147 Hi, I got indicators of 5 datasets (Set5, Set14, B100, Urban100, Manga109) as follows: 38.03/0.9606 33.65/0.9183 32.17/0.8996 32.15/0.9282 38.88/0.9772 I think there's a big difference.

Senwang98 commented 3 years ago

@ytao-wang Yes, I think this is normal. Urban100 is often hard to reproduct Have you used training tricks? The training of SR is usually not 1000 epoch, but 2000 epoch instead which is not reported in SR papers

Senwang98 commented 3 years ago

@scutlrr I didn't get what you say.

scutlrr commented 3 years ago

@ytao-wang Whether you have made improvements based on the thesis experiment and then published a new paper.

scutlrr commented 3 years ago

@scutlrr I didn't get what you say.

sorry, I got it wrong

kk6398 commented 3 years ago

hello, I have seen the dialogue above , you are really great and successful, but I am the green hand on SR, and I meet two questions: i) I trained the RFDN_L with params only 417.212k and I use the torchsummary.py to measure it. That I use the torchsummary.py to test other model like IMDN is correct, so I don't know what wrongs occur. ii)I set batch_size = 64, patch_size = 128 and lr = 5e-4(--decay 200-400-600-800), but I get the psnr on Set 5 x2, only 37.76... I check the all details, but I really don't find any wrongs.

Could you help me? /cry/.... Thank you a lot!!!

Senwang98 commented 3 years ago

@kk6398 Hi, please use CCA layer instead of ESA. In CCA, set r=4 instead of 16 which is commonly used in channel attention. Then you will get right paramters(by the way, the way to calculate the params is only one line code, why use torchsummary?)

kk6398 commented 3 years ago

@kk6398 Hi, please use CCA layer instead of ESA. In CCA, set r=4 instead of 16 which is commonly used in channel attention. Then you will get right paramters(by the way, the way to calculate the params is only one line code, why use torchsummary?)

Thank you for your reply sincerely. I have modified as you mentioned. However, to calculate parameters of the network only need one line code , could you provide the specific code? thanku thanku thanku!

Senwang98 commented 3 years ago

Hi,@kk6398 print('Total params: %.3fM' % (sum(p.numel() for p in _model.parameters())/1000000.0))

kk6398 commented 3 years ago

Hi,@kk6398 print('Total params: %.3fM' % (sum(p.numel() for p in _model.parameters())/1000000.0))

Thanks a lot. I have tried the code that you mentioned and I place it in the main.py of the EDSR: def main(): global model if args.data_test == ['video']: from videotester import VideoTester model = model.Model(args, checkpoint) t = VideoTester(args, model, checkpoint) t.test() else: if checkpoint.ok: loader = data.Data(args) _model = model.Model(args, checkpoint) _loss = loss.Loss(args, checkpoint) if not args.test_only else None t = Trainer(args, loader, _model, _loss, checkpoint) print('Total params: %.3fM' % (sum(p.numel() for p in _model.parameters())/1000000.0)) while not t.terminate(): t.train() t.test() checkpoint.done() Then, I run demo.sh(RFDN: The whole code as you share above(CCA, reduction = 4)), but the final params is still only 395660(scaleX2) and the result of PSNR is very low . I check the code several times, there is no difference between us. So I am so hopeless that I don't know which part is wrong. Could you help me ? Thanku thanku thanku from the bottom of my heart.

Senwang98 commented 3 years ago

@kk6398 Sorry, maybe you need to debug by yourself since we have given you all the code. I guess you need to check some super-param such as layer numbers and etc.

kk6398 commented 3 years ago

@kk6398 Sorry, maybe you need to debug by yourself since we have given you all the code. I guess you need to check some super-param such as layer numbers and etc.

 Thank you for your reply, according your said, I find some wrong. Thankyou thankyou thankyou. I have run the identical params of RFDNx2 as the paper. And I am running the results. Xixi, Thank you again.
jmhhenlihai commented 3 years ago

@1187697147 Hi, I got indicators of 5 datasets (Set5, Set14, B100, Urban100, Manga109) as follows: 38.03/0.9606 33.65/0.9183 32.17/0.8996 32.15/0.9282 38.88/0.9772 I think there's a big difference.

would you like to share your pretrained weights of RFDN for x2 and RFDN for x3?

jmhhenlihai commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

ytao-wang commented 2 years ago

@liang-zhenhuan

下面是RFDN-L的网络框架代码:

`class RFDN(nn.Module): def init(self, in_nc=3, nf=52, num_modules=6, out_nc=3, upscale=3): super(RFDN, self).init()

self.scale_idx = 0

    self.fea_conv = B.conv_layer(in_nc, nf, kernel_size=3)

    self.B1 = B.RFDB(in_channels=nf)
    self.B2 = B.RFDB(in_channels=nf)
    self.B3 = B.RFDB(in_channels=nf)
    self.B4 = B.RFDB(in_channels=nf)
    self.B5 = B.RFDB(in_channels=nf)
    self.B6 = B.RFDB(in_channels=nf)
    self.c = B.conv_block(nf * num_modules, nf, kernel_size=1, act_type='lrelu')

    self.LR_conv = B.conv_layer(nf, nf, kernel_size=3)

    upsample_block = B.pixelshuffle_block
    self.upsampler = upsample_block(nf, out_nc, upscale_factor=upscale)

def forward(self, input):
    out_fea = self.fea_conv(input)
    out_B1 = self.B1(out_fea)
    out_B2 = self.B2(out_B1)
    out_B3 = self.B3(out_B2)
    out_B4 = self.B4(out_B3)
    out_B5 = self.B5(out_B4)
    out_B6 = self.B6(out_B5)

    out_B = self.c(torch.cat([out_B1, out_B2, out_B3, out_B4, out_B5, out_B6], dim=1))
    out_lr = self.LR_conv(out_B) + out_fea

    output = self.upsampler(out_lr)

    return output`

注意设置nf=52,num_modules=6。通过torchstat包,我计算得到模型参数:625,962(upscale=2),632,997(upscale=3),642,846(upscale=4),需要将RFDB中的CCALayer替换成ESA。训练的设置可以看我之前的回复。

Senwang98 commented 2 years ago

@liang-zhenhuan 这个我记得只有CA的reduction=4这个坑,其他的非常简单复现 (加qq解答问题可还行。。。。

Liiiiaictx commented 3 months ago

@Senwang98 大佬,这个RFDN怎么基于EDSR框架训练的,需要把这个仓库的文件拷贝到EDSR仓库吗?其次RFDN的环境配置是什么样的?

jmhhenlihai commented 3 months ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

Liiiiaictx commented 3 months ago

@ytao-wang 大佬,这个RFDN怎么基于EDSR框架训练的,需要把这个仓库的文件拷贝到EDSR仓库吗?其次RFDN的环境配置是什么样的?