Which is correct? Suppose that the
image's size is (channels, height, width).
means = np.zeros(3)
stds = np.zeros(3)
for image in dataset:
image = image.reshape(channels, -1)
means += image.mean(1)
stds += image.std(1)
mean = means / len(dataset)
std = stds / len(dataset)
images = [image.reshape(channels, -1) for image in dataset]
images = np.concatenate(images, 1)
mean = images.mean(1)
std = images.std(1)
I googled many times, I still do not find out that how to calculate imagenet's std and mean !