覚え書きブログ

mmdVAEを用いたMNISTの復元

以下のMaximum Mean Discrepancyを参考に、MNISTの画像を復元するAutoEncoderを作ってみた。
szhao.me

コード一式は、以下のレポジトリに置いてある。
github.com

フォルダ構成

  • MNIST:

http://yann.lecun.com/exdb/mnist/
からダウンロードしたMNISTのデータ(gz形式)を置く。

  • visualization:pklファイルと、元画像と復元画像のペアの画像を保存
  • models:tensorflowのチェックポイントを保存
  • input_data.py:MNISTのデータ読み込むコード

https://github.com/tensorflow/tensorflow/blob/r0.7/tensorflow/examples/tutorials/mnist/input_data.py

  • mmd_VAE.py:AutoEncoderのコード(これを実行する)

コードの内容:


実行結果の例:

Image, iteration: 0, Negative log likelihood is 0.132817
Image, iteration: 1, Negative log likelihood is 0.112096
Image, iteration: 2, Negative log likelihood is 0.103636
Image, iteration: 3, Negative log likelihood is 0.094504
Image, iteration: 4, Negative log likelihood is 0.094447
Image, iteration: 5, Negative log likelihood is 0.107632
Image, iteration: 6, Negative log likelihood is 0.096937
Image, iteration: 7, Negative log likelihood is 0.086263
Image, iteration: 8, Negative log likelihood is 0.075665
Image, iteration: 9, Negative log likelihood is 0.083440
Image, iteration: 10, Negative log likelihood is 0.076919
Image, iteration: 11, Negative log likelihood is 0.068307
Image, iteration: 12, Negative log likelihood is 0.070534
Image, iteration: 13, Negative log likelihood is 0.075518
Image, iteration: 14, Negative log likelihood is 0.084493
Image, iteration: 15, Negative log likelihood is 0.075175
Image, iteration: 16, Negative log likelihood is 0.075251
Image, iteration: 17, Negative log likelihood is 0.081132
Image, iteration: 18, Negative log likelihood is 0.076310
Image, iteration: 19, Negative log likelihood is 0.070021
Image, iteration: 20, Negative log likelihood is 0.067716
...
Image, iteration: 990, Negative log likelihood is 0.004927
Image, iteration: 991, Negative log likelihood is 0.004771
Image, iteration: 992, Negative log likelihood is 0.005030
Image, iteration: 993, Negative log likelihood is 0.004839
Image, iteration: 994, Negative log likelihood is 0.004924
Image, iteration: 995, Negative log likelihood is 0.004720
Image, iteration: 996, Negative log likelihood is 0.004871
Image, iteration: 997, Negative log likelihood is 0.004735
Image, iteration: 998, Negative log likelihood is 0.004988
Image, iteration: 999, Negative log likelihood is 0.004945
Image, iteration: 1000, Negative log likelihood is 0.005165

0反復目:
f:id:hirotaka_hachiya:20180623104203p:plain

50反復目:
f:id:hirotaka_hachiya:20180623104223p:plain

100反復目:
f:id:hirotaka_hachiya:20180623104249p:plain

150反復目:
f:id:hirotaka_hachiya:20180623104332p:plain

200反復目:
f:id:hirotaka_hachiya:20180623104540p:plain

1000反復目:
f:id:hirotaka_hachiya:20180623121732p:plain