Coder Social home page Coder Social logo

lanzehua / deep-transfer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pietrocarbo/deep-transfer

0.0 0.0 0.0 126.73 MB

PyTorch implementation of "Universal Style Transfer via Feature Trasforms"

License: Apache License 2.0

Python 100.00%

deep-transfer's Introduction

deep-transfer

This is a Pytorch implementation of the "Universal Style Transfer via Feature Trasforms" NIPS17 paper.

Given a content image and an arbitrary style image, the program attempts to transfer the visual style characteristics extracted from the style image to the content image generating stylized ouput.

The core architecture is a VGG19 Convolutional Autoencoder performing Whitening and Coloring Transformation on the content and style features in the bottleneck layer.

Installation

  • Needed Python packages can be installed using conda package manager by running conda env create -f environment.yaml

Functionalities

Available modalities are:

  • style transfer (inputs: a content image and a style image);

  • texture synthesis (inputs: a texture style image);

  • style transfer interpolation (inputs: a content image and 2 style images);

  • texture synthesis interpolation (inputs: 2 texture style images);

  • spatial control over stylization (inputs: a content image, a binary mask of the same size and 2 style images for background-foreground stylization).

Usage

python main.py ARGS

Possible ARGS are:

  • -h, --help show this help message and exit;
  • --content CONTENT path of the content image (or a directory containing images) to be trasformed;
  • --style STYLE path of the style image (or a directory containing images) to use;
  • --synthesis flag to syntesize a new texture. Must also provide a texture style image;
  • --stylePair STYLEPAIR path of two style images (separated by ",") to combine together;
  • --mask MASK path of the binary mask image (white on black) to use to trasfer the style pair in the corrisponding areas;
  • --contentSize CONTENTSIZE reshape content image to have the new specified maximum size (keeping aspect ratio);
  • --styleSize STYLESIZE reshape style image to have the new specified maximum size (keeping aspect ratio);
  • --outDir OUTDIR path of the directory where stylized results will be saved (default is outputs/);
  • --outPrefix OUTPREFIX name prefixed in the saved stylized images;
  • --alpha ALPHA hyperparameter balancing the blending between original content features and WCT-transformed features (default is 0.2);
  • --beta BETA hyperparameter balancing the interpolation between the two images in the stylePair (default is 0.5;)
  • --no-cuda flag to enable CPU-only computations (default is False i.e. GPU (CUDA) accelaration);
  • --single-level flag to use single-level stylization (default is False).

Supported image file formats are: jpg, jpeg, png.

deep-transfer's People

Contributors

pietrocarbo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.