SpatialAttentionGAN icon indicating copy to clipboard operation
SpatialAttentionGAN copied to clipboard

SaGAN PyTorch "Generative Adversarial Network with Spatial Attention for Face Attribute Editing"

Spatial Attention Generative Adversarial Network

This repository contains the PyTorch implementation of the ECCV 2018 paper "Generative Adversarial Network with Spatial Attention for Face Attribute Editing" (pdf).

My results with images and attention masks on CelebA 128 (original, eyeglasses, mouth_slightly_open, no_beard, smiling)

Results

Requirements

  • Python 3.5
  • PyTorch 1.0.0
pip3 install -r requirements.txt

The training procedure described in paper takes 5.5GB memory on a single GPU.

  • Datasets

    • CelebA
      • Put Align&Cropped Images in ./data/celeba/*.jpg
      • Put Attributes Annotations in ./data/list_attr_celeba.txt
  • Pretrained models (download from http://bit.ly/sagan-results and decompress the zips to ./results)

      results
      ├── celeba_128_eyeglasses
      ├── celeba_128_mouth_slightly_open
      ├── celeba_128_no_beard
      └── celeba_128_smiling
    

Usage

Train a model with a target attribute

python3 train.py --experiment-name celeba_128_eyeglasses --target-attr Eyeglasses --gpu

Generate images from trained models

python3 generate.py --experiment-name celeba_128_eyeglasses --gpu