This is my PyTorch implementation of StackGAN++ as it is delineated in the paper and the official repo. I attempted to implement it in a configurable way so as to allow for easy experimentation, e.g. I easily set it up afterwards to include a contrastive loss or for Zero-shot Learning. Check out the paper (where I got the above image from) and show some love to the authors at their official repo.
Download datasets from links in the official repo. The dataset classes expect your dataset directory to be something like:
CUB
|
|- images
| |
| |- 001.Black_footed_Albatross
| | |
| | |- Black_footed_Albatross_#.jpg
| | |- ...
| |- ...
|
|- embeddings
| |
| |- char-CNN-RNN-embeddings.pickle
| |- class_info.pickle
| |- filenames.pickle
|
|- ...other necessary CUB stuff...
The StackGAN class can be found in stackgan/modules/stackgan_v2.py
, its training routine in stackgan/training/stackgan_v2.py
and all other necessary components can be traced via the imports in these files. To train a StackGAN++, you can use the script scripts/train_stackgan_v2
, after configuring the parameters in it to your liking and configuration. Logs and PyTorch models are created automatically. All you need to use the trained model afterwards is to create a StackGAN class instance and load the corresponding .pt
file. Happy hacking!
Generative Adversarial Text-to-Image Synthesis https://arxiv.org/abs/1605.05396
@article{Bodnar2018TextTI, title={Text to Image Synthesis Using Generative Adversarial Networks}, author={Cristian Bodnar}, journal={CoRR}, year={2018}, volume={abs/1805.00676} }