wenxinxu/resnet-in-tensorflow

About batch normalization

utkarshojha opened this issue · 7 comments

The batch_normalization_layer() function doesn't compute the statistics of population i.e. population mean and variance. The part implemented is only taking care of the training procedure (batch statistics), but while testing one will need the population statistics

yes, the bn implementation is wrong! please notice

agree, batch_normalization is wrong.

Thank you very much for pointing it out. I will fix it.

@wenxinxu, @utkarsh2254 @dongzhuoyao hi , so could you please tell me how to fix this bug?

hi, @WoNiuHu , you should calculate the bn' mean, variance by EMA.

here is a practical demo you can follow: https://github.com/ppwwyyxx/tensorpack/blob/master/tensorpack/models/batch_norm.py#L161

you can change tf.nn.batch_normalization to tf.layers.batch_normalization