243

Batch normalization和Instance normalization的对比? - 知乎

 6 years ago
source link: https://www.zhihu.com/question/68730628
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Batch normalization和Instance normalization的对比?

10 个回答

机器学习等 3 个话题下的优秀答主

私以为对这个的理解还是比较透彻的,恰好我们有几篇paper其实都是和这个问题相关的,所以来简答一下,希望能够帮助大家梳理清楚背后的本质。
BN和IN其实本质上是同一个东西,只是IN是作用于单张图片,但是BN作用于一个batch。但是为什么IN还会被单独提出,而且在Style Transfer的这个任务中大放异彩呢?简言之,这背后的逻辑链是这样的:
1. 通过调整BN统计量,或学习的参数beta和gamma,BN可以用来做domain adaptation。[1]
2. Style Transfer是一个把每张图片当成一个domain的domain adaptation问题。[2]
这恰恰分别对应了我和一位优秀实习生的两篇paper。以上其实都是对paper的一句话总结,下面稍微展开说一下具体内容。TLDR

在[1]中,我们提出了一个叫做adaBN的方法来做domain adaptation。其实adaBN做的事情看上去非常trivial:在拓展到未知的domain的时候,将BN的统计量在这个domain的unlabel data上重新计算一遍。如果用现有deep learning框架去实现的话,只需要一行就够。但是这样一个操作,可以带来相当显著的性能提升。究其原因,其实BN在做的事情就是将每个batch的数据归一化到standard Gaussian。我们在不同数据上计算统计量,可以将不同domain的数据分布的差异归一。

在[2]中,我们从style transfer中使用的Gram matrix出发,试图解释为什么Gram matrix可以代表一个图片的style这个问题。这是我看完style transfer的paper后感觉最为迷惑的一点。一个偶然的机会,我们发现这个匹配两张图的Gram matrix,其实数学上严格等价于极小化这两张图deep activation的2nd poly kernel的MMD距离。其中,MMD距离是用来通过从两个分布中sample的样本来衡量两个分布之间的差异的一种度量。所以本质上,style transfer这个paper做的事情就是将生成图片的deep activation分布和style image的分布进行匹配。这其实可以认为是一个domain adaptation的问题。所以很自然我们可以使用类似于adaBN的想法去做这件事情。这后续有一系列的工作拓展了这个想法,包括adaIN[3]以及若干基于GAN去做style transfer的工作。

不得不说,想明白这些之后,再去看style transfer的paper有一种神清气爽的感觉。我想这也就是我们要去探究“炼金术”背后的原理的一大原因。站在更general更高的角度去看待这些问题真的是一件让人身心愉悦的事情,而且很多后续的extension都是非常的直观。 :-)

[1] Li, Yanghao, Naiyan Wang, Jianping Shi, Jiaying Liu, and Xiaodi Hou. "Revisiting batch normalization for practical domain adaptation." arXiv preprint arXiv:1603.04779 (2016).
[2] Li, Yanghao, Naiyan Wang, Jiaying Liu, and Xiaodi Hou. "Demystifying neural style transfer." arXiv preprint arXiv:1701.01036 (2017).
[3] Huang, Xun, and Serge Belongie. "Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization." arXiv preprint arXiv:1703.06868 (2017).


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK