# PyTorch-Multi-Style-Transfer **Repository Path**: yu_long_han/PyTorch-Multi-Style-Transfer ## Basic Information - **Project Name**: PyTorch-Multi-Style-Transfer - **Description**: Neural Style and MSG-Net - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2021-04-13 - **Last Updated**: 2021-04-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PyTorch-Style-Transfer This repo provides PyTorch Implementation of **[MSG-Net (ours)](#msg-net)** and **[Neural Style (Gatys et al. CVPR 2016)](#neural-style)**, which has been included by [ModelDepot](https://modeldepot.io/zhanghang/multi-style-generative-network-for-real-time-transfer/overview). We also provide [Torch implementation](https://github.com/zhanghang1989/MSG-Net/) and [MXNet implementation](https://github.com/zhanghang1989/MXNet-Gluon-Style-Transfer). **Tabe of content** * [Real-time Style Transfer using MSG-Net](#msg-net) - [Stylize Images using Pre-trained Model](#stylize-images-using-pre-trained-msg-net) - [Train Your Own MSG-Net Model](#train-your-own-msg-net-model) * [Slow Neural Style Transfer](#neural-style) ## MSG-Net
|
Multi-style Generative Network for Real-time Transfer [arXiv] [project] Hang Zhang, Kristin Dana
@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}
}
|
![]() |
### Train Your Own MSG-Net Model
0. Download the COCO dataset
```bash
bash dataset/download_dataset.sh
```
0. Train the model
```bash
python main.py train --epochs 4
```
* If you would like to customize styles, set `--style-folder path/to/your/styles`. More options:
* `--style-folder`: path to the folder style images.
* `--vgg-model-dir`: path to folder where the vgg model will be downloaded.
* `--save-model-dir`: path to folder where trained model will be saved.
* `--cuda`: set it to 1 for running on GPU, 0 for CPU.
## Neural Style
[Image Style Transfer Using Convolutional Neural Networks](http://www.cv-foundation.org/openaccess/content_cvpr_2016/papers/Gatys_Image_Style_Transfer_CVPR_2016_paper.pdf) by Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge.
```bash
python main.py optim --content-image images/content/venice-boat.jpg --style-image images/21styles/candy.jpg
```
* `--content-image`: path to content image.
* `--style-image`: path to style image.
* `--output-image`: path for saving the output image.
* `--content-size`: the content image size to test on.
* `--style-size`: the style image size to test on.
* `--cuda`: set it to 1 for running on GPU, 0 for CPU.
### Acknowledgement
The code benefits from outstanding prior work and their implementations including:
- [Texture Networks: Feed-forward Synthesis of Textures and Stylized Images](https://arxiv.org/pdf/1603.03417.pdf) by Ulyanov *et al. ICML 2016*. ([code](https://github.com/DmitryUlyanov/texture_nets))
- [Perceptual Losses for Real-Time Style Transfer and Super-Resolution](https://arxiv.org/pdf/1603.08155.pdf) by Johnson *et al. ECCV 2016* ([code](https://github.com/jcjohnson/fast-neural-style)) and its pytorch implementation [code](https://github.com/darkstar112358/fast-neural-style) by Abhishek.
- [Image Style Transfer Using Convolutional Neural Networks](http://www.cv-foundation.org/openaccess/content_cvpr_2016/papers/Gatys_Image_Style_Transfer_CVPR_2016_paper.pdf) by Gatys *et al. CVPR 2016* and its torch implementation [code](https://github.com/jcjohnson/neural-style) by Johnson.