Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
YongboLiang opened this issue Sep 27, 2018 · 5 comments
Closed

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

YongboLiang opened this issue Sep 27, 2018 · 5 comments

Comments

@YongboLiang
Copy link

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!

@JiahuiYu
Copy link
Owner

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')

@YongboLiang
Copy link
Author

Thanks

@guiji0812
Copy link

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

@izhx
Copy link

izhx commented Jun 10, 2019

I have the same confusion.

@serkansulun
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants