I'm currently working on a common image classification with CNN.

I would like to use both normalization (substract mean / divide by std per channel) and data augmentation (rotation, color, blur, ...) but I don't know how to use them together.

Which order should I use ?

  • First normalize with parameters based only on original images and then augment it (augment a normalized image is relevant ? should I ban some type of augmentation like color ?)

  • Augment data and apply normalization based on all image (compute mean/ std with augmented images) which seems to be counterintuitive.

  • Augment data and apply normalization based on only original image which means that data are not really normalized

  • Or don't use both methods


You should use both; each of the two methods aims to solve a different problem, so using only one would not solve the problem solved by the other.

It does not matter so much in which order you perform them. Doing augmentation first and normalization second sounds more natural to me (you can visually validate if your augmentation is generating sensible data), but the other way round is also possible, you just need to make sure that the augmentation parameters respect the normalization (e.g. shifting a color by value from uniform distribution [-20,20] makes no sense for images on scale [-1,1]).

  • $\begingroup$ Thanks for your answer, if I perform augmentation first then normalization, should I compute mean and std only from original data or also from generated data ? $\endgroup$ Mar 28 '18 at 12:47
  • $\begingroup$ I'd say only the original data. The augmentation should not change these statistics: by augmenting, you are generating new samples following the original data distribution. $\endgroup$ Mar 28 '18 at 15:01
  • $\begingroup$ Data augmentation doesn't change data distribution ? $\endgroup$ Mar 28 '18 at 15:19
  • $\begingroup$ Let's say there is some "original" data distribution of images, from which you generate the training sample. Augmentation creates new samples from the existing ones, but the underlying, "original" distribution of images remains unchanged. If the augmented data did not follow this distribution, it would mean you are generating invalid samples which cannot really exist, which does not help your algorithm... $\endgroup$ Mar 28 '18 at 15:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.