1
$\begingroup$

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

$\endgroup$
2
$\begingroup$

You can use both methods, in the vast majority of examples I have seen and worked with the usual order is.

  1. Augmentate your data, rotations, zoomings, flips....
  2. Normalize your images based on the new and augmented dataset.

Doing it like this you can also see the results of the augmentation phase, while if you normalize it first you cannot visualize it

| improve this answer | |
$\endgroup$
  • $\begingroup$ By taking into account generated data for compute normalization, it means that augmentation must be done before training and not allow to do it in real time (space constraint). Moreover it means that validation set will be normalized from a different distribution, can it cause problems ? $\endgroup$ – alexandre_d Mar 28 '18 at 15:17
0
$\begingroup$

Normalisation helps your neural net because it ensures that your input data always is within certain numeric boundaries, basically making it easier for the network to work with the data and to treat data samples equally. Augmentation creates "new" data samples that should be ideally as close as possible to "real" rather than synthetic data points. Therefore:

  1. Apply augmentation to create synthetic data.
  2. Apply pre-processing on the whole data set.

I think in practice it sometimes actually doesn't matter in which order you do it. Depending on which transformations you apply to the images they might still be normalized afterwards (e.g. if they are mirrored).

Effect on distribution

A concern could be that the augmentation messes with the distribution of your data. However, it is likely that you perform linear transformations on your images. When your data is initially in a Gaussian distribution it will remain so after the transformation as explained by this paper.

| improve this answer | |
$\endgroup$
  • $\begingroup$ By taking into account generated data for compute normalization, it means that augmentation must be done before training and not allow to do it in real time (space constraint). Moreover it means that validation set will be normalized from a different distribution, can it cause problems ? $\endgroup$ – alexandre_d Mar 28 '18 at 15:17

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.