Skip to content

Re-paint any image with the style of another image using a neural style transfer algorithm accessible through an easy-to-use cli.

License

Notifications You must be signed in to change notification settings

boromir674/neural-style-transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Style Transfer - CLI

Create artificial artwork by transfering the appearance of one image (eg a famous painting) to another user-supplied image (eg your favourite photograph).

Demo Content Image + Demo Style Image
=
Gen Image

Uses a Neural Style Transfer algorithm to transfer the appearance, which you can run though a CLI program.

Neural Style Tranfer (NST) is an algorithm that applies the style of an image to the contents of another and produces a generated image. The idea is to find out how someone, with the painting style shown in one image, would depict the contents shown in another image.

NST takes a content image (eg picture taken with your camera) and a style image (eg a picture of a Van Gogh painting) and produces the generated image.

This Python package runs a Neural Style Tranfer algorithm on input content and style images to produce generated images.

build
package
PyPI PyPI - Wheel PyPI - Python Version GitHub commits since tagged version (branch)
containerization
Docker Image Version (tag latest semver) Docker Image Size (tag)
code quality Codacy Maintainability Technical Debt Scrutinizer code quality

Overview

This package exposes a configurable NST algorithm via a convenient CLI program.

Key features of the package:

  • Selection of style layers at runtime
  • Iterative Learning Algorithm using the VGG Deep Neural Network
  • Selection of iteration termination condition at runtime
  • Fast minimization of loss/cost function with parallel/multicore execution, using Tensorflow
  • Persisting of generated images

Quick-start

Run a demo NST, on sample Content and Style Images:
mkdir art
export NST_HOST_MOUNT="$PWD/art"

docker-compose up

# Process runs, in containerized environment, and exits.
Check out your Generated Image!
Artificial Artwork: art/canoe_water_w300-h225.jpg+blue-red_w300-h225.jpg-100.png
xdg-open art/canoe_water_w300-h225.jpg+blue-red_w300-h225.jpg-100.png

Usage

Run the nst CLI with the --help option to see the available options.

docker run boromir674/neural-style-transfer:1.0.2 --help

Development

Installation

Install nst CLI and artificial_artwork python package from pypi`:

pip install artificial_artwork

Only python3.8 wheel is included atm.

Sample commands to install the NST CLI from source, using a terminal:

git clone https://github.com/boromir674/neural-style-transfer.git

pip install ./neural-style-transfer
The Neural Style Transfer - CLI heavely depends on Tensorflow (tf) and therefore it is crucial that tf is installed correctly in your Python environment.