Search code examples
deep-learningclassificationbatch-normalization

Single Prediction when using Batch Normalization


I have a CNN that is learning pretty well on a dataset I created. I added Batch Normalization to this network to try to improve the performances.

But .. when I try to make a prediction on a single image I always end up with the same result (whatever the image). I think it is because I need batches to actually do batch normalization.

So is it possible to do a prediction on a single image with a CNN using BN ? I thought about deleting BN layers once my network is done training, is it the way to go ?

Thank you :)


Solution

  • I found the exact answer and the problem I face here : https://r2rt.com/implementing-batch-normalization-in-tensorflow.html in the "Making predictions with the model" it is explained that when using BN, during training time you need to estimate the population mean and population variance on your training set so you don't have to use batch when doing testing (which would be "cheating") :)