Skip to content

xch-liu/structure-nst

Repository files navigation

structure-nst

This is the code for the paper

Structure-Preserving Neural Style Transfer

Accepted by IEEE Transactions on Image Processing

This work is inspired and closely related to the paper: Perceptual Losses for Real-Time Style Transfer and Super-Resolution by Justin Johnson, Alexandre Alahi and Fei-Fei Li.

If you find this code useful for your research, please cite

@ARTICLE{TIP20_SP_NPR, 
	author={Ming-Ming Cheng and Xiao-Chang Liu and Jie Wang and Shao-Ping Lu and Yu-Kun Lai and Paul L. Rosin}, 
	journal={IEEE Transactions on Image Processing}, 
	title={Structure-Preserving Neural Style Transfer}, 
	year={2020}, 
	volume={29},  
	pages={909-920}, 
	doi={10.1109/TIP.2019.2936746}
}

Preresquisites

All code is implemented in Torch.

First install Torch, then update / install the following packages:

luarocks install torch
luarocks install nn
luarocks install image
luarocks install lua-cjson

(Optional) GPU Acceleration

If you have an NVIDIA GPU, you can accelerate all operations with CUDA.

First install CUDA, then update / install the following packages:

luarocks install cutorch
luarocks install cunn

(Optional) cuDNN

When using CUDA, you can use cuDNN to accelerate convolutions.

First download cuDNN and copy the libraries to /usr/local/cuda/lib64/. Then install the Torch bindings for cuDNN:

luarocks install cudnn

Running on new images

The script fast_neural_style.lua lets you use a trained model to stylize new images:

th fast_neural_style.lua \
  -model trained_models/feathers.t7 \
  -input_image images/content/model2.jpg \
  -output_image out.png

Training new models

You can find instructions for training new models here.

Acknowledgement

This project is inspired by many existing methods and their open-source implementations, including:

About

Structure-Preserving Neural Style Transfer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published