LoginSignup
11
9

More than 3 years have passed since last update.

DeepLearningでポケモンを生成する

Last updated at Posted at 2019-12-16

はじめに

この記事は近畿大学Advent Calendar 2019の16日目の記事です.
何番煎じか分かりませんがGanでポケモンの画像を生成します.将来的には生成した画像に更にポケモン図鑑の説明を付加するようなことをしたいと思っています.
ソースコードはこちら

DCGAN

画像生成にはDCGANを用いました.詳細は論文を参照ください.
実装はDCGAN-tensorflowを用いたのですが,なぜか公式のソースコードにバグがあったので修正したものを使っています.

データセット

pokemon-images-dataset-by-typeで公開されている,ポケモンの画像を用いました.

環境構築

Docker image download

docker pull minamotofordocker/pokemon_generator:latest

ライブラリ系のインポート

setup.sh
#!/bin/sh

# Pokemon Image Data
git clone https://github.com/rileynwong/pokemon-images-dataset-by-type

# DCGAN
git clone https://github.com/mina-moto/DCGAN-tensorflow-pokemon

# Dataset setting
mkdir -p data/pokemon_image/
cp pokemon-images-dataset-by-type/all/* data/pokemon_image/

echo "Finish!"

各コマンド詳細

ポケモンの画像のインストール.

git clone https://github.com/rileynwong/pokemon-images-dataset-by-type

DCGAN-tensorflowのインストール.

git clone https://github.com/mina-moto/DCGAN-tensorflow-pokemon

インストールした画像の場所変更.

mkdir -p data/pokemon_image/
cp pokemon-images-dataset-by-type/all/* data/pokemon_image/

DCGANで画像の学習

パラメータ調整はこの記事を参考にしました.

docker run -v $PWD:/PokemonGenerator -w /PokemonGenerator -it --rm minamotofordocker/pokemon_generator:latest python DCGAN-tensorflow-pokemon/main.py --data_dir data/ --dataset pokemon_image --out_dir out/ --out_name pokemon_gan_sample --input_fname_pattern=*.png --input_height 120 --output_height 120 --train --epoch=5000 --batch_size=64 --learning_rate=0.001 --G_img_sum

生成された画像

学習の様子(4600epochまでの200epochごとに生成される画像).

train_run.gif

4600Epoch目の画像.ポケモンのような何かができてる?
train_00004600.png

11
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
9