GiovaniValdrighi / style-transfer

Implementation of a style transfer neural network.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Neural Style Transfer

Project on the discipline of Neural Networks and Deep Learning at the course of Master degree in Mathematical Modelling at EMAp FGV. In this work, I reproduce the work in the article A Neural Algorithm of Artistic Style, by Leon A. Gays, Alexander S. Ecker, and Matthis Bethge. This article uses a convolutional neural network to represent the content and the style of an image. Then, with the optimization of new layers, can transfer the content to be represented in a new style. Some tests are made on how to adapt the style transfer for videos. It was made use of Pytorch for the implementation. There is a web page explaining the implementation. You can make a few changes to the code to run the style transfer on your own images.

Style and Content

Style transfer

Files organization

The files of the project are separated in the following folders:

  • docs/: documentation of the project, files for the web-age.

  • notebooks/: two Jupyter Notebooks with the implementation of the algorithm and some tests on videos.

  • scripts/: file for the implementation as a Python script.

Requirements

The implementation made use of the language Python and Jupyter Notebooks avaiable at Anaconda. The necessary libraries are:

  • torch
  • urllib
  • PIL
  • pickle
  • matplotlib
  • tqdm
  • cv2

How to run

  1. All the work was made in Jupyter Notebooks, so to run my examples, just run all cells.
  2. To run a example with one image of yours, on the Notebook neural_style_transfer.ipynb, in the last cells, just change the path of the content and the style images for you desired.

Reference

  • A Neural Algorithm of Artistic Style, by Leon A. Gays, Alexander S. Ecker and Matthis Bethge.

About

Implementation of a style transfer neural network.


Languages

Language:Jupyter Notebook 99.9%Language:Python 0.1%