Tag Archives: style transfer using machine learning

How to Transfer an Art Style to Any Image

Machine learning and artificial intelligence have been on my radar for years now, but more as a concept and “thing I should know about.” I didn’t feel that I had the free time or skills to dig into it. However, my attitude about machine learning has changed in the past few months. I have seen new and easier tools become accessible to the public. In this post I will walk you through how to transfer an art style to any image using some of these tools.

One such tool is called Spell. Last week I spent days trying to set up Tensorflow on my laptop. The hardest part was getting the correct dependencies to run a style transfer algorithm. Transferring the style of an artist I admire to my photography seemed like one of the coolest things I could do, and I was determined. That determination wavered after traversing several levels of dependency hell. Eventually I realized that my machine could take days or weeks to train on a single artwork. That was when I decided to outsource. The tedium and frustration of dependency management as well as the expense/speed of the GPU was going to be handled by Spell.

An example of style transfer from Priyanka Mandikal’s blog

What’s great about Spell is it is absolutely free to sign up, and when you run commands they run remotely on Spell’s many CPU’s and GPU’s so you don’t have to keep your machine on for days at a time. They do charge you when you use their GPU’s, but the prices are very reasonable, and you are only charged for the time that the GPU was actually training your model (the one I paid for was $0.90 per hour, and training the model took 8 hours). They have good documentation and a very user friendly design, just to sweeten the deal.

Spell also had wonderful tutorials, one which actually included the Style Transfer training that I had been trying to execute. See it for yourself here.

The Scream by Edvard Munch

After some debate I decided to train my model on one of Edvard Munch‘s paintings (no, not The Scream, even though it’s a great one). Unfortunately, it didn’t turn out as cool as I hoped. I think this might be because I did not adjust he parameters for color or abstraction. Still, it was an exciting moment when I finally got the style transfer to work. I am even more excited to keep experimenting with it.

If you are interested in experimenting with AI and Machine Learning yourself, I highly recommend trying out Spell. Now you can show your friends how to transfer an art style to any image and play around with your own!

If you enjoyed this article, consider following me on Twitter @nadyaprimak or if you need more tips on breaking into the tech industry, you can read my book “Foot in the Door”.