Git Product home page Git Product logo

attgan-tensorflow's Introduction

     


TensorFlow implementation of AttGAN: Facial Attribute Editing by Only Changing What You Want

Related

Exemplar Results

  • See results.md for more results, we try higher resolution and more attributes (all 40 attributes!!!) here

  • Inverting 13 attributes respectively

    from left to right: Input, Reconstruction, Bald, Bangs, Black_Hair, Blond_Hair, Brown_Hair, Bushy_Eyebrows, Eyeglasses, Male, Mouth_Slightly_Open, Mustache, No_Beard, Pale_Skin, Young

  • Comparisons with VAE/GAN and IcGAN on inverting single attribute

  • Comparisons with VAE/GAN and IcGAN on simultaneously inverting multiple attributes

Usage

  • Prerequisites

    • TensorFlow 1.7+
    • Python 2.7 or 3.6
  • Dataset

    • Celeba dataset

    • HD-Celeba (optional)

      • the images of img_align_celeba.zip are low resolution and uncropped, higher resolution and cropped images are available here
      • the high quality data should be placed in ./data/img_crop_celeba/*.jpg
  • Well-trained models: download the models you need and unzip the files to ./output/ as below,

    output
    ├── 128_shortcut1_inject1_none
    └── 384_shortcut1_inject1_none_hd
    
  • Examples of training

    • see examples.md for more examples

    • training

      • for 128x128 images

        CUDA_VISIBLE_DEVICES=0 \
        python train.py \
        --img_size 128 \
        --shortcut_layers 1 \
        --inject_layers 1 \
        --experiment_name 128_shortcut1_inject1_none
      • for 384x384 images

        CUDA_VISIBLE_DEVICES=0 \
        python train.py \
        --img_size 384 \
        --enc_dim 48 \
        --dec_dim 48 \
        --dis_dim 48 \
        --dis_fc_dim 512 \
        --shortcut_layers 1 \
        --inject_layers 1 \
        --n_sample 24 \
        --experiment_name 384_shortcut1_inject1_none
      • for 384x384 HD images (need HD-Celeba)

        CUDA_VISIBLE_DEVICES=0 \
        python train.py \
        --img_size 384 \
        --enc_dim 48 \
        --dec_dim 48 \
        --dis_dim 48 \
        --dis_fc_dim 512 \
        --shortcut_layers 1 \
        --inject_layers 1 \
        --n_sample 24 \
        --use_cropped_img \
        --experiment_name 384_shortcut1_inject1_none_hd
    • tensorboard for loss visualization

      CUDA_VISIBLE_DEVICES='' \
      tensorboard \
      --logdir ./output/128_shortcut1_inject1_none/summaries \
      --port 6006
  • Example of testing single attribute

    CUDA_VISIBLE_DEVICES=0 \
    python test.py \
    --experiment_name 128_shortcut1_inject1_none \
    --test_int 1.0
  • Example of testing multiple attributes

    CUDA_VISIBLE_DEVICES=0 \
    python test_multi.py \
    --experiment_name 128_shortcut1_inject1_none \
    --test_atts Pale_Skin Male \
    --test_ints 0.5 0.5
  • Example of attribute intensity control

    CUDA_VISIBLE_DEVICES=0 \
    python test_slide.py \
    --experiment_name 128_shortcut1_inject1_none \
    --test_att Male \
    --test_int_min -1.0 \
    --test_int_max 1.0 \
    --n_slide 10

Citation

If you find AttGAN useful in your research work, please consider citing:

@ARTICLE{8718508,
author={Z. {He} and W. {Zuo} and M. {Kan} and S. {Shan} and X. {Chen}},
journal={IEEE Transactions on Image Processing},
title={AttGAN: Facial Attribute Editing by Only Changing What You Want},
year={2019},
volume={28},
number={11},
pages={5464-5478},
keywords={Face;Facial features;Task analysis;Decoding;Image reconstruction;Hair;Gallium nitride;Facial attribute editing;attribute style manipulation;adversarial learning},
doi={10.1109/TIP.2019.2916751},
ISSN={1057-7149},
month={Nov},}

attgan-tensorflow's People

Contributors

lynnho 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.