Giter Club home page Giter Club logo

stylegan-pokemon's Introduction

Pokemon Card Generator

Generating Pokemon cards using a mixture of StyleGAN and RNN to create beautiful & vibrant cards ready for battle!

Example

Demo: https://thesepokemondonotexist.com

Run StyleGAN

StyleGAN Environment

conda env create -f environment.yml
conda activate stylegan-pokemon
cd stylegan

StyleGAN Dataset

aws s3 cp s3://devopstar/resources/stylegan-pokemon/network-snapshot-007961.pkl network-snapshot-007961.pkl
aws s3 sync s3://devopstar/resources/stylegan-pokemon/kaggle-one-shot-pokemon kaggle-one-shot-pokemon
mkdir pokemon

Prepare Images

python prepare.py
python dataset_tool.py create_from_images datasets/smalls/ ./pokemon/

StyleGAN Training

python train.py

StyleGAN Invoke [Self-trained]

Using the network-final.pkl under the most recent entry in the stylegan/results path

python invoke.py \
    --model_file './results/00000-sgan-custom-1gpu/network-final.pkl' \
    --output_file '../img/pokemon1.png'

StyleGAN Invoke [Pre-trained]

python invoke.py \
    --model_file './network-snapshot-007961.pkl' \
    --output_file '../img/pokemon2.png'

StyleGAN Invoke MichaelFriese10

aws s3 cp s3://devopstar/resources/stylegan-pokemon/MichaelFriese10_pokemon.pkl MichaelFriese10_pokemon.pkl
python invoke.py \
    --model_file './MichaelFriese10_pokemon.pkl' \
    --output_file '../img/pokemon3.png'

Run RNN

RNN Environment

conda activate stylegan-pokemon
cd rnn

RNN Dataset

Dataset is from armgilles/pokemon.csv

ls -al data/pokemon/input.txt

Moves and Descriptions come from https://pokemondb.net/move/all

ls -al data/moves/input.txt
ls -al data/desc/input.txt

RNN Training

# Pokemon
python train.py \
    --data_dir=./data/pokemon \
    --save_dir=./save/pokemon \
    --seq_length=12

# Moves
python train.py \
    --data_dir=./data/moves \
    --save_dir=./save/moves \
    --rnn_size=300 \
    --seq_length=12

# Description
python train.py \
    --data_dir=./data/desc \
    --save_dir=./save/desc \
    --seq_length=25

RNN Invoke

# Pokemon
python sample.py \
    --save_dir=./save/pokemon \
    --output_dir=../samples/pokemon.txt

# Moves
python sample.py \
    --save_dir=./save/moves \
    --output_dir=../samples/moves.txt

# Description
python sample.py \
    --save_dir=./save/desc \
    --output_dir=../samples/desc.txt \
    -n=1500

Cropping

# Define all fields adhoc
./cropper.sh \
    "Pokemon Name" \
    "Pokemon Attack 1" \
    "Pokemon Attack Description 1" \
    "Pokemon Attack 2" \
    "Pokemon Attack Description 2" \
    "img/pokemon1.png"

# Random
./cropper-shuffle.sh \
    "samples/pokemon.txt" \
    "samples/moves.txt" \
    "samples/desc.txt" \
    "img/pokemon3.png"

Web Hosting

aws s3 mb s3://thesepokemondonotexist.com
aws s3 cp index.html s3://thesepokemondonotexist.com/index.html

Attribution

stylegan-pokemon's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

stylegan-pokemon's Issues

train.py setting get wrong Dimensions of inputs should match: shape[0] = [4,512,8,8] vs. shape[1] = [16,1,4,4]

Traceback (most recent call last):
File "C:\Users\User.conda\envs\stylegan-pokemon\lib\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call
return fn(*args)
File "C:\Users\User.conda\envs\stylegan-pokemon\lib\site-packages\tensorflow\python\client\session.py", line 1341, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "C:\Users\User.conda\envs\stylegan-pokemon\lib\site-packages\tensorflow\python\client\session.py", line 1429, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
(0) Invalid argument: ConcatOp : Dimensions of inputs should match: shape[0] = [4,512,8,8] vs. shape[1] = [16,1,4,4]
[[{{node GPU0/D_loss/D/4x4/MinibatchStddev/concat}}]]
[[TrainD/ApplyGrads0/UpdateWeights/cond/pred_id/_1845]]
(1) Invalid argument: ConcatOp : Dimensions of inputs should match: shape[0] = [4,512,8,8] vs. shape[1] = [16,1,4,4]
[[{{node GPU0/D_loss/D/4x4/MinibatchStddev/concat}}]]
0 successful operations.
0 derived errors ignored.

I find out that in train.py can't run with resolution= 512, it will show wrong as top.
And it can run by changing to resolution = 256.
Maybe we miss some layer ? I still don't figure out why.

It will be grateful if someone can help me on this question.

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.