Skip to main content

Neural Style Transfer

Create artificial artwork by transferring the appearance of one image (ie a famous painting) to another user-supplied image (e.g. your favorite photo).

Documentation: https://boromir674.github.io/neural-style-transfer/

Demo Content Image + Demo Style Image = Demo Gen Image

Uses a Neural Style Transfer algorithm to transfer the style (aka appearance), from one image, into the contents of another.

Neural Style Transfer (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 as INPUT a Content image (e.g. a picture taken with your camera) and a Style image (e.g. a Van Gogh painting) and Generates a new image.

Overview

This project provides an NST algorithm through

  • the artificial_artwork Python package (aka module)
  • the nst CLI
  • the boromir674/neural-style-transfer Docker image
Build Package Containerization Code Quality
CI Pipeline Status PyPI Wheel Python Versions Commits Since Docker Image Size Codacy Code Climate Maintainability Scrutinizer

Features

  • VGG-19 Convolutional Neural Network, as Image model
  • Selection of style layers at runtime
  • Efficient Iterative Learning Algorithm, with tensorflow
  • Fast minimization of loss/cost function with parallel/multicore execution
  • Selection of Algorithm Termination Condition/Criteria, at runtime
  • Periodic persistance of Generated image, during Learning loop

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:

Note: Installation on Debian-based Distros for Python 3.11 require distutils which is not included in python3.11 standard distribution (but included in python3.10).

sudo apt-get install python3.11-distutils
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.

Release files for artificial-artwork 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for artificial-artwork 2.0.0
File Size Uploaded
artificial_artwork-2.0.0.tar.gz 1.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for artificial-artwork 2.0.0
File Interpreter ABI Platform
artificial_artwork-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.4 MB

Release files / artificial_artwork-2.0.0.tar.gz

Download URL artificial_artwork-2.0.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
a941f19ce93cddfb873bd9ce238650ba985135a5ac558f230aaa9610903f5b6b
BLAKE2b-256 checksum
How to use checksums
cb3a3a90b05f6dd31e54e463aad48f8cc35b7f24843a011c60796de674fd81bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.0 importlib_metadata/8.5.0 packaging/24.2 pkginfo/1.11.2 requests/2.32.3 requests-toolbelt/1.0.0 tqdm/4.67.0 CPython/3.10.12

Release files / artificial_artwork-2.0.0-py3-none-any.whl

Download URL artificial_artwork-2.0.0-py3-none-any.whl
Size 76.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c6fba3d134b611b42bfad52a470165bf07955e4164104cdfcbf5345c09a7ef0
BLAKE2b-256 checksum
How to use checksums
220854f8b5b800b3ad567cd5426d39c8b9a8854e2562bf4934b0729562c2b7d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.0 importlib_metadata/8.5.0 packaging/24.2 pkginfo/1.11.2 requests/2.32.3 requests-toolbelt/1.0.0 tqdm/4.67.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.1.0

2 release files

1.0.2

1 release file

1.0.0

2 release files

0.6.1

2 release files

0.6

2 release files

0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page