This repository provides PyTorch implementations for RankCGAN paper published in BMVC 2018.
This code is based on DCGAN implementation pytorch-DCGAN.
The model architecture comprises three modules, the discriminator, generator and ranker. As shown in the following Figure:
In this code, only UT-Zap50K dataset is used. For other datasets, please edit dataloader.py
accordingly.
- Python 3.5.2
- Pytorch 0.4.0
- NVIDIA GPU + CUDA CuDNN
- Install PyTorch 0.4+ and torchvision from http://pytorch.org.
- Clone this repository.
git clone https://github.com/saquil/RankCGAN
cd RankCGAN
The code provides two implementations. RankCGAN.py
demonstrates one attribute conditional model and RankCGAN_2D.py
demonstrates multiple attributes case with two attributes conditional model.
- Train a model on single attribute:
python3 main.py --gan_type=RankCGAN
- Train a model on multiple attributes:
python3 main.py --gan_type=RankCGAN_2D
- 1D images generation:
Generated shoe (top), face (middle), and scene (bottom) images associated with their ranking scores using “sporty”, “masculine” and “natural” attributes respectively.
- 2D images generation:
Example of two-attributes interpolation on shoe and face images using (“sporty",“black") and (“masculine",“smiling") attributes.
If you use this code for your research, please cite our paper.
@inproceedings{saquil2018ranking,
title={Ranking CGANs: Subjective Control over Semantic Image Attributes},
author={Saquil, Yassir and Kim, Kwang In and Hall, Peter}
booktitle={British Machine Vision Conference (BMVC)},
year={2018}
}