Skip to content
Code and data for paper "Deep Painterly Harmonization":
Branch: master
Clone or download
luanfujun Update neural_gram.lua
use cnn:size()
Latest commit a33a9a7 Apr 24, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
3rdparty add 3rdparty Apr 10, 2018
data update example Apr 15, 2018
models First commit Apr 9, 2018
results update Apr 9, 2018
dilate_mask.m add dilate_mask.m Apr 16, 2018
filt_cnn_artifact.m Update Apr 14, 2018
makefile Update makefile Apr 14, 2018
neural_gram.lua Update neural_gram.lua Apr 25, 2018
neural_paint.lua Use size instead of # Apr 21, 2018


Code and data for paper "Deep Painterly Harmonization"


This software is published for academic and non-commercial use only.


This code is based on torch. It has been tested on Ubuntu 16.04 LTS.


CUDA backend:

Download VGG-19:

sh models/

Compile (Adjust PREFIX and NVCC_PREFIX in makefile for your machine):

make clean && make


To generate all results (in data/) using the provided scripts, simply run


in Python and then


in Matlab or Octave. The final output will be in results/.

Note that in the paper we trained a CNN on a dataset of 80,000 paintings collected from, which estimates the stylization level of a given painting and adjust weights accordingly. We will release the pre-trained model in the next update. Users will need to set those weights manually if running on their new paintings for now.

Removed a few images due to copyright issue. Full set here for testing use only.


Here are some results from our algorithm (from left to right are original painting, naive composite and our output):


  • Our torch implementation is based on Justin Johnson's code;
  • Histogram loss is inspired by Risser et al.


If you find this work useful for your research, please cite:

  title={Deep Painterly Harmonization},
  author={Luan, Fujun and Paris, Sylvain and Shechtman, Eli and Bala, Kavita},
  journal={arXiv preprint arXiv:1804.03189},


Feel free to contact me if there is any question (Fujun Luan

You can’t perform that action at this time.