so i am trying to find the mean and the standard deviation of RGB . So what I did was I loaded the images as a matrix which had dimensions [50000, 32, 32, 3] so what I did was i said
Matrix.mean(axis=(0,1,2)
Matrix.std(axis=(0,1,2)
The answer which i got were
array([0.44653, 0.48216, 0.4914 ]) for mean
array([0.26159, 0.24349, 0.24703]) for std
but the answers are
np.array([ 0.4914 , 0.48216, 0.44653] for mean
np.array([ 0.24703, 0.24349, 0.26159]) for std
some how my first and the last values are getting exchanged i cannot understand why it is happening can someone please help me!!!
P.S. matrix is the variable name for the image matrix
Having this array of 6 for all images i take the of all rMean gMean etc
The mean: We should get identical mean values for all methods . The std. : Your std should be larger than mine because the std of each channel across all images will be larger than the mean of the std for the channel pr image. Looking at jeremy values i believe he has taken the std pr channel across alle images
TRAIN = Path("data/cifar10/train_original")
images = (plt.imread(str(i)) for i in TRAIN.iterdir()) # generator comprehension
images = np.stack(images) # this takes time
np.mean(images[:,:,:,0]),np.mean(images[:,:,:,1]),np.mean(images[:,:,:,2])
np.std(images[:,:,:,0]),np.std(images[:,:,:,1]),np.std(images[:,:,:,2])