This project page provides code that helps you to generate artistic from text description.
In this step, we utilzie the pre-trained model provided by the DM-GAN. Please check their repository for the implementation details.
- Python 2.7
- Pytorch 0.4
- Tensorflow 1.12.0
If you need to train the model for more epochs or evaluate the model, please clone the origninal DM-GAN repository.
If you only need to use the pre-traind model to generate images from your own captions, change the content of the file example_captions.txt
in either data/birds/
or data/coco/
folder, depending on the pre-trained model you choose.
Then follow the instruction below:
-
Go to
code/
folder -
Bird:
python main.py --cfg cfg/eval_DMGAN.yml
-
Coco:
python main.py --cfg cfg/eval_DMGAN.yml
In this step, we intend to classify the images generate based on the content and recommend suitable style images.
-
Python 3.5+
-
Pytorch 1.6
- Download the pre-trained model from here.
- Put image generated in step 1 under the folder
generated images
- Run the file
select_style_image.py
to randomly select the 5 style images for step 3. Selected images will be put in thestyle images
folder.
Classifying generated image by genres existed in WikiArt
- Donwload images classified by genre.
- Run the file
Finetune.py
In this step, we transfer the style of the style image selected in step 2 to content image generated in step 1.
- Python 3.5+
- Set up Magenta environment.
- Install tf-slim
Follow the instructions from here.