Neural Style Transfer
Neural Style Transfer
Neural Style Transfer
Style loss
Style loss is conceptually different from Content loss.
We cannot just compare the intermediate features of the two images and get the style loss. That's why we
introduce a new term called Gram matrices.
Gram matrix is a way to interpret style information in an image as it shows the overall distribution of
features in a given layer. It is measured as the amount of correlation present between features maps in a
given layer.
Style loss is calculated by the distance between the gram matrices (or, in
other terms, style representation) of the generated image and the style
reference image.
The contribution of each layer in the style information is calculated by the
below formula:
Thus, the total style loss across each layer is expressed as:
where the contribution of each layer in the style loss is depicted by some
factor wl.
Neural Style Transfer use cases
1. Neural Style transfer builds on the fact to blend the content image
to a style reference image such that the content is painted in the
specific style
2. NST employs a pre-trained Convolutional Neural Network for
feature extraction and separation of content and style representations
from an image
3. NST network has two inputs: Content image and Style image. The
content image is recreated as a newly generated image which is the
only trainable variable in the neural network
4. The architecture of the model performs the training using two loss
terms: Content Loss and Style Loss
5. Content loss is calculated by measuring the difference between the
higher-level intermediate layer feature maps
6. Style loss can be measured by the degree of correlation between
the responses from different filters at a level.