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


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 $$)



  • Ubuntu 16.04
  • Python 2.7
  • Tensorflow with GPU support


  • Command for help:
    • $ python –help
  • Basic command:
    • $ python –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 –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.


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



Leave a Reply

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

You are commenting using your 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 )

Connecting to %s