Skip to content

An Introduction to Neural Style

Swaraj edited this page Dec 12, 2018 · 4 revisions

Neural Style Wiki Introduction

Welcome to the Neural style wiki, on this page there will be some information about how to install, resources and quick tips.


Installation

On the main github page there are several links to where everything can be downloaded, please follow all instruction for each dependency carefully. Here's a small checklist of the absolute basics per backend-type. You first of all need to download and unzip this git to a folder of your choice.

Prerequisites

NVIDIA/CUDA users

-A Linux distribution

-CUDA 6.5+ drivers installed and working

-CUDA supported GPU

-Torch

-Protobuff

-Loadcaffe

-cudnn.torch

-cunn

AMD/OpenCL users

-A Linux distribution, Ubuntu 14.04 64Bit is recommended, others will force you to downgrade your Xorg to be able to install the needed OpenCL drivers from the Catalyst package

-Catalyst 14.9 working

-Torch

-Protobuff

-Loadcaffe

-OpenCL supported GPU

-cltorch (and clnn, but that has been intergrated in the cltorch package)

CPU

-A Linux distribution

-Torch

-Protobuff

-Loadcaffe

Post dependacy installation

now you just have to perform:

sh models/download_models.sh

and voila, everything is ready to go.


Basic usage

After you installed everything, cd into the neural-style-master folder

The basic command exist out of th neural-style.lua with multiple options as specified on the main github page.

Setting up basic -options

To specify your input and output images you add -style_image <image1.jpg> -content_image <image2.jpg> -output_image <output.png> note that your style and content pictures should be in the /neural-style-master folder and when you specify the same output.png it will overwrite any images that already have that name!

To use your GPU you may need to add some extra options:

-backend cudnn -gpu 0 or -backend cunn -gpu 0 for CUDA users

-backend clnn -gpu 0 for OpenCL users

-backend OpenCL -gpu -1 or just -gpu -1 for CPU users

For more advanced options check Usage and results


A few cautions

Neural Style uses a lot of resources. All of your GPU or CPU depending which you use.

There is a hard limit on how large your images can be rendered, if you want a 1200px imagelength you need approximately 10GB of VRAM using GPU or 25GB of RAM using CPU.

CPU is way slower than GPU, most people who use CPU based rendering have CPUs that cost more than your standard PC and even then it takes them 12 hours per image. GPU users with decent GPUs can finish the same 1000 iterations within 10 minutes


Quick FAQ

Q Windows support when?

A Not anytime soon and probably never officially, you're free to try for yourself though!

Q I got an error [input long error here] pls help!

A Check if you instlled everyhting, check if your CUDA and/or OpenCL are working, check if you used the right backend, if everything seems okay, try adding -image_size 40 to your command, if that doesn't return an error you can gradually increase from 40 until it gives an error again, it means that your PC isn't good enough to process the default -image_size 512. If it still failed with -image_size 40 raise an issue here on github with all the logs/information you can provide.

Q I want more pixels!!!

A Check the Usage and results for useful tips