Implementation of Style Transfer based on the Adaptive Instance Normalisation (AdaIN) proposed by Huang et al. [1]. Live demo is available on HuggingFace Spaces.
Overall, the model's architecture consists of: an encoder (first 4 layers from VGG-19), AdaIN layer and a decoder.
The AdaIN layer works by scaling the style (
The scaled feature maps from the AdaIN layer provide the input for the decoder which generates the final styled image (
The loss used for training of the decoder is a combination of content and style losses.
The content loss
On the other hand, the style loss
The
The training dataset consisted of style images acquired from the WikiArt dataset and content images from the COCO dataset.
set up a virtual environment with:
python3 -m venv venvactivate the virtual environment:
source venv/bin/activateinstall the requirements:
pip install -r requirements.txtrun the gradio app:
python3 app.pyopen 127.0.0.1:7860 in your browser.
[1] Huang, Xun, and Serge Belongie. "Arbitrary style transfer in real-time with adaptive instance normalization." Proceedings of the IEEE international conference on computer vision. 2017.

