Style Transfer¶
The task is to generate a synthetic image \(G\) which matches closely in content to an image \(C\) and in style to an image \(S\).
Define the error as
We start with a randomly initialized image \(G\) and optimize the above loss function using gradient descent to get \(G\).
To match content, the pre activations of the network for both \(G\) and \(C\) at a particular layer should be similar (since we want both to contain similar features).
where \(a_{ijk}\) represent the activations. We use a simple sum squared error.
The choice of layer is subjective. Earlier layers matching lower level features, while the later ones measure higher level features.
For matching styles, information across channels in a layer should co-occur. For example, vertical edges of orange color. Different channels in a layer will hold this information.
This is a correlation score for two channels \(k\) and \(k'\) and the sum is calculated across the entire image. We calculate this across multiple combinations of channels to get the error
More pleasing results are obtained by averaging across multiple layers, using a cofficient \(\lambda_{l}\) which is adjusted emperically.