Confused about layer indexing in C4W1

Instruction says:

  • For the content layer: choose the Conv2D layer indexed at 88

But…

l1 = tmp_inception.get_layer(index=88)
print('l1: ' + str(l1))
l2 = tmp_inception.get_layer(name='conv2d_88')
print('l2: ' + str(l2))
1l: <keras.layers.normalization.batch_normalization.BatchNormalization object at 0x7fdeb9284f50>
l2: <keras.layers.convolutional.Conv2D object at 0x7fdeb857ead0>

So I can’t decide if we’re supposed to get the Conv2D layer with 88 in the name, or the 88^{th} Conv2D instance, or the layer actually indexed at 88. Overthinking it, perhaps?

In case others are confused like I was, here is what worked for me. First, don’t over think it. You’re being asked to select Conv2D layers based on the order in which they were created and named, not necessarily the order in which they show up in the summary listing, and definitely not what is returned by get_layer(index=int).

The first Conv2D layer instance is named conv2d. The second one is conv2d_1 etc. So the name is the layer type appended with instance number of that type minus 1. You need the first five of the Conv2D layers for style. You need the 88^{th} one for content. Hope this helps and apologies in advance if a mentor feels this violates the Honor Code. Cheers.

c4w1_nst

Congratulations! Your image achieved a structural similarity index of 0.98 with the reference image

1 Like