---
title: [DL輪読会]Self-Attention Generative Adversarial Networks
tags: 
author: [Deep Learning JP](https://www.docswell.com/user/DeepLearning2023)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/5JGXZD6D7L.jpg?width=480
description: 2018/06/01 Deep Learning JP:  http://deeplearning.jp/seminar-2/
published: June 04, 18
canonical: https://www.docswell.com/s/DeepLearning2023/ZGXJJ4-dlselfattention-generative-adversarial-networks-100362745
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/5JGXZD6D7L.jpg)

DEEP LEARNING JP
[DL Papers]
Self-Attention Generative Adversarial Networks
Shizuma Kubo, Matsuo Lab
http://deeplearning.jp/
1


# Page. 2

![Page Image](https://bcdn.docswell.com/page/47Q8L14XEP.jpg)

書誌情報
• 著者:
Han Zhang(Rutgers Univ), Ian Goodfellow(Google Brain)
Dimitris Metaxas(Rutgers Univ), Augustus Odena(Google Brain)
• submitted on 21 May 2018 on arXiv (https://arxiv.org/abs/1805.08318)
2


# Page. 3

![Page Image](https://bcdn.docswell.com/page/KE42DRQ271.jpg)

Goodfellowさんがツイートしていた
GANによるClass-conditionalな画像の
生成においてSOTAを達成
3


# Page. 4

![Page Image](https://bcdn.docswell.com/page/L71MZQPKJG.jpg)

要点
• Spectral normalizationをGANのgeneratorに適用することで
学習が安定することを示した.
• Two-timescale update rule(TTUR)を用いることでGANの学習速度が
向上することを示した．
• Self-Attentionの機構をGANに取り入れたSelf-Attention Generative
Adversarial Networks(SAGANs)を提案した．
• ImageNetのデータセットについて，IS, FIDの両指標でSOTAの精度を達成した．
4


# Page. 5

![Page Image](https://bcdn.docswell.com/page/G7W39M2P72.jpg)

ConditionalなGANの難しさ
• CNNベースのGANは成功しているが，ImageNetの画像の生成のようなマルチク
ラスでトレーニングする場合（ex. conditional GAN）に難しさがある．
Textureによって判断されるカテゴリは
綺麗に生成出来る(海，空，景色, etc).
Geometryによって判断されるカテゴリは
生成が難しい．
（数値はFID/FIDは小さいほどよい)
5


# Page. 6

![Page Image](https://bcdn.docswell.com/page/4JZV9QD673.jpg)

ConditionalなGANの難しさ
• Convolutionは局所的な受容野(local receptive ﬁeld)を持つため，大局的な部分
は層を多層に重ねることによってのみ考慮される．
– 小さなモデルでは表現が出来ないし，多層なモデルではパラメータの学習が難しく，学習が不
安定になる．
– カーネルを大きくして受容野を大きくとっても計算効率は落ちる．
• Self-Attentionを使うことで大局的な部分を考慮することと計算効率をよりよい
バランスで行うことができる．
6


# Page. 7

![Page Image](https://bcdn.docswell.com/page/YE65K61LJV.jpg)

比較モデル（conditionalGAN）
• 既存手法として比較するのはACGANs(Odena et al, 2017)と
SNGAN-projection(Miyato et al, 2018)
ACGANs
SNGAN-projection
cGANs with Projection Discriminator (Miyato et al, 2018 の図より)
7


# Page. 8

![Page Image](https://bcdn.docswell.com/page/GE5YP64ME4.jpg)

SNGAN-projection
DiscriminatorのResblock
Conv層にSpectral normalization
GeneratorのResblock
8


# Page. 9

![Page Image](https://bcdn.docswell.com/page/972G6MVR7R.jpg)

Source-Target-AttentionとSelf-Attention
引用: http://deeplearning.hatenablog.com/entry/transformer
9


# Page. 10

![Page Image](https://bcdn.docswell.com/page/DJYV9X35JM.jpg)

Self-Attention
10


# Page. 11

![Page Image](https://bcdn.docswell.com/page/V7NML1V4E8.jpg)

Self-Attention
11


# Page. 12

![Page Image](https://bcdn.docswell.com/page/YJ9N4564J3.jpg)

Self-Attention
ガンマは0で初期化する．はじめはより簡単な局所的な部分のウェイトを多くして
徐々に大局的な部分まで見れるようにガンマを大きくする．
12


# Page. 13

![Page Image](https://bcdn.docswell.com/page/GJ8KQYZVED.jpg)

Techniques to stabilize (Spectral normalization/TTUR)
• SNGAN-projection(Miyato et al, 2018)でdiscriminatorに適用していた
spectoral normalizationをgeneratorにも適用した．
– SNGAN-projection(Miyato et al, 2018)では，DiscriminatorのLipschitzs定数をコントロー
ルし安定性を向上させた．
– Generatorもspectoral normalizationの恩恵を受けることを示した．
– Generatorの1更新に対するDiscriminatorの更新回数を減らすことが可能となり，計算量をへ
らすことができた．
– 学習が安定することも示した．
• Two-timescale update rule (TTUR) (Heusel et al, 2017)を適用した．
– Generator側の学習率をDiscriminator側の学習率より小さくするとナッシュ均衡解に収束す
ることが示せる．
– 学習率: generator 0.0004/discriminator 0.0001
13


# Page. 14

![Page Image](https://bcdn.docswell.com/page/LJLZX4DR7R.jpg)

Techniques to stabilize の評価
(a) Spectral Normalization
Only Discriminator
(b) Spectral Normalization
Discriminator/Genarator
(c) Spectral Normalization
and TTUR
14


# Page. 15

![Page Image](https://bcdn.docswell.com/page/47MVLKPP7W.jpg)

Self-attention評価
• Low levelの特徴マップにattentionを適用させるよりhigh levelの特徴マップに
attentionを適用させたほうが効果が大きい．
• 同等のパラメータを持つResidualと比較してもattentionが機能していることが分
かる．
15


# Page. 16

![Page Image](https://bcdn.docswell.com/page/P7R2KX1YJ9.jpg)

Attentionの効果
• Attentionの重みを可視化．Attentionを使用した最後のGeneratorの層の
Attention mapを可視化している．
• 左の画像の各色の点がそれぞれ各地点のAttention mapに対応する．
• 各地点と色やテクスチャが近い部分にAttentionが施されている．
16


# Page. 17

![Page Image](https://bcdn.docswell.com/page/PJXDL6Y4EX.jpg)

既存手法との比較
• SAGANと既存手法のInception Score/FIDの比較
17


# Page. 18

![Page Image](https://bcdn.docswell.com/page/3JKXL13PED.jpg)

まとめ
• Spectral normalizationをGANのgeneratorに適用することで
学習が安定することを示した.
• Two-timescale update rule(TTUR)を用いることでGANの学習速度が
向上することを示した．
• Self-Attentionの機構をGANに取り入れたSelf-Attention Generative
Adversarial Networks(SAGANs)を提案した．
• ImageNetのデータセットについて，IS, FIDの両指標でSOTAの精度を達成した．
17


# Page. 19

![Page Image](https://bcdn.docswell.com/page/LE353QG4J5.jpg)

参考文献
• Self-Attention Generative Adversarial Networks (本紹介論文)
https://arxiv.org/pdf/1805.08318.pdf
• cGANs with Projection Discriminator
https://arxiv.org/pdf/1802.05957.pdf
• Spectral Normalization for Generative Adversarial Networks
https://arxiv.org/pdf/1802.05957.pdf
• GANs Trained by a Two Time-Scale Update Rule Converge to a Local
Nash Equilibrium https://arxiv.org/pdf/1706.08500.pdf
• [DL輪読会] Spectral Norm Regularization for Improving the Generalizability
of Deep Learning/Spectral Normalization for GANs
https://www.slideshare.net/DeepLearningJP2016/dl-spectral-normregularization-for-improving-the-generalizability-of-deep-learningspectralnormalization-for-gans
19


