Course4 Week4 Compute style cost

In def compute_style_cost

Set a_S to be the hidden layer activation from the layer we have selected.

# The last element of the array contains the content layer image, which must not be used.
a_S = style_image_output[:-1]

I don’t understand why the last element of the style_image_output contains the content layer image. Please help.

Please see the following picture.

The right hand side is the model that we are working.

STYLE_LAYERS = [
    ('block1_conv1', 0.2),
    ('block2_conv1', 0.2),
    ('block3_conv1', 0.2),
    ('block4_conv1', 0.2),
    ('block5_conv1', 0.2)]

:

content_layer = [('block5_conv4', 1)]
vgg_model_outputs = get_layer_outputs(vgg, STYLE_LAYERS + content_layer)

We merge 5 layers as a style layer, and define the last layer as the content layer.

Hope this helps.

2 Likes

nice! i had the same questiopn