Pytorch implementation of paper: AttnGAN Fine-Grained Text to Image Generation with Attentional Generative Adversarial Networks
Pytorch implementation for reproducing AttnGAN results in the paper AttnGAN: Fine-Grained Text to Image Generation
with Attentional Generative Adversarial Networks.
python 2.7
Pytorch
In addition, please add the project folder to PYTHONPATH and pip install
the following packages:
python-dateutil
, easydict
, pandas
, torchfile
, nltk
, scikit-image
Data
data/
data/coco/text/
pretrain_DAMSM.py
.train2014
and val2014
images to data/coco/images/
Training
python pretrain_DAMSM.py --cfg cfg/DAMSM/coco.yml --gpu 0
Train AttnGAN models:
python main.py --cfg cfg/coco_attn2.yml --gpu 0
*.yml
files are example configuration files for training/evaluation our models.
Pretrained Model
DAMSMencoders/
models/
Sampling
python main.py --cfg cfg/eval_coco.yml --gpu 1
to generate examples from captions in files listed in “./data/coco/example_filenames.txt”. Results are saved to DAMSMencoders/
. eval_*.yml
files to generate images from other pre-trained models. Validation
python main.py --cfg cfg/eval_coco.yml --gpu 1
Examples generated by AttnGAN [Blog]
bird example | coco example |
---|---|
![]() |
![]() |
If you find AttnGAN useful in your research, please consider citing:
@article{Tao18attngan,
author = {Tao Xu, Pengchuan Zhang, Qiuyuan Huang, Han Zhang, Zhe Gan, Xiaolei Huang, Xiaodong He},
title = {AttnGAN: Fine-Grained Text to Image Generation with Attentional Generative Adversarial Networks},
Year = {2018},
booktitle = {{CVPR}}
}