[解读] MSG-GAN: Multi-Scale Gradients for Generative Adversarial Networks

尽管生成对抗网络 (GANs) 在图像合成任务中取得了巨大成功, 但它们在适应不同数据集方面却异常困难, 部分原因是训练期间的不稳定以及对超参数的敏感性. 引起这种不稳定的一个普遍认为的原因是, 当真实和生成分布的支撑没有足够的重叠时, 从鉴别器到生成器的梯度将变得无用. 本文提出了多尺度梯度生成对抗网络(MSG-GAN), 这是一种简单但有效的技术, 通过允许从鉴别器到生成器的梯度流向多个尺度来解决此问题, 该技术为高分辨率图像合成提供了一种稳定的方法, 并且可以替代常用的渐进式生长技术. 实验表明 MSG-GAN 在各种大小, 分辨率和域以及各种类型的损失函数和体系结构的图像数据集上稳定收敛, 与最先进的 GAN 相比, 在大多数情况下都达到或超过了性能.

论文链接: https://arxiv.org/abs/1903.06048v3

相关工作

在训练 GAN 的过程中常遇到的一个问题是训练不够稳定, 本文提出了一种方法, 通过研究如何使用多个尺度的梯度来生成高分辨率图像 (由于数据维数而更具挑战性), 而无需依靠先前的贪婪方法 (例如渐进式生长技术[13, 14]), 来解决图像生成任务的训练不稳定性.

本文方法

如下图所示:

在这里插入图片描述

左半部分是生成器, 右半部分是鉴别器. 在生成器中, 粉色的方块是特征图, 将特征图通过 1 × 1 1 \times 1 1×1 的卷积核来生成下面的图像, 将这些图像传递到鉴别器中对应尺度的位置, 按照下面定义的 ϕ \phi ϕ 函数进行结合:

在这里插入图片描述

其中 x 1 x_1 x1 是指从生成器得到的图像, 正如流程图所示, 这个图像也可以是对真是图像经过降采样得到的. r ′ r' r 1 × 1 1 \times 1 1×1 的卷积操作. x 2 x_2 x2 是指原本鉴别器中的特征图. 经过实验表明 ϕ simple \phi_{\text {simple}} ϕsimple 生成样本质量要更好一些.

参考

  • [13 ]Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In ICLR, 2018.
  • [14] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In CVPR, pages 4401–4410, 2019.
  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
To compute the loss and gradients for a two layer fully connected neural network, we need to perform forward and backward propagation. Forward propagation: 1. Compute the scores for each class by multiplying the input data X with the weight matrix W1 and adding the bias term b1. Then apply ReLU activation function to the result. 2. Compute the scores for each class by multiplying the output of the first layer with the weight matrix W2 and adding the bias term b2. The loss function for a multi-class classification problem is usually the cross-entropy loss. Backward propagation: 1. Compute the gradient of the loss with respect to the scores of the second layer. 2. Compute the gradient of the loss with respect to the parameters of the second layer (W2 and b2). 3. Compute the gradient of the loss with respect to the output of the first layer. 4. Compute the gradient of the loss with respect to the scores of the first layer (taking into account the ReLU activation function). 5. Compute the gradient of the loss with respect to the parameters of the first layer (W1 and b1). Finally, we add the regularization term to the loss and compute the gradients with respect to the regularization term as well. Here's the code: ```python def two_layer_fc(X, params, reg=0.0): W1, b1, W2, b2 = params['W1'], params['b1'], params['W2'], params['b2'] N, D = X.shape scores = None # Forward pass hidden_layer = np.maximum(0, np.dot(X, W1) + b1) # ReLU activation scores = np.dot(hidden_layer, W2) + b2 # If y is not given, return scores if y is None: return scores # Compute the loss and gradients loss = None grads = {} # Compute the loss (data loss and regularization loss) num_classes = W2.shape[1] exp_scores = np.exp(scores) probs = exp_scores / np.sum(exp_scores, axis=1, keepdims=True) correct_logprobs = -np.log(probs[range(N),y]) data_loss = np.sum(correct_logprobs) / N reg_loss = 0.5 * reg * (np.sum(W1*W1) + np.sum(W2*W2)) loss = data_loss + reg_loss # Compute the gradients dscores = probs dscores[range(N),y] -= 1 dscores /= N dW2 = np.dot(hidden_layer.T, dscores) db2 = np.sum(dscores, axis=0, keepdims=True) dhidden = np.dot(dscores, W2.T) dhidden[hidden_layer <= 0] = 0 dW1 = np.dot(X.T, dhidden) db1 = np.sum(dhidden, axis=0, keepdims=True) # Add regularization gradient contribution dW2 += reg * W2 dW1 += reg * W1 # Store gradients in dictionary grads['W1'] = dW1 grads['b1'] = db1 grads['W2'] = dW2 grads['b2'] = db2 return loss, grads ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值