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 !

  • $\begingroup$ The second one is correct. $\endgroup$ – Jan Kukacka Oct 30 '18 at 12:44
  • $\begingroup$ @JanKukacka Any paper supports it? $\endgroup$ – acgtyrant Oct 30 '18 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.