Multiple implementations of Neural Style Transfer
Inspired by:
- Leon Gatys et al.'s paper: A Neural Algorithm of Artistic Style
- Xun Huang et al.'s paper: Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization
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.
- 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
For the Leon Gatys e al.'s model you don't have to do anything but run the code in colab.
run the following cmd:
git clone https://github.com/jianlgler/IST_labiagi.git
The Network is trained using both WikiArt (style) and Coco (content) datasets. To manually train the net just run train.py.
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).
It is possible to control style's impact on the content image through a paramether used for instance normalization.
Preserve the original content image color.
This feature comes from Xun Huang's Original implementation in Torch too.
Gianluca Trovò, Computer Engineering Student, Sapienza, Rome
- [1]: Leon Gatys' Original implementation in Python
- [2]: Xun Huang's Original implementation in Torch
- [3]: Leon Gatys et al.'s paper: A Neural Algorithm of Artistic Style
- [4]: Xun Huang et al.'s paper: Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization