Adaptive Batch Normalization for practical domain adaptation. arXiv 1603, *ICLR 2017 Workshop*, *Pattern Recognition 2018* === [TOC] - 原始論文名:Revisiting Batch Normalization for Practical Domain Adaptation. arXiv 1603 - [中文筆記](https://zhuanlan.zhihu.com/p/56162416) ### Batch Normalization - $\hat x_j=\dfrac{x_j-\mathbb E[X_{\cdot j}]}{\sqrt{Var[X_{\cdot j}]}},\,y_j=\gamma_j\hat x_j+\beta_j$ - $x_j,y_j$:input & output scalar of $j$-th neuron in BN layer - $X\in\mathbb R^{n\times p}$:batch inputs of BN layer - $n$:batch size - $p$:feature dimension ### Algorithm ![](https://i.imgur.com/3vZ7C36.png) - $t$:target domain - $x_j(m)$:image $m$ 在 neuron $j$ 的 output (在 BN 之前) - 計算 target domain 的 BN 統計量 $\mu_j^t, \sigma_j^t$。 - 但若 data 太多,可能就沒辦法一次計算整個 target domain 的統計量,那麼就使用 batch 的方式,我們使用如 Eq. (2) (如下)方式計算 - $d=\mu-\mu_j,$ - $\mu,\sigma^2$ 是最新的 batch 的統計量 mean 和 variance - $\mu_j,\sigma_j^2$ 初始化成 0 和 1,會慢慢更新 - 所以 $d$ 就是新舊 mean 的差距 - $\mu_j\leftarrow\mu_j+\dfrac{dk}{n_j},$ - 根據這個 batch 的 data 修正 $\mu_j$ - $k$ 是這個 batch 的資料數 - $n_j$ 應該是 target domain 已經計算過的總 example 數 (所以應該初始化成 $k$ 嗎@@?) - $\sigma_j^2\leftarrow\dfrac{\sigma_j^2n_j}{n_j+k}+\dfrac{\sigma^2k}{n_j+k}+\dfrac{d^2n_jk}{(n_j+k)^2},$ - 根據這個 batch 的 data 修正 $\sigma_j^2$ 不過這裡的修正比較難懂@@ - 只看第一次更新 batch 的話就是 $\sigma_j^2\leftarrow 0+\sigma^2+0$ - $n_j\leftarrow n_j+k$ - 修正 $n_j$ <!-- - ![Eq. (2)](https://i.imgur.com/UseytGT.png) --> ### Fig. 1 ![Fig. 1](https://i.imgur.com/SEfTAeO.png) - 每個點都代表一個 mini-batch 的 statistics (應該是 mean 吧) ### Fig. 2 ![Fig. 2](https://i.imgur.com/iGZsJC2.png) - 左邊是 source domain;右邊是 target domain - 本文假設兩個 domain 各自都是由多個不同的 distribution 組成的,這些 distribution 對應到圖上的不同顏色的 curve - 圖中這句不太懂 > For each convolutional or fully connected layer, we use different bias/variance terms to perform batch normalization for the training domain and the test domain. - batch normalization 在不同 layer 不是本來就會有不同的 bias/variance 嗎? 怎麼講的好像是他們的 work ###### tags: `transfer learning` `domain adaptation`