densenet.pytorch
densenet.pytorch copied to clipboard
A problem when computes cifar10 mean and stdev
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()
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.
@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.
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!
@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.