/prism

High Resolution Style Transfer in PyTorch with Color Control and Mixed Precision :art:

Primary LanguagePythonMIT LicenseMIT

Installation

pip install git+https://github.com/moritztng/prism.git

Quickstart

Open in Colab Read the Docs

Minimal Example

style-transfer content.jpg style.jpg

Complex Example

style-transfer content.jpg style.jpg --artwork artwork.png --style_weight 1000 --lr 1 --iter 500
Content Style
Artwork

Features

High Resolution

# Create low-resolution artwork with area of 512 * 512. 
style-transfer content.jpg style.jpg
# Initialize with low-resolution artwork to create artwork with area of 1024 * 1024. 
style-transfer content.jpg style.jpg --init_img artwork.png --area 1024 --iter 200

Mixed Precision

Faster training, less memory, same quality on GPUs.

style-transfer content.jpg style.jpg --use_amp

Preserve Content Color

style-transfer content.jpg style.jpg --preserve_color content

Python Object

from PIL import Image
from style_transfer.learn import StyleTransfer

style_transfer = StyleTransfer()
artwork = style_transfer(Image.open('content.jpg'), Image.open('style.jpg'))
artwork.save('artwork.png')

Shop

The shop was based on this implementation and customers ordered canvas prints there.

shop.mp4

Canvas Prints

Moritz Max

References