NVIDIA’s FastPhotoStyle Library Will Make you an Artist (with Python codes)

Pranav Dar Last Updated : 21 Feb, 2018
2 min read

Overview

  • NVIDIA’s library makes styling photos simpler
  • The entire code has been made in python
  • Install dependencies, run a line of code, and you’re good to go
  • Read on to access the entire code and run the code on your machine

 

Introduction

NVIDIA has released a python library that will make you want to become an artist.

The model takes a content photo and a style photo as inputs. It then transfers the style of the style photo to the content photo. You can see a couple of examples in the below images:

In the user’s manual, the developers have cited two examples to show how the algorithm works. The first is a very simple iteration – you download a content and a style image, re-size them, and then simply run the photorealistic image stylization code:

python demo.py

In the second example, semantic label maps are used to create the stylized image. Take a look at the below image to get a general idea of how the labeling process works.

Before you use this library, you need to have the below python dependencies:

conda install pytorch torchvision cuda90 -y -c pytorch

conda install -y -c menpo opencv3

conda install -y -c anaconda pip

pip install scikit-umfpack

pip install cupy

pip install pynvrtc

To read more about the details of the algorithm that went into developing this code, you can view the official research paper here.

You can access the python code on the library’s official GitHub page here.

 

Our take on this

In their paper, the developers compare their approach to previous attempts (Luan, et all) and for a 1024×512 image, they are almost 30-60 times faster! They are also more accurate with their algorithm. The algorithm is being refined behind the scenes and more refinements are expected. It’s prety awesome on NVIDIA’s part to have made the entire deep learning code accessible to the general public.

The only issue here could be with the license this has been released under. It’s a non-commercial license (CC BY-NC-SA 4.0 license) which means professional artists cannot sell any of their works made using this library.

 

Subscribe to AVBytes here to get regular data science, machine learning and AI updates in your inbox!

 

Senior Editor at Analytics Vidhya.Data visualization practitioner who loves reading and delving deeper into the data science and machine learning arts. Always looking for new ways to improve processes using ML and AI.

Responses From Readers

Clear

Bill E.
Bill E.

Hey, sir! Fun little article. You have a github repo I could visit beyond their official one?

We use cookies essential for this site to function well. Please click to help us improve its usefulness with additional cookies. Learn about our use of cookies in our Privacy Policy & Cookies Policy.

Show details