Code Monkey home page Code Monkey logo

keras_began's Introduction

About

Implementation BEGAN(Boundary Equilibrium Generative Adversarial Networks) by Keras.

Version

Developed by these software versions.

  • Mac OS Sierra: 10.12.4
  • Python: 3.5.3
  • Keras: 2.0.3
  • Theano: 0.9.0
  • Pillow: 4.1.0

How to Use

Setup

pip install -r requirements.txt

Create Dataset

Prepare Image

You can use any square images. For example,

images in http://vis-www.cs.umass.edu/lfw/

[new] All images aligned with deep funneling 
(111MB, md5sum 68331da3eb755a505a502b5aacb3c201)

Convert Images to 64x64 pixels

Install imagemagick

For convert command, install imagemagick.

brew install imagemagick

Convert Images

  • ORIGINAL_IMAGE_DIR: dir of original JPG images
  • TARGET_DIR: dir of after converted images
ORIGINAL_IMAGE_DIR=PATH/TO/ORIGINAL/IMAGE_DIR
CONVERTED_DIR=PATH/TO/CONVERTED/IMAGE_DIR

mkdir -p "$CONVERTED_DIR"
for f in $(find "$ORIGINAL_IMAGE_DIR" -name '*.jpg')
do
  echo "$f"
  convert "$f" -resize 64x64 ${CONVERTED_DIR}/$(basename $f)
done

Create Dataset

PYTHONPATH=src python src/began/create_dataset.py "$CONVERTED_DIR"

Training BEGAN

PYTHONPATH=src python src/began/training.py

Images are generated in each epoch into generated/epXXX/ directory.

Training History

FYI: epoch time in training

About 680 sec/epoch

  • Linux

  • Dataset: All images aligned with deep funneling (13194 samples)

  • Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz

  • GeForce GTX 1080

  • Environment Variables

    KERAS_BACKEND=theano
    THEANO_FLAGS=device=gpu,floatX=float32,lib.cnmem=1.0

Generate Image

PYTHONPATH=src python src/began/generate_image.py

Generated images are outputted in generated/main/ directory.

Generated Image Examples

Epoch 1
Epoch 25
Epoch 50
Epoch 75
Epoch 100
Epoch 125
Epoch 150
Epoch 175
Epoch 200
Epoch 215

more filters or layers?

Memo

Trouble: Running with Theano 0.9.0 CPU mode on Linux

Theano 0.9.0 CPU mode on Linux seems to have memory leak problem. See: keras-team/keras#5935

keras_began's People

Contributors

mokemokechicken avatar

Watchers

Sungjin Kim avatar paper2code - bot avatar

Forkers

sungb

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.