Shoot like an artist – Using imagination, artificial intelligence, Tensorflow (& GPU)

natural-art

After I got opencv, mxnet and tensorflow working with CUDA, I was looking for tensorflow implementation of “A Neural Algorithm of Artistic Styleresearch paper and I found this.

I found  tensorflow implementation by Anish for the above research paper and I took from there.

Why Tensorflow:

  • TensorFlow supports automatic differentiation and has a clean API
  • Research paper steps are translated into code here
  • It has support for GPU (CUDA) so I can get works done faster (Time is $$)

 

Pre-requisite:

  • Ubuntu 16.04
  • Python 2.7
  • Tensorflow with GPU support

Commands:

  • Command for help:
    • $ python neural_style.py –help
  • Basic command:
    • $ python neural_style.py –content your_content.jpg –style your_style.jpg –output output_file_name.png –iteration 500
  • If you decided to use the output as input style you sure can do to get improved results
    • $ python neural_style.py –content your_content.jpg –style your_previous_output.png –output new_output_file_name.png –iteration 500

Few things I found:

  • If you have both content and style image as png you may get the following error
    • ValueError: Dimensions must be equal, but are 4 and 3
  • To solve it just use both content and style image as jpg.
  • If you have less memory in machine use both content and style image smaller under 480×480 size.

Example:

Top left after 500 iteration, top right after 2000 iteration and bottom image after 3500 iteration:

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s