Recently we stumbled upon a very interesting project, it is called neural-style which is a torch implementation of an artificial system based on a Deep Neural Network that attempts to create artistic images of high perceptual quality.
According to the authors, this tool is based on the paper of Leon A. Gatys, Alexander S. Ecker and Matthias Bethge which is called “A Neural Algorithm of Artistic Style” (which is available to read for free here).
What this tool does is ‘simple’, it takes as input two images, the style image
and the content image
and using the style image
, it tries to recreate the content image
in such way that the content image
looks like it was created using the same technique as the style image
.
Following, is an example of a photograph that was recreated using the style of The Starry Night.
This tool offers a ton of possibilities and options, which we still did not play through yet.
Overall, we are very happy with the initial results we got. The final renderings look really nice and the fact that you get to choose your own style images it gives this tool a very nice advantage.
What we did not like though, is that it takes a lot of time and memory to complete the rendering of a single image (especially if you do not use a GPU to speed up the process).
This issue with the resources is normal and expected, unfortunately though it limits the fun out of the system. Each experiment you make is blocking you for some time and you cannot fiddle with the results in real time.
We installed this tool both on a Fedora GNU/Linux
and on an Ubuntu
with success.
Following are the exact commands we used to install it on Ubuntu
and convert our first image (the one above).
cd ~; git clone https://github.com/torch/distro.git ~/torch --recursive; cd ~/torch; bash install-deps; ./install.sh; source ~/.bashrc; sudo apt-get install libprotobuf-dev protobuf-compiler; CC=gcc-5 CXX=g++-5 luarocks install loadcaffe; luarocks install cutorch cd ~/ git clone https://github.com/jcjohnson/neural-style.git; cd neural-style/; sh models/download_models.sh; #After everything is complete, it is time to create our first 'artistic' image. th neural_style.lua -num_iterations 1500 -image_size 1250 -gpu -1 -style_image "/home/bytefreaks/Pictures/Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg" -content_image "/home/bytefreaks/Pictures/Aphrodite Hills Golf Course - Paphos, Cyprus.jpg"
Our input images were the following:
Content Image
Style Image
Below are the intermediate steps the tool created until it reached the final rendered image.
Useful links
- For significantly more information on the project visit this link https://github.com/jcjohnson/neural-style
- To read about the background behind this technology read this paper https://arxiv.org/abs/1508.06576
This post is also available in: Greek