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

A problem when computes cifar10 mean and stdev #10

Open
xuyan1115 opened this issue Aug 8, 2017 · 4 comments
Open

A problem when computes cifar10 mean and stdev #10

xuyan1115 opened this issue Aug 8, 2017 · 4 comments

Comments

@xuyan1115
Copy link

Hi, I found a problem in compute-cifar10-mean.py#L31.

The shape of torchvision.datasets.CIFAR10.train_data should be (50000, 32, 32, 3) instead of (50000, 3, 32, 32), so the code in line#31 should be pixels = data[:,:,:,i].ravel()

@gsp-27
Copy link

gsp-27 commented Aug 23, 2017

When you load the data with the "ToTensor()" transform on as is done by the author, it loads the data as BCHW, so the code is correct.

@xuyan1115
Copy link
Author

@gsp-27,
when I read the source code of loading CIFAR10 dataset, I found that the param of transform is just used in the function __getitem__(self, index), which means that only calling self[index] , the output's format is BCHW.

BTW, when I ran compute-cifar10-mean.py, the shape of data is BHWC indeed.

@zhaofenqiang
Copy link

same problem, I think compute-cifar10-mean.py#L31 did has a mistake
BTW I found the mean and std computed by the script here is different from demo.py in line212 and line213, it confuses me, does anyone know why? Thanks!

@xuyan1115
Copy link
Author

@zhaofenqiang Following my suggestion, you should modify compute-cifar10-mean.py#L31 to pixels = data[:,:,:,i].ravel(), and the result is same as demo.py.

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

3 participants