说明:
- 生成器基本结构都是卷积网络
- 缩写含义:SN - 谱归一化(Spectral Normalization);EMA - 权重滑动平均(Exponential Moving Average)
- 训练数据集使用CASIA-maxpy-clean,去除单色图片
iter 3000 |
iter 5000 |
![dcgan_reg_3000](keras/results/dcgan_reg_3000.png) |
![dcgan_reg_5000](keras/results/dcgan_reg_5000.png) |
iter 3000 |
iter 5000 |
![dcgan_reg_ema_3000](keras/results/dcgan_reg_ema_3000.png) |
![dcgan_reg_ema_5000](keras/results/dcgan_reg_ema_5000.png) |
iter 3000 |
iter 5000 |
![dcgan_sn_3000](keras/results/dcgan_sn_3000.png) |
![dcgan_sn_5000](keras/results/dcgan_sn_5000.png) |
iter 3000 |
iter 5000 |
![dcgan_sn_ema_3000](keras/results/dcgan_sn_ema_3000.png) |
![dcgan_sn_ema_5000](keras/results/dcgan_sn_ema_5000.png) |
iter 3000 |
iter 5000 |
![rsgan_sn_3000](keras/results/rsgan_sn_3000.png) |
![rsgan_sn_5000](keras/results/rsgan_sn_5000.png) |
iter 3000 |
iter 5000 |
![wgan_sn_3000](keras/results/wgan_sn_3000.png) |
![wgan_sn_5000](keras/results/wgan_sn_5000.png) |
iter 3000 |
iter 5000 |
![wgan_gp_3000](keras/results/wgan_gp_3000.png) |
![wgan_gp_5000](keras/results/wgan_gp_5000.png) |
iter 3000 |
iter 5000 |
![wgan_div_3000](keras/results/wgan_div_3000.png) |
![wgan_div_5000](keras/results/wgan_div_5000.png) |
iter 3000 |
iter 5000 |
![gan_qp_l1_3000](keras/results/gan_qp_l1_3000.png) |
![gan_qp_l1_5000](keras/results/gan_qp_l1_5000.png) |
iter 3000 |
iter 5000 |
![gan_qp_l1_ema_3000](keras/results/gan_qp_l1_ema_3000.png) |
![gan_qp_l1_ema_5000](keras/results/gan_qp_l1_ema_5000.png) |
iter 3000 |
iter 5000 |
![gan_qp_l2_3000](keras/results/gan_qp_l2_3000.png) |
![gan_qp_l2_5000](keras/results/gan_qp_l2_5000.png) |
iter 3000 |
iter 5000 |
![gan_qp_l2_ema_3000](keras/results/gan_qp_l2_ema_3000.png) |
![gan_qp_l2_ema_5000](keras/results/gan_qp_l2_ema_5000.png) |
运行参数:
img_img_dim = 64
z_dim = 100
L1_or_L2 = 'L1'
batch_size = 64
|
iter 10000 |
无EMA |
![gan_qp_l1_256_10000](keras/results/gan_qp_l1_256_10000.png) |
EMA |
![gan_qp_l1_ema_256_10000](keras/results/gan_qp_l1_ema_256_10000.png) |
在Keras 2.3.1使用权重滑动平均(EMA)的patch
diff --git a/keras/engine/training.py b/keras/engine/training.py
index 0a556f21..1a9a374e 100644
--- a/keras/engine/training.py
+++ b/keras/engine/training.py
@@ -328,7 +328,7 @@ class Model(Network):
self.train_function = K.function(
inputs,
[self.total_loss] + metrics_tensors,
- updates=updates + metrics_updates,
+ updates=updates + metrics_updates + (self._other_metrics if hasattr(self, '_other_metrics') else []),
name='train_function',
**self._function_kwargs)
EMA的实现见keras/utils.py
中ExponentialMovingAverage
。使用EMA的例子见keras/dcgan_sn_ema.py
。
最新代码中的EMA已不需要此patch