|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en-us"> |
| 3 | + |
| 4 | + <head> |
| 5 | + <link href="http://gmpg.org/xfn/11" rel="profile"> |
| 6 | + <meta http-equiv="content-type" content="text/html; charset=utf-8"> |
| 7 | + |
| 8 | + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> |
| 9 | + |
| 10 | + <title> |
| 11 | + |
| 12 | + GANによる高品質画像生成レース · cpp-python-beginners |
| 13 | + |
| 14 | + </title> |
| 15 | + |
| 16 | + |
| 17 | + <link rel="canonical" href="https://tatsy.github.io/cpp-python-beginners/python/assignment-gan/"> |
| 18 | + |
| 19 | + |
| 20 | + <link rel="stylesheet" href="https://tatsy.github.io/cpp-python-beginners/public/css/poole.css"> |
| 21 | + <link rel="stylesheet" href="https://tatsy.github.io/cpp-python-beginners/public/css/syntax.css"> |
| 22 | + <link rel="stylesheet" href="https://tatsy.github.io/cpp-python-beginners/public/css/lanyon.css"> |
| 23 | + <link rel="stylesheet" href="https://tatsy.github.io/cpp-python-beginners/public/css/main.css"> |
| 24 | + <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Serif:400,400italic,700%7CPT+Sans:400"> |
| 25 | + |
| 26 | + <link rel="apple-touch-icon-precomposed" sizes="144x144" href="https://tatsy.github.io/cpp-python-beginners/public/apple-touch-icon-precomposed.png"> |
| 27 | + <link rel="shortcut icon" href="https://tatsy.github.io/cpp-python-beginners/public/favicon.ico"> |
| 28 | + <link rel="alternate" type="application/rss+xml" title="RSS" href="https://tatsy.github.io/cpp-python-beginners/atom.xml"> |
| 29 | + |
| 30 | + <script type="text/javascript" src="/cpp-python-beginners/public/js/jquery.min.js"></script> |
| 31 | + <script type="text/javascript" src="/cpp-python-beginners/public/js/lightbox.min.js"></script><script> |
| 32 | +MathJax = { |
| 33 | + tex: { |
| 34 | + inlineMath: [['$','$'], ['\\(','\\)']], |
| 35 | + processEscapes: true, |
| 36 | + tags: "ams", |
| 37 | + autoload: { |
| 38 | + color: [], |
| 39 | + colorV2: ['color'] |
| 40 | + }, |
| 41 | + packages: {'[+]': ['noerrors']} |
| 42 | + }, |
| 43 | + chtml: { |
| 44 | + scale: 1.1, |
| 45 | + matchFontHeight: false, |
| 46 | + displayAlign: "left", |
| 47 | + displayIndent: "2em" |
| 48 | + }, |
| 49 | + options: { |
| 50 | + renderActions: { |
| 51 | + /* add a new named action to render <script type="math/tex"> */ |
| 52 | + find_script_mathtex: [10, function (doc) { |
| 53 | + for (const node of document.querySelectorAll('script[type^="math/tex"]')) { |
| 54 | + const display = !!node.type.match(/; *mode=display/); |
| 55 | + const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display); |
| 56 | + const text = document.createTextNode(''); |
| 57 | + node.parentNode.replaceChild(text, node); |
| 58 | + math.start = {node: text, delim: '', n: 0}; |
| 59 | + math.end = {node: text, delim: '', n: 0}; |
| 60 | + doc.math.push(math); |
| 61 | + } |
| 62 | + }, ''] |
| 63 | + } |
| 64 | + }, |
| 65 | + loader: { |
| 66 | + load: ['[tex]/noerrors'] |
| 67 | + } |
| 68 | +}; |
| 69 | +</script> |
| 70 | +<script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" id="MathJax-script"></script> |
| 71 | +</head> |
| 72 | + |
| 73 | + |
| 74 | + <body> |
| 75 | + |
| 76 | + <!-- Target for toggling the sidebar `.sidebar-checkbox` is for regular |
| 77 | + styles, `#sidebar-checkbox` for behavior. --> |
| 78 | +<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox"> |
| 79 | + |
| 80 | +<!-- Toggleable sidebar --> |
| 81 | +<div class="sidebar" id="sidebar"> |
| 82 | + <div class="sidebar-item"> |
| 83 | + <p>初心者向けC++/Pythonプログラミング</p> |
| 84 | + </div> |
| 85 | + |
| 86 | + <nav class="sidebar-nav"> |
| 87 | + <a class="sidebar-nav-item" href="https://tatsy.github.io/cpp-python-beginners/">Home</a> |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + <a class="sidebar-nav-item" href="https://tatsy.github.io/cpp-python-beginners/cpp/">C++プログラミング</a> |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + <a class="sidebar-nav-item" href="https://tatsy.github.io/cpp-python-beginners/python/">Pythonプログラミング</a> |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + <a class="sidebar-nav-item" href="https://github.com/tatsy/cpp-python-beginners">GitHub project</a> |
| 117 | + <span class="sidebar-nav-item">Currently v1.0.0</span> |
| 118 | + </nav> |
| 119 | + |
| 120 | + <div class="sidebar-item"> |
| 121 | + <p> |
| 122 | + © 2020. All rights reserved. |
| 123 | + </p> |
| 124 | + </div> |
| 125 | +</div> |
| 126 | + |
| 127 | + |
| 128 | + <!-- Wrap is the content to shift when toggling the sidebar. We wrap the content to avoid any CSS collisions with our real content. --> |
| 129 | + <div class="wrap"> |
| 130 | + <div class="masthead"> |
| 131 | + <div class="container"> |
| 132 | + <h3 class="masthead-title"> |
| 133 | + <a href="/cpp-python-beginners/" title="Home">cpp-python-beginners</a> |
| 134 | + <small>Programming for everyone!</small> |
| 135 | + </h3> |
| 136 | + </div> |
| 137 | + </div> |
| 138 | + |
| 139 | + <div class="container content"> |
| 140 | + <div class="post"> |
| 141 | + <h1 class="post-title">GANによる高品質画像生成レース</h1> |
| 142 | + <p>ここまでの内容をベースにより良い画像生成を目指しましょう。</p> |
| 143 | + |
| 144 | +<h2 id="データセット">データ・セット</h2> |
| 145 | + |
| 146 | +<p><a href="https://www.robots.ox.ac.uk/~vgg/data/flowers/" target="_blank">Oxford flower dataset</a>の102カテゴリを使って行います。このデータセットは必ずしも正方形の画像が入っているわけではないので、画像の中心でクロップして128x128のサイズに正規化したものをお渡しします。</p> |
| 147 | + |
| 148 | +<h2 id="評価方法">評価方法</h2> |
| 149 | + |
| 150 | +<p>上記のような、10x10の画像タイル1枚を提出してもらいます。名前が分からない状態で、それを参加者に見せて、投票で優勝を決めます。</p> |
| 151 | + |
| 152 | +<h2 id="ルール">ルール</h2> |
| 153 | + |
| 154 | +<ul> |
| 155 | + <li>マシンによる有利・不利を避けるため、学習はColabを用いて行うこととします。 |
| 156 | + <ul> |
| 157 | + <li>Colabはリロードなしで90分、一定間隔でリロードしても12時間までしか使えません。</li> |
| 158 | + <li>一定間隔でリロードさせるためには、ブラウザ拡張のツールなどを使うと良いでしょう。</li> |
| 159 | + </ul> |
| 160 | + </li> |
| 161 | + <li>きれいな画像が出るまで乱数をサンプルすることは認めますが、きれいな画像が出るサンプルを100個集めて、それを結果の画像に使うのは禁止とします。</li> |
| 162 | +</ul> |
| 163 | + |
| 164 | +<h2 id="始め方">始め方</h2> |
| 165 | + |
| 166 | +<ul> |
| 167 | + <li>Google Colaboratoryのページを開き、適当なノートを作成する。その後、Google Driveに移動し「Colab Notebooks」というフォルダが作成されていることを確認する。</li> |
| 168 | + <li>「Colab Notebooks」の中にOxford flower datasetを展開したものを「OxfordFlower」というフォルダ名で配置する</li> |
| 169 | + <li>Colab上で学習を行う<a href="https://drive.google.com/open?id=1DOfgEWJ7MFdzDhy4K2bVy9v_fIvye40d" target="_blank">サンプルプログラム (単純なDCGAN)</a> をダウンロードし、同じく「Colab Notebooks」に配置する。</li> |
| 170 | + <li>Colabで上記のサンプルプログラムを開き、実行してみる。上手く実行できたら、以後、これを改良して、より良い画像が生成されるように改良する。</li> |
| 171 | +</ul> |
| 172 | + |
| 173 | +<h2 id="参考-ganの学習を安定化させる技術">参考: GANの学習を安定化させる技術</h2> |
| 174 | + |
| 175 | +<p>DCGANのような画像生成の技術が出始めてから数年で、非常に多くの学習安定化技術が提案されています。前回<a href="/cpp-python-beginners/python/stabilize-gan-training/">GANの学習安定化テクニック</a> で紹介したfeature matchingやminibatch discrimination意外にも、多くの技術をWeb上で探すことができるので、自分なりに調べて実装してみると、思いがけず精度が向上することがあるかもしれません。</p> |
| 176 | + |
| 177 | +<p>比較的多いものは<a href="https://arxiv.org/abs/1704.00028" target="_blank">Wasserstein GAN</a>や<a href="https://arxiv.org/abs/1611.04076" target="_blank">Least-squares GAN</a>のようにロス関数を工夫することで学習を安定化させる方法です。この他にも<a href="https://arxiv.org/abs/1602.07868">Weight normalization</a>や<a href="https://arxiv.org/abs/1802.05957" target="_blank">Spectral normalization</a>のように正規化のやり方を工夫するものや、<a href="https://arxiv.org/abs/1805.08318" target="_blank">Self-attention GAN</a>のようにネットワーク構造自体を工夫するものなどがあります。これらのテクニックを網羅的に解説したものとしては、以下の資料が参考になると思います。</p> |
| 178 | + |
| 179 | +<ul> |
| 180 | + <li>GANを学習させる際の14のテクニック (NIPS2016チュートリアルの日本語訳) <br /> |
| 181 | +<a href="https://qiita.com/underfitting/items/a0cbb035568dea33b2d7" target="_blank">https://qiita.com/underfitting/items/a0cbb035568dea33b2d7</a> <br /> |
| 182 | +(少し内容が古いので鵜呑みにし過ぎない方が良い)</li> |
| 183 | + <li>Shall we GANs? (SSII 2019 チュートリアル) <br /> |
| 184 | +<a href="https://www.slideshare.net/SSII_Slides/ssii2019ts11" target="_blank">https://www.slideshare.net/SSII_Slides/ssii2019ts11</a></li> |
| 185 | +</ul> |
| 186 | + |
| 187 | +</div> |
| 188 | + |
| 189 | + |
| 190 | + |
| 191 | + </div> |
| 192 | + </div> |
| 193 | + |
| 194 | + <label for="sidebar-checkbox" class="sidebar-toggle"></label> |
| 195 | + |
| 196 | + <script src='/cpp-python-beginners/public/js/script.js'></script> |
| 197 | + </body> |
| 198 | +</html> |
0 commit comments