torch_12_dataset和dataLoader,Batchnormalization解读

参考博客https://blog.csdn.net/qq_36556893/article/details/86505934

深度学习入门之pytorch https://github.com/L1aoXingyu/code-of-learn-deep-learning-with-pytorch

GANs之pytorch实现 https://github.com/eriklindernoren/PyTorch-GAN/tree/master/implementations

Batchnormalization是在batch内,对所有图像的每一个channel求均值和方差,比如输入为[B, C, H, W],则从1到B个图像,每个图像的第一个channel(一共是B个)的二维feature map上的所有元素求均值和方差(即B*H*W个像素的均值和方差),然后再计算所有图像的第二个channel的均值和方差,直到最后一个channel。所以batchnormalization中会得到C个均值和C个方差,参数是2C个(每一个channel都有其)。所谓的batch也就是指计算均值和方差是跨越image在整个batch内进行的。

原文地址:https://www.cnblogs.com/shuangcao/p/11876853.html