1. 程式人生 > >Neural Style Transfer

Neural Style Transfer

Concept

Content C + Style S = Generated image G

What are Deep ConvNet Learning?

More abstract features in deeper layer.

Cost Function

loss(G;C,S)=αlosscontent(S,G)+βlossstyle(C,G)

Content Cost Function

  • Say you use hidden layer l to compute content cost.
  • User pre-trained ConvNet.
  • Let a[l](C) and a[l](G) be the activation of layer l on the images.
  • If a[l](C) and a[l](G) are similar, both images have similar content.

losscontent(S,G)=12a[l](C)a[l](G)2

Style Cost Function

  • Say you use hidden layer
    l
    to compute style cost.
  • Define style as correlation between activation across different channels.
  • Style Matrix G[l]:
    Let ai,j,k[l]= activation at (i,j,k) . Let Gk,k[l]=i=1nh[l]j=1nw[l]ai,j,k[l]ai,j,k[l],1k,knc[
    l]

lossstyle[l](C,G)=G[l](S)G[l](G)F2