facebookarchive / fb.resnet.torch

Torch implementation of ResNet from http://arxiv.org/abs/1512.03385 and training scripts
Other
2.29k stars 664 forks source link

the value of mean, std in cifar-10 #180

Open pranshushah opened 7 years ago

pranshushah commented 7 years ago

meanstd = { mean = {125.3, 123.0, 113.9}, std = {63.0, 62.1, 66.7}, } is these values are in rgb or bgr order??

zhyx12 commented 7 years ago

I got the same result as yours. mean = [0.4913997551666284, 0.48215855929893703, 0.4465309133731618] std = [0.24703225141799082, 0.24348516474564, 0.26158783926049628]

pranshushah commented 7 years ago

actually i got result from fb code but i just want know the order of the mean and std.. is it in bgr or rgb

sreelu1995 commented 6 years ago

@pranshushah the mean is in RGB order

paulkorir commented 5 years ago

Try this:

import numpy as np
# load data
from torchvision import datasets
# load the training data
train_data = datasets.CIFAR10('./cifar10_data', train=True, download=True)
# use np.concatenate to stick all the images together to form a 1600000 X 32 X 3 array
x = np.concatenate([np.asarray(train_data[i][0]) for i in range(len(train_data))])
# print(x)
print(x.shape)
# calculate the mean and std along the (0, 1) axes
train_mean = np.mean(x, axis=(0, 1))
train_std = np.std(x, axis=(0, 1))
# the the mean and std
print(train_mean, train_std)