Skip to content

A dockerized version of the neural style algorithm by jcjohnson

License

Notifications You must be signed in to change notification settings

lazyman1992/neural-style-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

neural-style-docker

Stylized Docker Stylized Docker Stylized Docker Stylized Docker Stylized Docker Stylized Docker Stylized Docker Stylized Docker Stylized Docker Stylized Docker Stylized Docker Stylized Docker

A dockerized version of the neural style algorithm by jcjohnson. nvidia-docker is used to make use of GPU hardware.

Install

Prerequisites

Installation

You can either pull the Docker image from Docker Hub with

docker pull albarji/neural-style

or build the image locally with

make

Simple use

Just run

bash scripts/fake-it.sh

This applies a blend of content and style with some default parameters. Both content and style images must be present in the "contents" and "styles" folders, respectively.

Example: to draw the Golden Gate bridge the style of Van Gogh's Starry Night, type

bash scripts/fake-it.sh goldengate.jpg vangogh.jpg

Advanced use

Generating variants

Running the command script

bash scripts/variants.sh

will generate several variants of the same image blends, for different neural-style parameters that work well in general. This is useful for producing several versions of the same blend and afterwards hand-picking the best one. Run this command with the -h option to obtain usage help.

For example, to generate different variants of Docker logo + Starry Night:

bash scripts/variants.sh --contents contents/docker.png --styles styles/vangogh.jpg

Use as the neural-style command

You can directly invoke the core neural-style algorithm by simply running a container of this image, for example:

nvidia-docker run --rm albarji/neural-style -h

produces the usage help.

To apply the neural-style method on some host images, map the host folder with such images to the container /images folder through a volume such as

nvidia-docker run --rm -v $(pwd):/images albarji/neural-style -backend cudnn -cudnn_autotune -content_image content.png -style_image style.png

The container uses as work directory the /images folder, so the results will be readily available at the mounted host folder.

In order to take full advantage of the cudnn libraries (also included in the image) the options -backend cudnn -cudnn_autotune are always recommended.

As an example, let's redraw Docker's logo in the famous style of Van Gogh's Starry Night:

nvidia-docker run --rm -v $(pwd):/images albarji/neural-style -backend cudnn -cudnn_autotune -content_image contents/docker.png -style_image styles/vangogh.jpg

About

A dockerized version of the neural style algorithm by jcjohnson

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 96.6%
  • Makefile 3.4%