Implementation of the Perceptual Losses Neural Style Transfer model in the paper:
Perceptual Losses for Real-Time Style Transfer and Super-Resolution (ECCV 2016).
This repository implements Instance normalization: The missing ingredient for fast stylization.
See here for the official Torch implementation.
Content image from Instance normalization paper and style images from Arbitrary Style Transfer paper.
Delaunay style from Instance normalization paper.
- Python 3.8
- Tensorfow 2.5
- Tensorflow Addons 0.12.1
- Download COCO dataset.
- Use
--name=<model_name>
,--style_img=<style_image_path>
and--content_dir=<coco_path>
to specify model name, style and content dataset path.
python train.py --name=<model_name> --style_img=<style_image_path> --content_dir=<coco_path>
Run test.py
. It will save every content image to the output directory.
python test.py --name=<model_name>
Set hyperparameters in the hparams.py
file. Use content_weight
and style_weight
to adjust the degree of stylization.
Run tensorboard --logdir ./
.
-
Images normalized [-1, 1] and tanh activation at the network output.
-
Conv2d layers with reflect padding.
-
Example images are generated after 2,400 steps.
-
The model runs using mixed precision.
Copyright (c) 2020 Emilio Morales. Free to use, copy and modify for academic research purposes, as long as proper attribution is given and this copyright notice is retained. Contact me for any use that is not academic research (email: mil.mor.mor at gmail.com).
@software{morales2020perceptual,
author = {Morales, Emilio},
title = {Perceptual losses neural style transfer},
url = {https://github.com/milmor/perceptual-losses-neural-st},
year = {2020},
}