SAW-GAN: Multi-Granularity Text Fusion Generative Adversarial Networks for Text-to-Image Generation
- python 3.9
- pytorch 1.9
- Install CLIP
In addition, please add the project folder to PYTHONPATH and pip install
the following packages:
python-dateutil
easydict
pandas
torchfile
nltk
scikit-image
Data
- Download the preprocessed metadata for birds coco and extract them to
data/
- Download the birds image data. Extract them to
data/birds/
- Download coco2014 dataset and extract the images to
data/coco/images/
Training
cd SAW-GAN/code/
- Train SAW-GAN model:
- For bird dataset:
bash scripts/train.sh ./cfg/bird.yml
- For coco dataset:
bash scripts/train.sh ./cfg/coco.yml
- For bird dataset:
Pretrained Model
- [SAW-GAN for bird] Download and save it to
./code/saved_models/pretrained/
- [SAW-GAN for coco] Download and save it to
./code/saved_models/pretrained/
Validation
cd SAW-GAN/code/
set pretrained_model in test.sh
- For bird dataset:
bash scripts/test.sh ./cfg/bird.yml
- For COCO dataset:
bash scripts/test.sh ./cfg/coco.yml