Home

Awesome

MXNet-Gluon-Style-Transfer

This repo has been included in official MXNet repo, which provides the implementations of MSG-Net and Neural Style Transfer. We also provide PyTorch and Torch implementations.

Tabe of content

Neural Style

A Neural Algorithm of Artistic Style by Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge.

python main.py optim --content-image images/content/venice-boat.jpg --style-image images/styles/candy.jpg

<img src ="images/g1.jpg" width="260px" /> <img src ="images/g2.jpg" width="260px" /> <img src ="images/g3.jpg" width="260px" /> <img src ="images/g4.jpg" width="260px" /> <img src ="images/g5.jpg" width="260px" /> <img src ="images/g6.jpg" width="260px" /> <img src ="images/g7.jpg" width="260px" /> <img src ="images/g8.jpg" width="260px" /> <img src ="images/g9.jpg" width="260px" />

Real-time Style Transfer

<table width="100%" border="0" cellspacing="15" cellpadding="0"> <tbody> <tr> <td> <b>Multi-style Generative Network for Real-time Transfer</b> [<a href="https://arxiv.org/pdf/1703.06953.pdf">arXiv</a>] [<a href="http://computervisionrutgers.github.io/MSG-Net/">project</a>] <br> <a href="http://hangzh.com/">Hang Zhang</a>, <a href="http://eceweb1.rutgers.edu/vision/dana.html">Kristin Dana</a> <pre> @article{zhang2017multistyle, title={Multi-style Generative Network for Real-time Transfer}, author={Zhang, Hang and Dana, Kristin}, journal={arXiv preprint arXiv:1703.06953}, year={2017} } </pre> </td> <td width="440"><a><img src ="https://raw.githubusercontent.com/zhanghang1989/MSG-Net/master/images/figure1.jpg" width="420px" border="1"></a></td> </tr> </tbody> </table>

Stylize Images Using Pre-trained MSG-Net

  1. Download the pre-trained model
    python models/download_model.py
    
  2. Test the model
    python main.py eval --content-image images/content/venice-boat.jpg --style-image images/styles/candy.jpg --model models/21styles.params --content-size 1024
    

<img src ="images/1.jpg" width="260px" /> <img src ="images/2.jpg" width="260px" /> <img src ="images/3.jpg" width="260px" /> <img src ="images/4.jpg" width="260px" /> <img src ="images/5.jpg" width="260px" /> <img src ="images/6.jpg" width="260px" /> <img src ="images/7.jpg" width="260px" /> <img src ="images/8.jpg" width="260px" /> <img src ="images/9.jpg" width="260px" />

Train Your Own MSG-Net Model

  1. Download the COCO dataset
    bash dataset/download_dataset.sh
    
  2. Train the model
    python main.py train --epochs 4
    

The code is mainly modified from PyTorch-Style-Transfer.