This is an implementation of the paper A Neural Algorithm of Artistic Style by Gatys, et al.
Below is an example of art generated by this code. It combines the style of a lovely painting by Megan Ducanson with a photograph of a tree in a field. Full disclosure: some of the results I did not post were quite terrible looking, so do not be discouraged if your first few attempts do not come out as you had hoped. I recommend experimenting a bit to get a feel for what works well and what doesn't. The same style image can have a very different effect on different content images, or with different hyperparameters.
To use:
- Download a pretrained VGG19 model here, and place it in the project directory.
- Replace
images/content.jpg
with a photo of your choice (600x600). - Replace
images/style.jpg
with an art image of your choice (600x600). - Navigate into the project directory in terminal
- Type
python neural_style_transfer.py
- That's it! Training will take several hours. Intermediate images will be generated at regular intervals.
- Check the
output
folder for results.
In developing this code I drew on the following implementations: