BIGBALLON/cifar-10-cnn

About DenseNet_keras.py

InsightDev opened this issue · 1 comments

I have read the DenseNet pater, I think the last TransitionLayer is not needed in your implementation.

See the paper, the TransitionLayer is 1 less then the number of blocks, because the origin paper has 4 blocks, so the number of additional layer is
FirstLayer(1) + TransitionLayer(3) + LastLayer(1) = 5

In the implementation, it has 3 dense block, so the number of additional layer is
FirstLayer(1) + TransitionLayer(2) + LastLayer(1) = 4

What do you think? thank you!

@InsightDev Thanks a lot!!
Your point is correct, we just need 2 TransitionLayers, i just fixed the bug!! 😄

    x = conv(img_input, nchannels, (3,3))
    x, nchannels = dense_block(x,nblocks,nchannels)
    x, nchannels = transition(x,nchannels)
    x, nchannels = dense_block(x,nblocks,nchannels)
    x, nchannels = transition(x,nchannels)
    x, nchannels = dense_block(x,nblocks,nchannels)
    x = bn_relu(x)
    x = GlobalAveragePooling2D()(x)
    x = dense_layer(x)
    return x