GAN2-訓練GAN時所遇到的問題及可能的解決方法
1,模式坍塌(Mode collapse )
-
spectral collapse(譜崩潰)
-
文獻:Spectral regularization for combating mode collapse in GANs
-
程式碼:https://github.com/max-liu-112/SRGANs-Spectral-Regularization-GANs-
-
概念及定義
-
譜崩潰:當模式崩潰發生時,權重矩陣的奇異值急劇下降的現象稱為譜崩潰,作者發現模式崩潰和頻譜崩潰並存的現象普遍存在,而本文通過解決譜崩潰來解決模式崩潰問題。
-
譜歸一化權重矩陣(spectral nornalized weight matrix)\(\bar{W}_{SN}(W)\)
其中\(\sigma(W)\)是D中權重矩陣的[譜範數](https://mathworld.wolfram.com/SpectralNorm.html#:~:text=Spectral Norm. The natural norm induced by the,root of the maximum eigenvalue of %2C i.e.%2C)(
-
權重矩陣\(W\)的奇異值分解(singular value decomposition)(原文中的公式)
\[W=U\cdot\sum\cdot{V^T} \]\[U^TU=I \]\[V^TV=I \]\[\sum=[\begin{matrix}D&0\\0&0\end{matrix}] \]其中\(D=diag{\{\sigma_1,\sigma_2,\cdots,\sigma_r\}}\)
-
-
解決方案:頻譜正則化通過補償頻譜分佈避免頻譜崩潰,從而對D的權重矩陣施加約束(核心思想:防止D的權重矩陣W集中到一個方向上)。有兩種頻譜正則化方案,
-
頻譜正則化(spectral regularization)
-
靜態補償(static compensation):需要手動確定超引數\(i\),不易於應用。
\[\Delta{D}=\left[\begin{matrix}\sigma_1-\sigma_1 & 0 & \cdots & \cdots & \cdots & 0 \\ 0 & \sigma_1-\sigma_2 & \cdots & \cdots & \cdots & 0 \\ \vdots & \cdots & \ddots & \cdots & \cdots & 0\\ \vdots & \cdots & \cdots & \sigma_1-\sigma_i & \cdots & 0\\ \vdots & \cdots & \cdots & \cdots & \ddots & 0\\ 0 & \cdots & \cdots & \cdots & \cdots & 0 \end{matrix}\right] \] -
動態補償(dynamic compensation):沒有需要手動確定的超引數,相比於靜態補償使用起來更方便。
\[\Delta{D^T}=\left[\begin{matrix}0 & 0 & \cdots & 0 \\ 0 & \gamma_2^T\cdot{\sigma_1^T-\sigma_2^T} & \cdots & 0 \\ \vdots & \cdots & \ddots & 0\\ 0 & 0 & \cdots & \gamma_r^T\cdot{\sigma_1^T-\sigma_r^T} \end{matrix}\right] \]\(\Delta{D^T}\)是第\(T\)次迭代的補償矩陣,\(\gamma_j^T\)是第\(j\)個補償係數:
\[\gamma_j^T=max(\frac{\sigma_j^1}{\sigma_1^1},\cdots,\frac{\sigma_j^t}{\sigma_1^t},\cdots,\frac{\sigma_j^T}{\sigma_1^T}),t=0,1,\cdots,T \]\(\sigma_j^t\)是第\(t\)次迭代的第\(j\)個奇異值。
-
-
頻譜正則化的實現
\[\Delta{W}=U\cdot{[\begin{matrix}\Delta{D}&0\\0&0\end{matrix}]}\cdot{V^T} \]\[\bar{W}_{SR}(W)=\frac{W+\Delta{W}}{\sigma(W)}=\bar{W}_{SN}(W)+\frac{\Delta{W}}{\sigma(W)} \]
-
-