GitXplorerGitXplorer
l

Neural-Style-MMD

public
83 stars
22 forks
7 issues

Commits

List of commits on branch master.
Unverified
a79b913368c65dba8ae43a9dc07ea0fced2a7572

update readme

llyttonhao committed 7 years ago
Unverified
ac617b7336a0cf555f1ec68241821d54cf209d05

rm import find_mxnet

llyttonhao committed 8 years ago
Unverified
79c78a7c06eb844d1cc51e4c4af6e2c0a3bcabc5

update readme

llyttonhao committed 8 years ago
Unverified
e98870a6affb8c1a74041be3318ebcb55114a6c2

remove some files

llyttonhao committed 8 years ago
Unverified
a0cf46d5b945d125ad21083a75f321895410a7a1

Refactor codes; add input images; add Readme

llyttonhao committed 8 years ago
Unverified
f4b8161dcdbca6e56260c7653d6d6e32e3ec0083

Merge branch 'master' of https://github.com/lyttonhao/Neural-Style-MMD

llyttonhao committed 8 years ago

README

The README file for this repository.

Neural-Style-MMD

This repository holds the MXNet code for the paper

Demystifying Neural Style Transfer, Yanghao Li, Naiyan Wang, Jiaying Liu, and Xiaodi Hou, International Joint Conference on Artificial Intelligence (IJCAI), 2017

[Arxiv Preprint]

Introduction

Neural-Style-MMD presents a neural style transfer algorithm based on a new interpretation. Instead of using Gram matrix in original neural style transfer methods, this repo provides two methods to implement style transfer, including a Maximum Mean Discrepancy (MMD) loss and a Batch Normalization (BN) statistic loss. The paper also demonstrates the original matching Gram matrix is equivalent to the a specific polynomial MMD. Details could be found in the paper. Our implementation is based on the neural-style example of MXNet.

Prerequisites

Before running this code, you should make the following preparations:

  • Install MXNet following the instructions and install the python interface. This repo is tested on commmit 01cde1.

  • Download the pre-trained VGG-19 model in the model folder:

wget https://github.com/dmlc/web-data/raw/master/mxnet/neural-style/model/vgg19.params

Usage

Basic Usage:

python neural-style.py --mmd-kernel linear --gpu 0 --style-weight 5.0 --content-image input/brad_pitt.jpg --style-image input/starry_night.jpg --output brad_pitt-starry_night --output-folder output_images

We support 4 single transfer methods, including 3 mmd kernels, including linear, poly and Gaussian, and a BN Statistics Matching method. At the same time, the code supports fusing different transfer methods with specific weights.

Options

  • --mmd-kernel: Specify MMD kernel (linear, poly, Gaussian), also their combination, e.g. linear,poly.
  • --bn-loss: Whether to use the BN method.
  • --multi-weights: The weights when fusing different transfer methods, e.g. 0.5,0.5.
  • --style-weight: How much to weight the style loss term. It is equivalent to the balance factor gamma in the paper when we fix the content-weight as 1.0.

You can run python neural-style.py with -h to see more options.