Improved Consistency Regularization for GANs , 2020
Improved Consistency Regularization for GANs
GAN에 대한 향상된 일관성 정규화
Recent work (Zhang 2020) has increased the performance of Generative Adversarial Networks (GANs) by enforcing a consistency cost on the discriminator.
We improve on this technique in several ways.
We first show that consistency regularization can introduce artifacts into the GAN samples and explain how to fix this issue.
We then propose several modifications to the consistency regularization procedure designed to improve its performance.
We carry out extensive experiments quantifAying the benefit of our improvements.
For unconditional image synthesis on CIFAR-10 and CelebA, our modifications yield the best known FID scores on various GAN architectures.
For conditional image synthesis on CIFAR-10, we improve the state-of-the-art FID score from 11.48 to 9.21.
Finally, on ImageNet-2012, we apply our technique to the original BigGAN (Brock, Donahue, and Simonyan 2019) model and improve the FID from 6.66 to 5.38, which is the best score at that model size.
최근 작업 (Zhang 2020)은 판별 자에 대한 일관성 비용을 적용하여 GAN (Generative Adversarial Network)의 성능을 향상 시켰습니다. 이 기술을 여러 가지 방법으로 개선합니다. 먼저 일관성 정규화가 GAN 샘플에 아티팩트를 도입 할 수 있음을 보여주고이 문제를 해결하는 방법을 설명합니다. 그런 다음 성능 향상을 위해 설계된 일관성 정규화 절차에 대한 몇 가지 수정 사항을 제안합니다. 우리는 개선의 이점을 정량화하는 광범위한 실험을 수행합니다. CIFAR-10 및 CelebA에서 무조건 이미지 합성을 위해 수정하면 다양한 GAN 아키텍처에서 가장 잘 알려진 FID 점수가 산출됩니다. CIFAR-10의 조건부 이미지 합성을 위해 최첨단 FID 점수를 11.48에서 9.21로 개선했습니다. 마지막으로 ImageNet-2012에서는 기존 BigGAN (Brock, Donahue 및 Simonyan 2019) 모델에 우리의 기술을 적용하고 FID를 6.66에서 5.38로 개선하여 해당 모델 크기에서 최고 점수입니다.
1 Introduction
Generative Adversarial Networks (GANs; Goodfellow 2014) are a powerful class of deep generative models, but are known for training difficulties (Salimans 2016).
Many approaches have been introduced to improve GAN performance (Arjovsky, Chintala, and Bottou 2017; Gulrajani 2017; Miyato 2018a; Sinha 2020).
Recent work (Wei 2018; Zhang 2020) suggests that the performance of generative models can be improved by introducing consistency regularization techniques – which are popular in the semi-supervised learning literature (Oliver 2018).
In particular, Zhang (2020) show that Generative Adversarial Networks (GANs) (Goodfellow 2014) augmented with consistency regularization can achieve state-of-the-art image-synthesis results.
In CR-GAN, real images and their corresponding augmented counterparts are fed into the discriminator.
The discriminator is then encouraged — via an auxiliary loss term — to produce similar outputs for an image and its corresponding augmentation.
Though the consistency regularization in CR-GAN is effective, the augmentations are only applied to the real images and not to generated samples, making the whole procedure somewhat imbalanced.
Generative Adversarial Networks (GANs, Goodfellow 2014)는 강력한 심층 생성 모델 클래스이지만 훈련 문제로 유명합니다 (Salimans 2016). GAN 성능을 개선하기 위해 많은 접근 방식이 도입되었습니다 (Arjovsky, Chintala 및 Bottou 2017, Gulrajani 2017, Miyato 2018a, Sinha 2020). 최근 연구 (Wei 2018, Zhang 2020)는 반지도 학습 문헌 (Oliver 2018)에서 인기있는 일관성 정규화 기술을 도입하여 생성 모델의 성능을 향상시킬 수 있음을 시사합니다. 특히 Zhang (2020)은 일관성 정규화로 증강 된 GAN (Generative Adversarial Networks) (Goodfellow 2014)이 최첨단 이미지 합성 결과를 얻을 수 있음을 보여줍니다. CR-GAN에서는 실제 이미지와 그에 상응하는 증강된 이미지가 판별기에 입력됩니다. 그런 다음 판별자는 이미지 및 해당 확대에 대해 유사한 출력을 생성하도록 보조 손실 항을 통해 권장됩니다. CR-GAN의 일관성 정규화가 효과적이지만 증가는 실제 이미지에만 적용되고 생성 된 샘플에는 적용되지 않으므로 전체 절차가 다소 불균형하게됩니다.
In particular, the generator can learn these artificial augmentation features and introduce them into generated samples as undesirable artifacts.
Further, by regularizing only the discriminator, and by only using augmentations in image space, the regularizations in Wei (2018) and Zhang (2020) do not act directly on the generator.
By constraining the mapping from the prior to the generated samples, we can achieve further performance gains on top of those yielded by performing consistency regularization on the discriminator in the first place.
In this work, we introduce Improved Consistency Regularization (ICR) which applies forms of consistency regularization to the generated images, the latent vector space, and the generator.
First, we address the lack of regularization on the generated samples by introducing balanced consistency regularization (bCR), where a consistency term on the discriminator is applied to both real images and samples coming from the generator.
Second, we introduce latent consistency regularization (zCR), which incorporates regularization terms modulating the sensitivity of both the generator and discriminator changes in the prior.
In particular, given augmented/perturbed latent vectors, we show that it is helpful to encourage the generator to be sensitive to the perturbations and the discriminator to be insensitive.
We combine bCR and zCR, and call it Improved Consistency Regularization (ICR). ICR yields state-of-the-art image synthesis results.
For unconditional image synthesis on CIFAR-10 and CelebA, our method yields the best known FID scores on various GAN architectures.
For conditional image synthesis on CIFAR-10, we improve the state-of-the-art FID score from 11.48 to 9.21. Finally, on ImageNet-2012, we apply our technique to the original BigGAN (Brock, Donahue, and Simonyan 2019) model and improve the FID from 6.66 to 5.38, which is the best score at that model size.
특히 생성기는 이러한 인공 증강 기능을 학습하여 생성 된 샘플에 바람직하지 않은 인공물로 도입 할 수 있습니다.
또한 판별자만 정규화하고 이미지 공간에서 증가 만 사용함으로써 Wei (2018)와 Zhang (2020)의 정규화가 생성자에 직접 작용하지 않습니다.
생성된 샘플 이전의 매핑을 제한함으로써 처음에 판별 기에서 일관성 정규화를 수행하여 얻은 결과에 추가로 성능 향상을 얻을 수 있습니다.
이 작업에서는 생성 된 이미지, 잠재 벡터 공간 및 생성기에 일관성 정규화 형식을 적용하는 향상된 일관성 정규화 (ICR)를 소개합니다.
먼저, 판별 기의 일관성 항이 실제 이미지와 생성기에서 나오는 샘플 모두에 적용되는 균형 일관성 정규화 (bCR)를 도입하여 생성 된 샘플에 대한 정규화 부족을 해결합니다.
둘째, 이전의 생성자와 판별 자 변경의 민감도를 조정하는 정규화 용어를 통합하는 잠복 일관성 정규화 (zCR)를 소개합니다. 특히, 증강 / 교란 된 잠복 벡터가 주어지면 발전기가 교란에 민감하고 판별자가 민감하지 않도록 장려하는 것이 도움이됨을 보여줍니다.
bCR과 zCR을 결합하여 ICR (개선 된 일관성 정규화)이라고합니다. ICR은 최첨단 이미지 합성 결과를 제공합니다.
CIFAR-10 및 CelebA에서 무조건 이미지 합성을 위해 우리의 방법은 다양한 GAN 아키텍처에서 가장 잘 알려진 FID 점수를 산출합니다. CIFAR-10의 조건부 이미지 합성을 위해 최첨단 FID 점수를 11.48에서 9.21로 개선했습니다. 마지막으로 ImageNet-2012에서는 기존 BigGAN (Brock, Donahue 및 Simonyan 2019) 모델에 우리의 기술을 적용하고 FID를 6.66에서 5.38로 개선하여 해당 모델 크기에서 최고 점수입니다.
2 Improved Consistency Regularization 향상된 일관성 정규화
For semi-supervised or unsupervised learning, consistency regularization techniques are effective and have become broadly used recently (Sajjadi, Javanmardi, and Tasdizen 2016; Laine and Aila 2016; Zhai 2019; Xie 2019; Berthelot 2019).
The intuition behind these techniques is to encode into model training some prior knowledge: that the model should produce consistent predictions given in put instances and their semantics-preserving augmentations.
The augmentations (or transformations) can take many forms, such as image flipping and rotating, sentence back-translating, or even adversarial attacks. Penalizing the inconsistency can be easily achieved by minimizing L2 loss (Sajjadi, Javanmardi, and Tasdizen 2016; Laine and Aila 2016) between instance pairs, or KL-divergence loss (Xie 2019; Miyato 2018b) between distributions.
In the GAN literature, Wei (2018) propose a consistency term derived from Lipschitz continuity considerations to improve the training of WGAN.
Recently, CR-GAN (Zhang 2020) applies consistency regularization to the discriminator and achieves substantial improvements.
Below we start by introducing our two new techniques, abbreviated as bCR and zCR, to improve and generalize CR for GANs.
We denote the combination of both of these techniques as ICR, and we will later show that ICR yields state-of-the-art image synthesis results in a variety of settings.
Figure 1 shows illustrations comparing our methods to the baseline CR-GAN Zhang (2020).
준지도 또는 비지도 학습의 경우 일관성 정규화 기술이 효과적이며 최근에 광범위하게 사용되었습니다 (Sajjadi, Javanmardi 및 Tasdizen 2016, Laine and Aila 2016, Zhai 2019, Xie 2019, Berthelot 2019). 이러한 기술의이면에있는 직관은 모델 학습에 몇 가지 사전 지식을 인코딩하는 것입니다. 즉, 모델은 풋 인스턴스와 의미를 보존하는 증강에 주어진 일관된 예측을 생성해야합니다. 증강 (또는 변형)은 이미지 뒤집기 및 회전, 문장 역 번역 또는 적대적 공격과 같은 다양한 형태를 취할 수 있습니다. 불일치에 대한 페널티는 인스턴스 쌍 간의 L2 손실 (Sajjadi, Javanmardi 및 Tasdizen 2016, Laine 및 Aila 2016) 또는 배포 간의 KL- 분기 손실 (Xie 2019, Miyato 2018b)을 최소화하여 쉽게 달성 할 수 있습니다. GAN 문헌에서 Wei (2018)는 WGAN의 훈련을 개선하기 위해 Lipschitz 연속성 고려 사항에서 파생 된 일관성 용어를 제안합니다. 최근 CR-GAN (Zhang 2020)은 판별 자에 일관성 정규화를 적용하고 상당한 개선을 달성했습니다. 아래에서는 GAN 용 CR을 개선하고 일반화하기 위해 bCR 및 zCR로 축약되는 두 가지 새로운 기술을 소개합니다. 우리는이 두 기술의 조합을 ICR로 표시하고 나중에 ICR이 다양한 설정에서 최첨단 이미지 합성 결과를 산출한다는 것을 보여줄 것입니다. 그림 1은 우리의 방법을 기준 CR-GAN Zhang (2020)과 비교 한 그림을 보여줍니다.
2.1 Balanced Consistency Regularization (bCR)
Figure 1(1) illustrates the baseline CR-GAN, in which a term is added to the discriminator loss function that penalizes its sensitivity to the difference between the original image x and the augmented image T(x).
One key problem with the original CR-GAN is that the discriminator might ‘mistakenly believe’ that the augmentations are actual features of the target data set, since these augmentations are only performed on the real images.
This phenomenon, which we refer to as consistency imbalance, is not easy to notice for certain types of augmentation (e.g. image shifting and flipping).
However, it can result in generated samples with explicit augmentation artifacts when augmented samples contain visual artifacts not belonging to real images.
그림 1 (1)은 원본 이미지 x와 증강 이미지 T (x) 간의 차이에 대한 민감도에 페널티를주는 판별 기 손실 함수에 항이 추가 된 기준 CR-GAN을 보여줍니다. 원래 CR-GAN의 주요 문제 중 하나는 이러한 증강이 실제 이미지에서만 수행되기 때문에 판별자가 증강이 대상 데이터 세트의 실제 특징이라고 '오도하게 믿'을 수 있다는 것입니다. 일관성 불균형이라고하는이 현상은 특정 유형의 확대 (예 : 이미지 이동 및 뒤집기)에서 쉽게 알아 차릴 수 없습니다. 그러나 증강 샘플에 실제 이미지에 속하지 않는 시각적 아티팩트가 포함 된 경우 명시 적 증강 아티팩트가있는 샘플이 생성 될 수 있습니다.
For example, we can easily observe this effect for CR-GAN with cutout augmentation: see the second column in Figure 5.
This undesirable effect greatly limits the choice of advanced augmentations we could use.
In order to correct this issue, we propose to also augment generated samples before they are fed into the discriminator, so that the discriminator will be evenly regularized with respect to both real and fake augmentations and thereby be encouraged to focus on meaningful visual information.
Specifically, a gradient update step will involve four batches, a batch of real images x, augmentations of these real images T(x), a batch of generated samples G(z), and that same batch with augmentations T(G(z)).
The discriminator will have terms that penalize its sensitivity between corresponding {x, T(x)} and also {G(z), T(G(z))}, while the generator cost remains unmodified.
This technique is described in more detail in Algorithm 1 and visualized in Figure 1(2).
We abuse the notation a little in the sense that D(x) denotes the output vector before activation of the last layer of the discriminator given input z.
T(x) denotes an augmentation transform, here for images (e.g. shift, flip, cutout, etc).
The consistency regularization can be balanced by adjusting the strength of λreal and λfake.
This proposed bCR technique not only removes augmentation artifacts (see third column of Figure 5), but also brings substantial performance improvement (see Section 3 and 4).
예를 들어, 컷 아웃 확대를 통해 CR-GAN에 대한이 효과를 쉽게 관찰 할 수 있습니다. 그림 5의 두 번째 열을 참조하십시오. 이 바람직하지 않은 효과는 우리가 사용할 수있는 고급 증강의 선택을 크게 제한합니다. 이 문제를 해결하기 위해, 우리는 생성 된 샘플이 판별기에 공급되기 전에 증가시켜 실제 및 가짜 증가에 대해 판별 기가 균일하게 정규화되어 의미있는 시각 정보에 집중할 수 있도록 권장합니다. 특히, 그라디언트 업데이트 단계에는 4 개의 배치, 실제 이미지의 배치 x, 이러한 실제 이미지의 증가 T (x), 생성 된 샘플 배치 G (z) 및 증가 T (G (z))가있는 동일한 배치가 포함됩니다. ). 판별자는 해당 {x, T (x)} 및 {G (z), T (G (z))} 사이의 민감도에 불이익을주는 조건을 가지게되며 생성기 비용은 수정되지 않습니다. 이 기술은 알고리즘 1에 자세히 설명되어 있으며 그림 1 (2)에 시각화되어 있습니다. D (x)가 입력 z가 주어진 판별 기의 마지막 레이어를 활성화하기 전에 출력 벡터를 나타낸다는 점에서 표기법을 약간 남용합니다. T (x)는 이미지 (예 : 이동, 뒤집기, 잘라 내기 등)에 대한 확대 변환을 나타냅니다. 일관성 정규화는 λreal 및 λfake의 강도를 조정하여 균형을 맞출 수 있습니다. 이 제안 된 bCR 기술은 증강 아티팩트를 제거 할뿐만 아니라 (그림 5의 세 번째 열 참조) 상당한 성능 향상을 가져옵니다 (섹션 3 및 4 참조).
2.2 Latent Consistency Regularization (zCR) 잠복 일관성 정규화 (zCR)
In Section 2.1, we focus on consistency regularization with respect to augmentations in image space on the inputs to the discriminator.
In this section, we consider a different question: Would it help if we enforce consistency regularization on augmentations in latent space (Zhao, Dua, and Singh 2018)?
Given that a GAN model consists of both a generator and a discriminator, it seems reasonable to ask if techniques that can be applied to the discriminator can also be effectively applied to the generator in certain analogous way.
Towards this end, we propose to augment inputs to the generator by slightly perturbing draws z from the prior to yield T(z) = z + ∆z, ∆z ∼ N (0, σnoise). Assuming the perturbations ∆z are small enough, we expect that output of the discriminator ought not to change much with respect to this perturbation and modify the discriminator loss by enforcing kD(G(z)) − D(G(T(z)))k 2 is small.
섹션 2.1에서는 판별기에 대한 입력에 대한 이미지 공간의 증가와 관련된 일관성 정규화에 중점을 둡니다. 이 섹션에서는 다른 질문을 고려합니다. 잠재 공간 (Zhao, Dua 및 Singh 2018)에서 증가에 대한 일관성 정규화를 적용하면 도움이 될까요? GAN 모델이 생성기와 판별기로 구성되어 있다는 점을 감안할 때 판별기에 적용 할 수있는 기술이 특정 유사한 방식으로 생성기에 효과적으로 적용될 수 있는지 묻는 것이 합리적입니다. 이를 위해, 우리는 T (z) = z + ∆z, ∆z ∼ N (0, σnoise)를 산출하기 전에 z를 약간 섭동하여 생성기에 대한 입력을 증가시킬 것을 제안합니다. 섭동 ∆z가 충분히 작다고 가정하면 판별 기의 출력이이 섭동에 대해 많이 변하지 않아야하며 kD (G (z)) − D (G (T (z))를 적용하여 판별 기 손실을 수정해야합니다. ) k 2는 작습니다.
However, with only this term added onto the GAN loss, the generator would be prone to collapse to generating specific samples for any latent z, since that would easily satisfy the constraint above.
To avoid this, we also modify the loss function for the generator with a term that maximizes the difference between G(z) and G(T(z)), which also encourages generations from similar latent vectors to be diverse.
Though motivated differently, this can be seen as related to the Jacobian Clamping technique from Odena (2018) and diversity increase technique in Yang (2019).
This method is described in more detail in Algorithm 2 and visualized in Figure 1(3).
G(z) denotes the output images of the generator given input z.
T(x) denotes an augmentation transform, here for latent vectors (e.g. adding small perturbation noise).
The strength of consistency regularization for the discriminator can be adjusted via λdis.
From the view of the generator, intuitively, the term Lgen = −kG(z)−G(T(z))k 2 encourages {G(z), G(T(z))} to be diverse.
We have conducted analysis on the effect of λgen with experiments in Section 4.3.
This technique substantially improves the performance of GANs, as measured by FID.
We present experimental results in Section 3 and 4.
그러나이 용어 만 GAN 손실에 추가되면 생성기는 위의 제약 조건을 쉽게 충족 할 수 있기 때문에 잠재 z에 대한 특정 샘플을 생성하는 것으로 붕괴되는 경향이 있습니다. 이를 방지하기 위해 G (z)와 G (T (z)) 간의 차이를 최대화하는 항을 사용하여 생성기에 대한 손실 함수를 수정하여 유사한 잠재 벡터의 세대가 다양해 지도록 장려합니다. 동기는 다르지만 이것은 Odena (2018)의 Jacobian Clamping 기법과 Yang (2019)의 다양성 증가 기법과 관련이있는 것으로 볼 수 있습니다. 이 방법은 알고리즘 2에 자세히 설명되어 있으며 그림 1 (3)에 시각화되어 있습니다. G (z)는 입력 z가 주어진 생성기의 출력 이미지를 나타냅니다. T (x)는 여기에서 잠복 벡터 (예 : 작은 섭동 노이즈 추가)에 대한 증가 변환을 나타냅니다. 판별 자에 대한 일관성 정규화의 강도는 λdis를 통해 조정할 수 있습니다. 생성기의 관점에서 직관적으로 Lgen = −kG (z) −G (T (z)) k 2라는 용어는 {G (z), G (T (z))}가 다양해 지도록 장려합니다. 4.3 절에서 실험을 통해 λgen의 효과에 대한 분석을 수행했습니다. 이 기술은 FID로 측정 한 GAN의 성능을 크게 향상시킵니다. 우리는 섹션 3과 4에서 실험 결과를 제시합니다.
2.3 Putting it All Together (ICR)
Though both Balanced Consistency Regularization and Latent Consistency Regularization improve GAN performance (see Section 3), it is not obvious that they would work when ‘stacked on top’ of each other.
That is, maybe they are accomplishing the same thing in different ways, and we cannot add up their benefits.
However, validated with extensive experiments, we achieve the best experimental results when combining Algorithm 1 and Algorithm 2 together.
We call this combination Improved Consistency Regularization (ICR).
Note that in ICR, we augment inputs in both image and latent spaces, and add regularization terms to both the discriminator and the generator.
We regularize the discriminator’s consistency between corresponding pairs of {D(x), D(T(x))}, {D(G(z)), D(T(G(z)))}, and {D(G(z)), D(G(T(z)))};
For the generator, we encourage diversity between {G(z), G(T(z))}.
Balanced Consistency Regularization과 Latent Consistency Regularization은 모두 GAN 성능을 향상 시키지만 (섹션 3 참조) 서로 '스택'될 때 작동할지 여부는 분명하지 않습니다. 즉, 그들은 다른 방법으로 같은 일을 수행하고 있고 우리는 그들의 이점을 더할 수 없습니다. 그러나 광범위한 실험을 통해 검증 된 알고리즘 1과 알고리즘 2를 함께 결합하면 최상의 실험 결과를 얻을 수 있습니다. 이 조합을 ICR (개선 된 일관성 정규화)이라고합니다. ICR에서는 이미지와 잠복 공간 모두에서 입력을 늘리고 판별 기와 생성기에 정규화 항을 추가합니다. {D (x), D (T (x))}, {D (G (z)), D (T (G (z))} 및 {D (G)의 해당 쌍 간의 판별 기 일관성을 정규화합니다. (z)), D (G (T (z)))}; 생성기의 경우 {G (z), G (T (z))} 간의 다양성을 권장합니다.
3 Experiments
In this section, we validate our methods on different data sets, model architectures, and GAN loss functions.
We compare both Balanced Consistency Regularization (Algorithm 1) and Latent Consistency Regularization (Algorithm 2) with several baseline methods.
We also combine both techniques (we abbreviate this combination as ICR) and show that this yields state-of-the-art FID numbers.
We follow the best experimental practices established in Kurach (2019), aggregating all runs and reporting the FID distribution of the top 15% of trained models.
We provide both quantitative and qualitative results (with more in the appendix).
이 섹션에서는 다양한 데이터 세트, 모델 아키텍처 및 GAN 손실 함수에 대한 방법을 검증합니다. Balanced Consistency Regularization (알고리즘 1)과 잠재 일관성 정규화 (알고리즘 2)를 여러 기준 방법과 비교합니다. 또한 두 기술을 결합하고 (이 조합을 ICR로 약칭 함) 이것이 최첨단 FID 번호를 산출 함을 보여줍니다. 우리는 Kurach (2019)에서 확립 된 모범 실험 관행을 따르고 모든 실행을 집계하고 훈련 된 모델의 상위 15 %에 대한 FID 분포를보고합니다. 우리는 정량적 및 정 성적 결과를 모두 제공합니다 (추가 정보는 부록 참조).
3.1 Baseline Methods
We compare our methods with four GAN regularization techniques: Gradient Penalty (GP) (Gulrajani 2017), DRAGAN (DR) (Kodali 2017), Jensen-Shannon Regularizer (JSR) (Roth 2017), and vanilla Consistency Regularization (CR) (Zhang 2020).
The regularization strength λ is set to 0.1 for JSR, and 10 for all others.
Following the procedures from Lucic (2018); Kurach (2019), we evaluate these methods across different data sets, neural architectures, and loss functions.
For optimization, we use the Adam optimizer with batch size of 64 for all experiments.
By default, spectral normalization (SN) (Miyato 2018a) is used in the discriminator, as it is the most effective normalization method for GANs (Kurach 2019) and is becoming the standard for recent GANs (Brock, Donahue, and Simonyan 2019; Wu 2019).
Gradient Penalty (GP) (Gulrajani 2017), DRAGAN (DR) (Kodali 2017), Jensen-Shannon Regularizer (JSR) (Roth 2017), vanilla Consistency Regularization (CR) (Zhang)의 네 가지 GAN 정규화 기술과 방법을 비교합니다. 2020). 정규화 강도 λ는 JSR의 경우 0.1로 설정되고 다른 모든 경우에는 10으로 설정됩니다. Lucic (2018)의 절차를 따릅니다. Kurach (2019)는 다양한 데이터 세트, 신경 아키텍처 및 손실 함수에서 이러한 방법을 평가합니다. 최적화를 위해 모든 실험에 대해 배치 크기가 64 인 Adam 최적화 프로그램을 사용합니다. 기본적으로 스펙트럼 정규화 (SN) (Miyato 2018a)는 GAN (Kurach 2019)에 대한 가장 효과적인 정규화 방법이며 최근 GAN (Brock, Donahue 및 Simonyan 2019; Wu 2019).
3.2 Data Sets and Evaluation
We carry out extensive experiments comparing our methods against the above baselines on three commonly used data sets in the GAN literature: CIFAR-10 (Krizhevsky, Hinton 2009), CelebA-HQ-128 (Karras 2018), and ImageNet2012 (Russakovsky 2015).
For data set preparation, we follow the detailed procedures in Kurach (2019). CIFAR-10 contains 60K 32 × 32 images with 10 labels, out of which 50K are used for training and 10K are used for testing.
CelebA-HQ-128 (CelebA) consists of 30K 128×128 facial images, out of which we use 3K images for testing and train models with the rest. ImageNet2012 has approximately 1.2M images with 1000 labels, and we down-sample the images to 128 × 128. We stop training after 200k generator update steps for CIFAR-10, 100k steps for CelebA, and 250k for ImageNet.
We use the Frechet Inception Distance (FID) (Heusel ´ 2017) as the primary metric for quantitative evaluation.
FID has been shown to correlate well with human evaluation of image quality and to be helpful in detecting intra-class mode collapse.
We calculate FID between generated samples and real test images, using 10K images on CIFAR-10, 3K on CelebA, and 50K on ImageNet.
GAN 문헌에서 일반적으로 사용되는 세 가지 데이터 세트 인 CIFAR-10 (Krizhevsky, Hinton 2009), CelebA-HQ-128 (Karras 2018) 및 ImageNet2012 (Russakovsky 2015)에 대해 위의 기준과 비교하는 광범위한 실험을 수행합니다. 데이터 세트 준비를 위해 Kurach (2019)의 세부 절차를 따릅니다. CIFAR-10에는 10 개의 레이블이있는 60K 32 × 32 이미지가 포함되어 있으며이 중 50K는 교육에 사용되고 10K는 테스트에 사용됩니다. CelebA-HQ-128 (CelebA)은 30K 128x128 얼굴 이미지로 구성되며,이 중 3K 이미지를 사용하여 나머지 모델을 테스트하고 학습시킵니다. ImageNet2012에는 1000 개의 레이블이있는 약 120 만 개의 이미지가 있으며 이미지를 128 × 128로 다운 샘플링합니다. CIFAR-10의 경우 생성기 업데이트 단계 200,000 개, CelebA의 경우 10 만 단계, ImageNet의 경우 250k 후에 학습을 중지합니다. FID (Frechet Inception Distance) (Heusel ´ 2017)를 정량적 평가를위한 기본 측정 항목으로 사용합니다. FID는 이미지 품질에 대한 사람의 평가와 잘 연관되고 클래스 내 모드 붕괴를 감지하는 데 도움이되는 것으로 나타났습니다. CIFAR-10의 10K 이미지, CelebA의 3K, ImageNet의 50K를 사용하여 생성 된 샘플과 실제 테스트 이미지 간의 FID를 계산합니다.
We also report Inception Scores (Salimans 2016) in the appendix.
By default, the augmentation transform T on latent vectors z is adding Gaussian noise ∆z ∼ N (0, σnoise).
The augmentation transform T on images is a combination of randomly flipping horizontally and shifting by multiple pixels (up to 4 for CIFAR-10 and CelebA, and up to 16 for ImageNet).
This transform combination results in better performance than alternatives (see Zhang (2020)).
Though we outperform CRGAN for different augmentation strategies, we use the same image augmentation strategies as the best one (random flip and shift) in CRGAN for comparison.
There are many different GAN loss functions and we elaborate on several of them in Section A.
Following Zhang (2020), for each data set and model architecture combination, we conduct experiments using the loss function that achieves the best performance on baselines.
CIFAR-10의 10K 이미지, CelebA의 3K, ImageNet의 50K를 사용하여 생성 된 샘플과 실제 테스트 이미지 간의 FID를 계산합니다. 또한 부록에 Inception Scores (Salimans 2016)를보고합니다. 기본적으로 잠재 벡터 z에 대한 증가 변환 T는 가우스 노이즈 ∆z ∼ N (0, σnoise)을 추가합니다. 이미지에 대한 증강 변환 T는 무작위로 수평으로 뒤집고 여러 픽셀로 이동하는 조합입니다 (CIFAR-10 및 CelebA의 경우 최대 4 개, ImageNet의 경우 최대 16 개). 이 변환 조합은 대안보다 더 나은 성능을 제공합니다 (Zhang (2020) 참조). 다양한 확대 전략에서 CRGAN을 능가하지만 비교를 위해 CRGAN에서 최고의 이미지 확대 전략 (무작위 뒤집기 및 이동)과 동일한 이미지 확대 전략을 사용합니다. 다양한 GAN 손실 함수가 있으며 섹션 A에서 몇 가지에 대해 자세히 설명합니다. Zhang (2020)에 이어 각 데이터 세트 및 모델 아키텍처 조합에 대해 기준선에서 최상의 성능을 달성하는 손실 함수를 사용하여 실험을 수행합니다.
3.3 Unconditional GAN Models
We first test out techniques on unconditional image generation, which is to model images from an object-recognition data set without any reference to the underlying classes. We conduct experiments on the CIFAR-10 and CelebA data sets, and use both DCGAN (Radford, Metz, and Chintala 2015) and ResNet (He 2016) GAN architectures.
먼저 기본 클래스에 대한 참조없이 객체 인식 데이터 세트에서 이미지를 모델링하는 무조건 이미지 생성 기술을 테스트합니다. CIFAR-10 및 CelebA 데이터 세트에 대한 실험을 수행하고 DCGAN (Radford, Metz 및 Chintala 2015) 및 ResNet (He 2016) GAN 아키텍처를 모두 사용합니다.
DCGAN on CIFAR-10
Figure 2 presents the results of DCGAN on CIFAR-10 with the hinge loss.
Vanilla Consistency Regularization (CR) (Zhang 2020) outperforms all other baselines.
Our Balanced Consistency Regularization (bCR) technique improves on CR by more than 3.0
FID points. Our Latent Consistency Regularization (zCR) technique improves scores less than bCR, but the improvement is still significant compared to the measurement variance.
We set λreal = λfake = 10 for bCR, while using σnoise = 0.03, λgen = 0.5, and λdis = 5 for zCR.
CIFAR-10의 DCGAN 그림 2는 CIFAR-10에 대한 DCGAN의 힌지 손실 결과를 보여줍니다. Vanilla Consistency Regularization (CR) (Zhang 2020)은 다른 모든 기준을 능가합니다. BCR (Balanced Consistency Regularization) 기술은 CR을 3.0 이상 향상시킵니다. FID 포인트. 우리의 잠복 일관성 정규화 (zCR) 기술은 bCR보다 낮은 점수를 향상 시키지만 측정 분산에 비해 개선은 여전히 중요합니다. bCR에 대해 λreal = λfake = 10을 설정하고 zCR에 대해 σnoise = 0.03, λgen = 0.5 및 λdis = 5를 사용합니다.
ResNet on CIFAR-10
DCGAN-type models are wellknown and it is encouraging that our techniques increase performance for those models, but they have been substantially surpassed in performance by newer techniques.
We then validate our methods on more recent architectures that use residual connections (He 2016).
Figure 3 shows unconditional image synthesis results on CIFAR-10 using a GAN model with residual connections and the non-saturating loss.
Though both of our proposed modifications still outperform all baselines, Latent Consistency Regularization works better than Balanced Consistency Regularization, contrary to the results in Figure 2.
For hyperparameters, we set λreal = 10 and λfake = 5 for bCR, while using σnoise = 0.07, λgen = 0.5, and λdis = 20 for zCR.
CIFAR-10의 ResNet DCGAN 유형 모델은 잘 알려져 있으며 우리의 기술이 해당 모델의 성능을 향상시키는 것이 고무적이지만 새로운 기술에 의해 성능이 크게 뛰어났습니다. 그런 다음 잔여 연결을 사용하는 최신 아키텍처에서 방법을 검증합니다 (He 2016). 그림 3은 잔류 연결 및 비 포화 손실이있는 GAN 모델을 사용하여 CIFAR-10에 대한 무조건 이미지 합성 결과를 보여줍니다. 제안 된 수정 사항 모두 여전히 모든 기준을 능가하지만 잠재 일관성 정규화는 그림 2의 결과와 달리 균형 일관성 정규화보다 더 잘 작동합니다. 하이퍼 파라미터의 경우 bCR에 대해 λreal = 10 및 λfake = 5를 설정하고 zCR에 대해 σnoise = 0.07, λgen = 0.5 및 λdis = 20을 사용합니다.
DCGAN on CelebA
We also conduct experiments on the CelebA data set. The baseline model we use in this case is a DCGAN model with the non-saturating loss. We set λreal = λfake = 10 for bCR, while using σnoise = 0.1, λgen = 1, and λdis = 10 for zCR. The results are shown in Figure 4 and are overall similar to those in Figure 2.
The improvements in performance for CelebA are not as large as those for CIFAR10, but they are still substantial, suggesting that our methods generalize across data sets.
CelebA의 DCGAN 우리는 또한 CelebA 데이터 세트에 대한 실험을 수행합니다. 이 경우에 사용하는 기본 모델은 비 포화 손실이있는 DCGAN 모델입니다. bCR에 대해 λreal = λfake = 10을 설정하고 zCR에 대해 σnoise = 0.1, λgen = 1 및 λdis = 10을 사용합니다. 결과는 그림 4에 나와 있으며 전체적으로 그림 2의 결과와 유사합니다. CelebA의 성능 향상은 CIFAR10의 성능만큼 크지는 않지만 여전히 상당하며 우리의 방법이 데이터 세트 전반에 걸쳐 일반화됨을 시사합니다.
Improved Consistency Regularization
As alluded to above, we observe experimentally that combining Balanced Consistency regularization (bCR) and Latent Consistency Regularization (zCR) (into Improved Consistency Regularization (ICR)) yields results that are better than those given by either method alone.
Using the above experimental results, we choose the best-performing hyper-parameters to carry out experiments for ICR, regularizing with both bCR and zCR. Table 1 shows that ICR yields the best results for all three unconditional synthesis settings we study.
Moreover, the results of the ResNet model on CIFAR-10 are, to the best of our knowledge, the best reported results for unconditional CIFAR-10 synthesis.
3.4 Conditional GAN Models
In this section, we apply our consistency regularization techniques to the publicly available implementation of BigGAN (Brock, Donahue, and Simonyan 2019) from Kurach (2019).
We compare it to baselines from Brock, Donahue, and Simonyan (2019); Miyato (2018a); Zhang (2020). Note that the FID numbers from Wu (2019) are based on a larger version of BigGAN called BigGAN-Deep with substantially more parameters than the original BigGAN, and are thus not comparable to the numbers we report here.
On CIFAR-10, our techniques yield the best known FID score for conditional synthesis with CIFAR-102 : 9.21.
On conditional Image Synthesis on the ImageNet data set, our technique yields FID of 5.38.
This is the best known score using the same number of parameters as in the original BigGAN model, though the much larger model from Wu (2019) achieves a better score.
For both setups, we set λreal = λfake = 10, together with σnoise = 0.05, λgen = 0.5, and λdis = 20.
4 Ablation Studies
To better understand how the various hyper-parameters introduced by our new techniques affect performance, we conduct a series of ablation studies. We include both quantitative and qualitative results.
4.1 Examining Artifacts Resulting from ‘Vanilla’ Consistency Regularization
To understand the augmentation artifacts resulting from using vanilla CR-GAN (Zhang 2020), and to validate that Balanced Consistency Regularization removes those artifacts, we carry out a series of qualitative experiments using varying sizes for the cutout (DeVries and Taylor 2017) augmentation.
We experiment with cutouts of size 8 × 8, 16 × 16, and 32 × 32, training both vanilla CR-GANs and GANs with Balanced Consistency Regularization.
The results are shown in Figure 5. The first column shows CIFAR-10 training images augmented with cutout of different sizes.
The second column demonstrates that the vanilla CR-GAN (Zhang 2020) can cause augmentation artifacts to appear in generated samples.
This is because CR-GAN only has consistency regularization on real images passed into the discriminator. In the last column (our Balanced Consistency Regularization: bCR in Algorithm 1) this issue is fixed with both real and generated fake images augmented before being fed into the discriminator.
Broadly speaking, we observe more substantial cutout artifacts (black rectangles) in samples from CR-GANs with larger cutout augmentations, and essentially no such artifacts for GANs trained with Balanced Consistency Regularization with λfake ≥ λreal. To quantify how much bCR alleviates generation artifacts, we vary cutout sizes and the strength of CR for generated images.
We examine 600 of generated images from 3 random runs, and report the fraction of images that contain artifacts of cutouts in Table 3.
The strength of CR for real images is fixed at λreal = 10. We do observe a few artifacts when 0 < λfake λreal, but much less than those from the vanilla CR-GAN.
We believe that this phenomenon of introducing augmentation artifacts into generations likely holds for other types of augmentation, but it is much more difficult to confirm for less visible transforms, and sometimes it may not actually be harmful (e.g. flipping of images in most contexts).
4.2 Effect of Hyper-Parameters on Balanced Consistency Regularization’s Performance
In Balanced Consistency Regularization (Algorithm 1), the cost associated with sensitivity to augmentations of the real images is weighted by λreal and the cost associated with sensitivity to augmentations of the generated samples is weighted by λfake.
In order to better understand the interplay between these parameters, we train a DCGAN-type model with spectral normalization on the CIFAR-10 data set with the hinge loss, for many different values of λfake, λreal.
The heat map in Figure 8 in the appendix shows that it never pays to set either of the parameters to zero: this means that Balanced Consistency Regularization always outperforms vanilla consistency regularization (the baseline CR-GAN).
Generally speaking, setting λreal and λfake similar in magnitude works well.
This is encouraging, since it means that the performance of bCR is relatively insensitive to hyper-parameters.
4.3 Effect of Hyper-Parameters on Latent Consistency Regularization’s Performance
Latent Consistency Regularization (Algorithm 2) has three hyper-parameters: σnoise, λgen and λdis, which respectively govern the magnitude of the perturbation made to the draw from the prior, the weight of the sensitivity of the generator to that perturbation, and the weight of the sensitivity of the discriminator to that perturbation.
From the view of the generator, intuitively, the extra loss term added Lgen = −kG(z)−G(T(z))k 2 encourages G(z) and G(T(z)) to be far away from each other.
We conduct experiments using a ResNet-style GAN on the CIFAR-10 data set with the non-saturating loss in order to better understand the interplay between these hyper-parameters.
The results in Figure 6 show that a moderate value for the generator coefficient (e.g. λgen = 0.5) works the best (as measured by FID).
This corresponds to encouraging the generator to be sensitive to perturbations of samples from the prior.
For this experimental setup, perturbations with standard deviation of σnoise = 0.07 are the best, and higher (but not extremely high) values for the discriminator coefficient λdis also perform better.
5 Related Work
There is so much related work on GANs (Goodfellow 2014) that it is impossible to do it justice (see Odena (2019); Kurach (2019) for different overviews of the field), but here we sketch out a few different threads.
There is a several-year-long thread of work on scaling GANs up to do conditional image synthesis on the ImageNet-2012 data set beginning with Odena, Olah, and Shlens (2017), extending through Miyato (2018a); Zhang (2019); Brock, Donahue, and Simonyan (2019); Daras (2019) and most recently culminating in Wu (2019) and Zhang (2020), which presently represent the state-of-the-art models at this task (Wu (2019) uses a larger model size than Zhang (2020) and correspondingly report better scores). Zhou and Krahenb ¨ uhl (2019) try to make the discriminator ¨ robust to adversarial attacks to the generated images.
Our zCR is different in two aspects: zCR enforces the robustness of the compound function D(G(∗)) to make D(G(z)) and D(G(z + ∆z)) consistent, while Zhou and Krahenb ¨ uhl ¨ (2019) only encourage the robustness in the generated image space as they regularize between D(G(z)) and D(G(z) + v) where v is a fast normalized gradient attack vector;
Instead of only regularizing D, zCR also regularizes G to make G(z) and G(z + ∆z) different to avoid mode collapse.
Most related work on consistency regularization is from the semi-supervised learning literature, and focuses on regularizing model predictions to be invariant to small perturbations (Bachman, Alsharif, and Precup 2014; Sajjadi, Javanmardi, and Tasdizen 2016; Laine and Aila 2016; Miyato 2018b; Xie 2019) for the purpose of learning from limited labeled data.
Wei (2018); Zhang (2020) apply related ideas to training GAN models and observe initial gains, which motivates this work.
There are also several concurrent work related to this paper, indicating an emerging direction of GAN training with augmentations.
Zhao (2020a) and Karras (2020) research on how to train GANs with limited data; while Zhao (2020b) mainly focus on thoroughly investigating the effectiveness of different types of augmentations.
6 Conclusion
Extending the recent success of consistency regularization in GANs (Wei 2018; Zhang 2020), we present two novel improvements: Balanced Consistency Regularization, in which generator samples are also augmented along with training data, and Latent Consistency Regularization, in which draws from the prior are perturbed, and the sensitivity to those perturbations is discouraged and encouraged for the discriminator and the generator, respectively.
In addition to fixing a new issue we observe with the vanilla Consistency Regularization (augmentation artifacts in samples), our techniques yield the best known FID numbers for both unconditional and conditional image synthesis on the CIFAR-10 data set.
They also achieve the best FID numbers (with the fixed number of parameters used in the original BigGAN (Brock, Donahue, and Simonyan 2019) model) for conditional image synthesis on ImageNet.
These techniques are simple to implement, not particularly computationally burdensome, and relatively insensitive to hyper-parameters.
We hope they become a standard part of the GAN training toolkit, and that their use allows more interesting usage of GANs to many sorts of applications.
A GAN Losses
A Generative Adversarial Network (GAN) (Goodfellow 2014) is composed of a Generator model, G, and a Discriminator model, D, which are parameterized by deep neural networks.
The generator is trained to take a latent vector z ∼ p(z) from a prior distribution and generate target samples G(z).
The discriminator is trained to distinguish samples from the target distribution preal(x) and samples G(z), which encourages generator to reduce the discrepancy between the target distribution and G(z).
Both models have respective losses defined as: LD = −Ex∼pdata [log D(x)] − Ez∼pz [log(1 − D(G(z)))] , LG = −Ez∼pz [log D(G(z))] .
This original formulation (Goodfellow 2014) is known as the non-saturating (NS) GAN.
Extensive research has demonstrated that appropriate re-design of LD plays an important role in training stability and generation quality.
For example, the hinge loss on the discriminator (Lim and Ye 2017; Tran, Ranganath, and Blei 2017) is defined as: LD = −Ex∼pdata [min(0, −1 + D(x))] − Ez∼pz [min(0, −1 − D(G(z)))] , LG = −Ez∼pz [D(G(z))] .
The Wassertein GAN (WGAN) (Arjovsky, Chintala, and Bottou 2017) is another successful reformulation which measures 1-Lipschitz constrained Wasserstein distance (Villani 2008) between the target distribution and the generated distribution in the discriminator output space.
The objectives of WGAN can be defined as: LD = −Ex∼pdata [D(x)] + Ez∼pz [D(G(z))] , LG = −Ez∼pz [D(G(z))] .
Follow-up work improves WGAN in multiple ways (Gulrajani 2017; Wei 2018).
For instance, Miyato (2018a) propose spectral normalization to stabilize the training, which is widely used (Zhang 2019; Brock, Donahue, and Simonyan 2019; Chen 2021a,b) and has become the de-facto weight normalization technique for GANs.
B Evaluation in Inception Score
Inception Score (IS) is another GAN evaluation metric introduced by Salimans (2016).
Here, we compare the Inception Score of the unconditional generated samples on CIFAR-10 and CelebA for the experiments in Section 3.3.
As shown in Table 4, our Improved Consistency Regularization achieves the best IS result with both SNDCGAN and ResNet architectures.
C Hyper-Parameters’ Effect on Performance
In Section 4, we carry out extensive experiments analyzing how the hyper-parameters affect performance for Balanced Consistency Regularization and Latent Consistency Regularization respectively. Due to space limit, we present the visualization of results here in the appendix.
D Additional Quantitative Results
In Section 4.1, we examine artifacts resulted from ‘Vanilla’ Consistency Regularization in Zhang (2020), and demonstrate that our Balanced Consistency Regularization (bCR) can alleviate the issues with illustrations.
Here in the appendix, we report quantitative evaluations in terms of FID corresponding to the experiments in Figure 5.
Moreover, we further carry out experiments with a different augmentation: color jittering, the artifacts resulted from which can also be easy to perceive.
For augmentation with color jittering, we add random noise constrained by a certain strength to image color channels.
For example, with the color jittering strength of 0.3, random noise between (0, 0.3) is added onto normalized images for augmentation.
Table 6 shows we have similar results when augmenting images with color jittering comparing CR with bCR, which support our findings and improvements over baselines.
E Qualitative Examples
We randomly sample from our ICR-BigGAN model on ImageNet (FID=5.38, Secition 3.4) as qualitative examples for different class labels.
We have obtained permission from authors of CR-GAN (Zhang 2020) to directly use the visualization of random samples from their CR-BigGAN model (FID=6.66) for comparison.
In the following figures, the left column shows random samples from our ICR-BigGAN, while the right column presents those from baseline CRBigGAN.