Code Monkey home page Code Monkey logo

pytorch_discogan's Introduction

DiscoGAN in Pytorch

Study Friendly Implementation of DiscoGAN in Pytorch

More Information: Original Paper

Implemenation based on Official Implementation, but Simplified.

1. Environments

  • Ubuntu 16.04
  • Python 3.6 (Anaconda)
  • Pytorch 0.2.0
  • Torchvision 0.1.9
  • PIL
  • cv2 (OpenCV) (pip install python-opencv)

2. Code Description

  • discogan.py: Main Code
  • discogan_test.py: Test Code after Training
  • network.py: Generator and Discriminator
  • db/download.sh: DB Downloader (Edges/Shoes/Handbags)
  • db/download.py: DB Downloader (Facescrub)

3. Networks and Parameters

3.1 Hyper-Parameters

  • Image Size = 64x64
  • Batch Size = 64
  • Learning Rate = 0.0002
  • Weight Decay = 0.00001
  • Adam_beta1 = 0.5
  • Loss Weights: See the code
  • Scheduling: See the code

3.2 Generator Networks (network.py)

3.3 Discriminator Networks (network.py)

4. DB Download

4.1 Edges2Shoes / Edges2Handbags / Handbags2Shoes

./db/download.sh dataset_name

dataset_name can be one of [edges2shoes, edges2handbags]

You can do handbags2shoes using both datasets.

  • edges2shoes : 600x500, 1096 for Train, 1098 for Val
  • edges2handbags : 256x256, 138567 for Train, 200 for Val

4.2 Facescrubs

python ./db/download.py

This code downloads face image independently. So there are some problems.

After download images 10~20k,

You should remove some broken images MANUALLY. :<

  • facescrub/actors/face : Various Size
  • facescrub/actresses/face : Various Size

5. Train

5.1 edges2shoes (or handbags)

python discogan.py --task edges2shoes #(or handbags)

5.2 Handbags2Shoes

python discogan.py --task handbags2shoes --starting_rate 0.5

5.3 Facescrubs

python discogan.py --task facescrubs

6. Test

After finish training, saved models are in the ./models directory.

python discogan_test.py --task taskname --num_epochs N --batctSize M
  • batchSize means test sample size.
  • num_epochs is the parameter which model will be used for test.

Test results will be saved in ./test_result

7. Results

[Input A | A to B | A to B to A]

[Input B | B to A | B to A to B]

Edges to Shoes, Shoes to Edges (20 Epochs)

Handbags to Shoes, Shoes to Handbags (30 Epochs)

Face: Men to Women, Women to Men (150 Epochs)

pytorch_discogan's People

Contributors

kmes055 avatar taeoh-kim avatar

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.