# Concept

Content C + Style S = Generated image G

# What are Deep ConvNet Learning?

More abstract features in deeper layer.

# Cost Function

$\mathrm{loss}\left(G;C,S\right)=\alpha {\mathrm{loss}}_{content}\left(S,G\right)+\beta {\mathrm{loss}}_{style}\left(C,G\right)$$\operatorname {loss} \left ( G; C, S \right ) = \alpha \operatorname {loss} _{content} \left ( S, G \right ) + \beta \operatorname {loss} _{style} \left ( C, G \right )$

# Content Cost Function

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

${\mathrm{loss}}_{content}\left(S,G\right)=\frac{1}{2}{‖{a}^{\left[l\right]\left(C\right)}-{a}^{\left[l\right]\left(G\right)}‖}^{2}$$\operatorname {loss} _{content} \left ( S, G \right ) = \dfrac {1} {2} \left \lVert a ^{[l] (C)} - a ^{[l] (G)} \right \rVert ^{2}$

# Style Cost Function

• Say you use hidden layer $l$$l$ to compute style cost.
• Define style as correlation between activation across different channels.
• Style Matrix ${G}^{\left[l\right]}$$G ^{[l]}$:
Let ${a}_{i,j,k}^{\left[l\right]}=$$a ^{[l]} _{i,j, k} =$ activation at $\left(i,j,k\right)$$(i,j, k)$ . Let ${G}_{k,{k}^{\prime }}^{\left[l\right]}=\sum _{i=1}^{{n}_{h}^{\left[l\right]}}\sum _{j=1}^{{n}_{w}^{\left[l\right]}}{a}_{i,j,k}^{\left[l\right]}{a}_{i,j,{k}^{\prime }}^{\left[l\right]},1\le k,{k}^{\prime }\le {n}_{c}^{\left[l\right]}$$G ^{[l]} _{k, k'} = \sum \limits_{i = 1} ^{n ^{[l]} _{h}} \sum \limits_{j = 1} ^{n ^{[l]} _{w}} a ^{[l]} _{i,j, k} a ^{[l]} _{i,j, k'}, 1 \le k, k' \le n ^{[l]} _{c}$

${\mathrm{loss}}_{style}^{\left[l\right]}\left(C,G\right)={‖{G}^{\left[l\right]\left(S\right)}-{G}^{\left[l\right]\left(G\right)}‖}_{F}^{2}$$\operatorname {loss} _{style} ^{[l]} \left ( C, G \right ) = \left \lVert G ^{[l] (S)} - G ^{[l] (G)} \right \rVert ^{2} _{F}$
${\mathrm{loss}}_{style}\left(C,G\right)=\sum _{l=1}^{L}{\beta }^{\left[l\right]}{\mathrm{loss}}_{style}^{\left[l\right]}\left(C,G\right)$$\operatorname {loss} _{style} \left ( C, G \right ) = \sum \limits_{l = 1} ^{L} \beta ^{[l]} \operatorname {loss} _{style} ^{[l]} \left ( C, G \right )$

• 广告
• 抄袭
• 版权
• 政治
• 色情
• 无意义
• 其他

120