Skip to content

Multiple implementations of neural style transfer

Notifications You must be signed in to change notification settings

jianlgler/IST_labiagi

Repository files navigation

Through an Interactive Style transfer

Multiple implementations of Neural Style Transfer

alt text

Inspired by:

Index

How to Start

If you are running the ipynb files you need no dependencies. The neural_style_transfer.ipynb file run perfectly and you don't have to setup anything. However for PyTorch_AdaIN.ipynb you will need to adjust paths and folders for the code to be runnable, otherwise it will throw errors. Note that I use the colab.drive library to import what I need (utils, input images and the network), but alternatevely you could clone this whole repository and fix paths to make it work (as an example). In any case, remember to download the modified VGG-19 network.

Depencencies

  • ipywidgets==8.0.1
  • matplotlib==3.5.3
  • numpy==1.23.1
  • Pillow==9.2.0
  • torch==1.12.1+cu116
  • torchvision==0.13.1+cu116
  • tqdm==4.64.0

You can install them all by running

pip install -r requirements.txt

How to Run

Leon Gatys e al.

For the Leon Gatys e al.'s model you don't have to do anything but run the code in colab.

Xun Huang et al.

run the following cmd:

git clone https://github.com/jianlgler/IST_labiagi.git

Training

The Network is trained using both WikiArt (style) and Coco (content) datasets. To manually train the net just run train.py.

Testing

At the moment there is no executable avaible, what I suggest is to open the folder with a Python IDE (VS Code, Atom...) and run the test.py. To control the output and change the input images edit the code variables (alpha, color, image names and paths).

Features

Content/Style tradeoff

It is possible to control style's impact on the content image through a paramether used for instance normalization.

alt text

Preserve color

Preserve the original content image color.

alt text

This feature comes from Xun Huang's Original implementation in Torch too.

Author

Gianluca Trovò, Computer Engineering Student, Sapienza, Rome

References

About

Multiple implementations of neural style transfer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published