Giter Site home page Giter Site logo

dr-gan-by-pytorch's Introduction

DR-GAN-by-pytorch

  • Authors: Luan Tran, Xi Yin, Xiaoming Liu
  • CVPR2017: http://cvlab.cse.msu.edu/pdfs/Tran_Yin_Liu_CVPR2017.pdf
  • Pytorch implimentation of DR-GAN (updated version in "Representation Learning by Rotating Your Faces")
  • Added a pretrained ResNet18 to offer a feature loss in order to improve Generator's performance. (Only in Multi_DRGAN)

Requirements

  • python 3.x
  • pytorch 0.2
  • torchvision
  • numpy
  • scipy
  • matplotlib
  • pillow
  • tensorboardX

How to use

Single-Image DR-GAN

  1. Modify model function at base_options.py to define single model.

    • Data needs to have ID and pose lables corresponds to each image.
    • If you don't have, default dataset is CFP_dataset. Modify dataroot function at base_options.py.
  2. Run train.py to train models

    • Trained models and Loss_log will be saved at "checkpoints" by default. Generated pictures will be saved at "result".

    python train.py

    • You can also use tensorboard to watch the loss graphs in real-time. (Install tensorboard before doing it.)

    tensorboard --logdir=/home/zhangjunhao/logs (Or the address of dir 'logs' in your folder.)

  3. Generate Image with arbitrary pose

    • Change the "save_path" in base_model.py.
    • Specify leaned model's filename by "--pretrained_G" option in base_options.py.
    • Generated images will be saved at specified result directory.

    python test.py

Multi-Image DR-GAN

  1. Modify model function at base_options.py to define multi model.

    • Data needs to have ID and pose lables corresponds to each image.
    • If you don't have, default dataset is CFP_dataset. Modify dataroot function at base_options.py.
  2. Run train.py to train models

    • Trained models and Loss_log will be saved at "checkpoints" by default. Generated pictures will be saved at "result".

    python train.py

    • You can also use tensorboard to watch the loss graphs in real-time. (Install tensorboard before doing it.)

    tensorboard --logdir=/home/zhangjunhao/logs (Or the address of dir 'logs' in your folder.)

  3. Generate Image with arbitrary pose

    • Change the "save_path" in base_model.py.
    • Specify leaned model's filename by "--pretrained_G" option in base_options.py.
    • Generated images will be saved at specified result directory.

    python test.py

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.