Python, torch
Inputs : content image C
, style image S
A generated image (tensor G
) is created from either a copy of content or from random noise. This tensor is the only trained parameter.
A pretrained VGG model, or a pretrained Resnet151 model is used to extract features from all three tensors. The features are stored at multiple steps during any forward pass in the model, L times
The content and style losses are defined as such :
And the final loss to backpropagate is