August 2018
Intermediate to advanced
438 pages
12h 3m
English
Having defined the components of the overall loss function for neural style transfer, the next step is to stitch together these building blocks. Since content and style information is captured by the CNNs at different depths in the network, we need to apply and calculate loss at appropriate layers for each type of loss. We will be taking the conv layers one to five for the style loss and setting appropriate weights for each layer.
Here is the code snippet to build the overall loss function:
# weights for the weighted average loss functioncontent_weight = 0.05total_variation_weight = 1e-4content_layer = 'block4_conv2'style_layers = ['block1_conv2', 'block2_conv2', 'block3_conv3','block4_conv3', 'block5_conv3'] style_weights ...Read now
Unlock full access