Home

Awesome

CPGAN

Pytorch implementation for reproducing CPGAN results in the paper CPGAN: Full-Spectrum Content-Parsing Generative Adversarial Networks for Text-to-image Synthesis by Jiadong Liang, Wenjie Pei, Feng Lu.

<img src="model_structure.jpg" width="900px" height="280px"/>

Getting Started

conda create -n CPGAN python=2.7
conda activate CPGAN
conda install pytorch=1.0.1 torchvision==0.2.1 cudatoolkit=10.0.130
pip install python-dateutil easydict pandas torchfile nltk scikit-image h5py pyyaml
https://github.com/dongdongdong666/CPGAN.git

Test

Sampling

Validation

python caculate_IS.py --dir ../outputs/Inference_Images/single/
python caculate_R_precison.py --cfg cfg/coco.yml --gpu 0 --valid_dir ../outputs/Inference_Images/single/

Train

TBA

Examples generated by CPGAN

<img src="VIS_Each_model.jpg"/> <img src="VIS_Previous.jpg"/>

Performance

Note that after cleaning and refactoring the code of the paper, the results are slightly different. We use the Pytorch implementation to measure inception score and R precision.

ModelR-precision↑IS↑
Reed(-)7.88 ± 0.07
StackGAN(-)8.45 ± 0.03
Infer(-)11.46 ± 0.09
SD-GAN(-)35.69 ± 0.50
MirrorGAN(-)26.47 ± 0.41
SEGAN(-)27.86 ± 0.31
DMGAN88.56%30.49 ± 0.57
AttnGAN82.98%25.89 ± 0.47
objGAN91.05%30.29 ± 0.33
CPGAN93.59%52.73 ± 0.61

Citing CPGAN

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

@misc{liang2019cpgan,
    title={CPGAN: Full-Spectrum Content-Parsing Generative Adversarial Networks for Text-to-Image Synthesis},
    author={Jiadong Liang and Wenjie Pei and Feng Lu},
    year={2019},
    eprint={1912.08562},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}