Git Product home page Git Product logo

gan_sample's Introduction

GANディープラーニング実装ハンドブック

書籍の画像

書籍「GANディープラーニング実装ハンドブック」のサポートサイトです。本書籍で使用するサンプルコードがまとめてあります。

章の構成

  • 第1章:生成モデル
  • 第2章:変分オートエンコーダ(VAE)
  • 第3章:GANの基本モデル(DCGAN、CGAN、LSGAN)
  • 第4章:超解像(ESRGAN)
  • 第5章:ドメイン変換(pix2pix、CycleGAN)
  • 第6章:動画変換(Recycle-GAN)
  • 第7章:StyleGAN、StyleGAN2
  • 第8章:異常検知(AnoGAN、EfficientGAN)
  • 第9章:3Dデータの生成(3D-α-WGAN-GP)
  • Appendix:理論の補足

ライブラリのバージョン

ライブラリは執筆時点のColabの最新バージョンになります。Colabのライブラリは定期的に更新するので、プログラム実行時にエラーが発生する場合はバージョンを戻して実行してください。

  • torch:1.7.0
  • torchvision:0.8.1
  • pandas:1.1.5
  • numpy:1.19.5
  • matplotlib:3.2.2

データセット

モデル データセット ライセンス 取得元リンク
2 AE、VAE MNIST Creative Commons https://pytorch.org/vision/0.8/datasets.html
3 DCGAN、CGAN MNIST Creative Commons https://pytorch.org/vision/0.8/datasets.html
3 LSGAN、DCGAN Pet Dataset Creative Commons https://www.robots.ox.ac.uk/~vgg/data/pets/
4 ESRGAN Pet Dataset Creative Commons https://www.robots.ox.ac.uk/~vgg/data/pets/
5 pix2pix、CycleGAN photo2portrait データセットの画像をインターネット等で公開したり、販売するのは禁止です。 https://drive.google.com/file/d/1arF3guFms5tLiaIs8GtcV2dW0WAvrvLM/view?usp=sharing
6 Cycle GAN、Recycle-GAN VidTIMIT Audio-Video Dataset リンク先のLICENSEに利用時の注事事項の記載あり https://conradsanderson.id.au/vidtimit/
7 StyleGAN、StyleGAN2 Endless Summer Dataset データセットの画像をインターネット等で公開したり、販売するのは禁止です。 https://drive.google.com/file/d/1LM4FtUltzS45PuFyfuSp3I8QdTD8Cu0F/view?usp=sharing
8 AnoGAN、EfficientGAN Fruits 360 Dataset Creative Commons https://data.mendeley.com/datasets/rp73yg93n8/1
9 3D-α-WGAN-GP IXI Dataset Creative Commons http://brain-development.org/ixi-dataset/

学習時の注意点

モデル 注意点 学習の目安時間
3 LSGAN、DCGAN LSGANよりDCGANの方が猫っぽい画像を生成します。 5~6時間程度
4 ESRGAN デフォルト設定だとファイルはColabに保存されるので、Google Driveに保存したい場合は出力ファイルのパスの定義(output_dir)をGoogle Driveに変更してください。 5~6時間程
5 pix2pix, CycleGAN 特になし 5〜8時間程度
6 CycleGAN 、Recycle-GAN 特になし 半日から数日
7 StyleGAN、StyleGAN2 GPUは執筆時点で最速のP100を推奨(理想はV100)。 P100で2週間程度
8 AnoGAN、EfficientGAN、
EfficientGAN_L1
AnoGAN, EfficientGANで生成精度が悪い場合、EfficientGAN_L1を使用してください。 2 ~ 3時間程度
9 3D-α-WGAN-GP 特になし 8時間程度

生成画像の例

モデル 説明 生成画像
3 DCGAN サイズ128×128の猫画像を生成 fake_cat
4 ESRGAN 低解像画像を入力し、超解像画像を生成

左側: 低解像画像
**: 本物画像
右側: 生成画像(超解像画像)
image
5 CycleGAN 肖像画を入力し、写真画像を生成

上側: 肖像画
下側: 写真画像
0089
6 Recycle-GAN 女性Aの画像を入力し、同じ向き、同じ表情の別の女性Bの画像を生成

左側: 女性A
右側: 女性B
A2B
7 StyleGAN2 512×512の画像を生成 2021 02 08_012021 02 08_052021 02 08_09
8 AnoGAN、EfficientGAN サイズ96×96のほおずきの画像を生成

左側: 入力画像
**: 生成画像
右側: 差分画像

上段は本物画像を入力したため、本物と生成の差が小さく異常スコアが低い

下段は異常画像を入力したため、生成画像は異常箇所を再現できず、異常スコアが高い
Screenshot from 2021-02-11 15-54-29

Screenshot from 2021-02-11 15-34-19
9 3D-α-WGAN-GP サイズ64×64×64の3次元頭部MRIデータを生成
1行目は1つの3次元データを異なる断面で2次元化したデータ

左側: 矢状面(左右の断面)
**: 冠状面(前後の断面)
右側: 横断面(上下の断面)

2・3行目は同じデータを矢状面で断面をずらしながらスライスしたデータ
triple
slice

エラー発生時の問い合わせ

サンプルコードの間違いや動作不具合は本リポジトリのIssuesに投稿ください。

動作不具合についての投稿では、以下を記載ください。

  • 実行プログラム名
  • エラーメッセージ
  • Python、PyTorchなどののライブラリバージョン

正誤表

ページ 補足
3章 p52 1行目 パラメータを待つモデル分布 パラメータを持つモデル分布
7章 p281 活用メモ 左の方が、よりハイスペックになります。 右の方が、よりハイスペックになります。
7章 p281 活用メモ Colabo pro Colab pro

変更履歴

日付 変更内容
2021/02/13  初版 

gan_sample's People

Contributors

ayukat1016 avatar e4exp avatar h-s-dev avatar hampen2929 avatar masataka46 avatar massy103 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.