Convolutional Neural NetworksDemo ProjectsNeural NetworksTensorflow

Neural Style Transfer with TensorFlow CNN

By April 29, 2019 No Comments

Project Overview

One of my favorite machine learning applications, neural style transfer is an example of Machine Learning synthesis. What do I mean by that? Well, instead of training a machine learning model to predict something we instead train a model to create something new. In this case an image!

This simple project demonstrates a method of training an ML model to learn and apply style from one photo (the style image) to another (the content image).

This is a super fun project that you can use to stylize your own photos!

Getting Started

Make sure you’ve signed up for a JetML account and that you have enough credits to run the project, then click the “Launch on JetML” button below.

Make sure you keep the project in Python 3. Also, I highly recommend using a GPU server to help speed up the training time. 

Content Image

Style Image

Stylized Image

Content Image

Style Image

Stylized Image

Training the Model

When your server is ready and in the “running” status (about 5-10 min), click to open your server’s Jupyter notebooks.

Open the artistic_style_transfer.ipynb notebook and click the run button.

And that’s all you need to do!

You should start seeing the output of the model as it trains.

Since the neural network starts from a random state, the initial outputs are pure static over your content image. However, the GPU will make quick work of training the network.

Within a few batches, the network has already started learning how to apply the style to your content image.

After about 1 minute of training, the network starts generating an impressive rendition of your original image.

How to Adapt This Project

Try replacing the content and style images with your own!

Software Used

Tensorflow, Jupyter Notebook, Python 3

Recommended Servers

Single or Multi GPU

Github Source

Source Author

Harish Narayanan

nick@jetml.com

nick@jetml.com

JetML was founded in 2018 by Nicholas Mote, a tech leader and machine learning evangelist based in Portland, Oregon. Nick came to machine learning while solving complex pricing and operations problems for vacation rental management firm Vacasa.

Leave a Reply