Skip to content
Image generation using a generative adversarial network
Python Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gan
images
tests
.codecov.yml
.dockerignore
.gitignore
.travis.yml
Dockerfile
LICENSE
README.md
requirements.txt
requirements_base.txt
requirements_dev.txt

README.md

gan

Build Status codecov

Experiments with image generation using generative adversarial networks (GANs).

Shape Cartoon

Install dependencies

pip install -r requirements.txt

The requirement file has been reduced in size so if any of the scripts fail, just install the missing packages :-)

Get some data

You can create some toy data or download a dataset. For example, to create a bunch of shapes (useful for testing that things are working):

python -m gan.cli dataset shapes

Use python -m gan.cli dataset -h to see the options.

Cartoon dataset

To use the cartoon avatar dataset:

  1. Download the dataset from here: https://google.github.io/cartoonset/download.html (Downloading this file via Python seems to not work).
  2. Create a data directory (if it does not already exist). Note: You can put this data directory anywhere you like. The CLI expects a folder called data, but you can specify a different location with the CLI:
  3. Put the downloaded file in your data directory with the name cartoon.tgz.
  4. Run the command python -m gan.cli dataset cartoon which will take care of unzipping and organizing the contents of the cartoon dataset.

Run the training

python -m gan.cli train -d data/shapes

This command by default takes care of all the training.

Check python -m gan.cli train -h for options.

Training on GPU

The requirements.txt file refers to the CPU version of Tensorflow but manually uninstalling and installing the GPU version might work if you have everything set up with CUDA and stuff.

Otherwise, the easiest way to get GPU support is to use Docker which only requires the NVIDIA driver and toolkit. Instructions found here.

Start bash inside the container:

docker build -t gan-gpu .
docker run --rm -it --gpus all -v $PWD:/tf/src -u $(id -u):$(id -g) gan-gpu bash

Then all the above CLI commands should work as-is.

License

MIT License.

Parts of the code are modified from the DCGAN Tensorflow tutorial with the Apache License.

You can’t perform that action at this time.