JiahuiYu / wdsr_ntire2018

Code of our winning entry to NTIRE super-resolution challenge, CVPR 2018

Home Page:http://www.vision.ee.ethz.ch/ntire18/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get args.r_mean, args.g_mean and args.b_mean?

YongboLiang opened this issue · comments

Hi, Jiahui,
When I run wdsr_a, there is a error:

Making model...
Traceback (most recent call last):
File "D:/project/pytorch/SR/EDSR-m/src/main.py", line 27, in
main()
File "D:/project/pytorch/SR/EDSR-m/src/main.py", line 17, in main
model = model.Model(args, checkpoint)
File "D:\project\pytorch\SR\EDSR-m\src\model_init_.py", line 24, in init
self.model = module.make_model(args).to(self.device)
File "D:\project\pytorch\SR\EDSR-m\src\model\wdsr_a.py", line 42, in init
[args.r_mean, args.g_mean, args.b_mean])).view([1, 3, 1, 1])
AttributeError: 'Namespace' object has no attribute 'r_mean'

Then How can I to get args.r_mean, args.g_mean and args.b_mean?

Thanks!

The args.r_mean, args.g_mean and args.b_mean are computed on training images of DIV2K dataset. For the challenge, we use

parser.add_argument('--r_mean', type=float, default=0.4488,
                    help='Mean of R Channel')
parser.add_argument('--g_mean', type=float, default=0.4371,
                    help='Mean of G channel')
parser.add_argument('--b_mean', type=float, default=0.4040,
                    help='Mean of B channel')

Thanks

The args.r_mean, args.g_mean and args.b_mean are computed on training images of DIV2K dataset. For the challenge, we use

parser.add_argument('--r_mean', type=float, default=0.4488,
                    help='Mean of R Channel')
parser.add_argument('--g_mean', type=float, default=0.4371,
                    help='Mean of G channel')
parser.add_argument('--b_mean', type=float, default=0.4040,
                    help='Mean of B channel')

Hi,if I want to train it with other dataset,how to set the r_mean, g_mean, b_mean attribute values of args? or how to compute the value?And why we need these mean values?I am confused with it

I have the same confusion.

The args.r_mean, args.g_mean and args.b_mean are computed on training images of DIV2K dataset. For the challenge, we use

parser.add_argument('--r_mean', type=float, default=0.4488,
                    help='Mean of R Channel')
parser.add_argument('--g_mean', type=float, default=0.4371,
                    help='Mean of G channel')
parser.add_argument('--b_mean', type=float, default=0.4040,
                    help='Mean of B channel')

Hi,if I want to train it with other dataset,how to set the r_mean, g_mean, b_mean attribute values of args? or how to compute the value?And why we need these mean values?I am confused with it

Then you need to calculate the mean values for R, G, B channels for the entire dataset. If the values are between 0-255, you should also divide by 255 to make them between 0-1.

Subtracting the mean value from the input yields zero-mean input, which provides a more stable training. More importantly, if you are using a pretrained network which was trained with zero-mean input, then the input you provide should also be zero-mean otherwise the results' pixel values will be shifted.