JiahuiYu / wdsr_ntire2018

Code of our winning entry to NTIRE super-resolution challenge, CVPR 2018
http://www.vision.ee.ethz.ch/ntire18/
598 stars 123 forks source link

A issue about training #3

Closed Rainyliuliu closed 5 years ago

Rainyliuliu commented 5 years ago

Hi,when i run main.py ,there is an AttributeError: module 'model.wdsr_a' has no attribute 'make_model'

JiahuiYu commented 5 years ago

@Rainyliuliu Thanks for your interest. You can rename MODEL to make_model here to train. https://github.com/JiahuiYu/wdsr_ntire2018/blob/a4a7ade1b72bac4f49fd6e28d0c4c74d449c5e8b/wdsr_a.py#L26

Rainyliuliu commented 5 years ago

Thank you very much!And i have another question. i add : parser.add_argument('--r_mean', type=int,default=0.4488) parser.add_argument('--g_mean', type=int,default=0.4371) parser.add_argument('--b_mean', type=int,default=0.4040) parser.add_argument('--n_resblocks', type=int, default=32, help='number of residual blocks') parser.add_argument('--n_feats', type=int, default=256, help='number of feature maps') parser.add_argument('--block_feats', type=int,default=256) parser.add_argument('--patch_size', type=int, default=192, help='output patch size') to option.py ,and there is another error :+1: RuntimeError: input and target shapes do not match: input [16 x 3 x 176 x 176], target [16 x 3 x 192 x 192] at /pytorch/ate

Rainyliuliu commented 5 years ago

i think in there def forward(self, x): x = (x - self.rgb_mean.cuda()*255)/127.5 if not self.training: x = self.pad(x) s = self.skip(x) x = self.head(x)

    x = self.body(x)

    x = self.tail(x)
    x += s
    x = x*127.5 + self.rgb_mean.cuda()*255
    return x

s is 176*176 ,but i don't know why

JiahuiYu commented 5 years ago

@Rainyliuliu Sorry we missed it. You can either:

  1. Remove https://github.com/JiahuiYu/wdsr_ntire2018/blob/a4a7ade1b72bac4f49fd6e28d0c4c74d449c5e8b/wdsr_a.py#L78-L79, change padding of https://github.com/JiahuiYu/wdsr_ntire2018/blob/a4a7ade1b72bac4f49fd6e28d0c4c74d449c5e8b/wdsr_a.py#L57 to 1, and https://github.com/JiahuiYu/wdsr_ntire2018/blob/a4a7ade1b72bac4f49fd6e28d0c4c74d449c5e8b/wdsr_a.py#L62 to 2.

or :

  1. in training code of EDSR, crop the target hr to the shape of prediction sr.
YongboLiang commented 5 years ago

I think both paddings of https://github.com/JiahuiYu/wdsr_ntire2018/blob/a4a7ade1b72bac4f49fd6e28d0c4c74d449c5e8b/wdsr_a.py#L57 , and https://github.com/JiahuiYu/wdsr_ntire2018/blob/a4a7ade1b72bac4f49fd6e28d0c4c74d449c5e8b/wdsr_a.py#L62 should be changed to 2.

JiahuiYu commented 5 years ago

@YongboLiang We have explicit padding here. https://github.com/JiahuiYu/wdsr_ntire2018/blob/a4a7ade1b72bac4f49fd6e28d0c4c74d449c5e8b/wdsr_a.py#L79

wangmenglu commented 5 years ago

there is a RuntimeError: The expanded size of the tensor (188) must match the existing size (192) at non-singleton dimension 3

JiahuiYu commented 5 years ago

@wangmenglu Have you modified any thing in our models? It should be fine to run without modification.

wangmenglu commented 5 years ago

@wangmenglu Have you modified any thing in our models? It should be fine to run without modification.

I didn't modified anything.

JiahuiYu commented 5 years ago

Sorry it seems you will need to crop target HR patch to the output size in the main training loop. The reason is because we did not use padding in last convolution. Instead we only pad during testing.

The explicit padding has very close performance in our experiments. Thus we will remove it soon. Apologize for inconvenience and thanks for reporting.

JiahuiYu commented 5 years ago

We have removed explicit padding. Sorry again for the inconvenience.