FCN.tensorflow icon indicating copy to clipboard operation
FCN.tensorflow copied to clipboard

Ignoring Conv5_4

Open aolsenjazz opened this issue 6 years ago • 3 comments

vgg_net(weights, image) initializes the VGG with layers up to and including Conv (and RELU) 5_4:

layers = (
        'conv1_1', 'relu1_1', 'conv1_2', 'relu1_2', 'pool1',

        'conv2_1', 'relu2_1', 'conv2_2', 'relu2_2', 'pool2',

        'conv3_1', 'relu3_1', 'conv3_2', 'relu3_2', 'conv3_3',
        'relu3_3', 'conv3_4', 'relu3_4', 'pool3',

        'conv4_1', 'relu4_1', 'conv4_2', 'relu4_2', 'conv4_3',
        'relu4_3', 'conv4_4', 'relu4_4', 'pool4',

        'conv5_1', 'relu5_1', 'conv5_2', 'relu5_2', 'conv5_3',
        'relu5_3', 'conv5_4', 'relu5_4'
    )

However, in inference(image, keep_prob), the final layer is referenced as Conv5_3:

conv_final_layer = image_net["conv5_3"]

This looks like an error; is this intended?

aolsenjazz avatar Apr 09 '18 12:04 aolsenjazz

Referring back to the original paper and reference implementation, it looks like there are other bugs in this layer implementation. In the paper, 3 conv sublayers are used at in layers 3, 4, and 5 - this implementation uses 4, 4, and 4 respectively (though the final layer omits the 4th conv seemingly by mistake).

Links for reference: https://people.eecs.berkeley.edu/~jonlong/long_shelhamer_fcn.pdf (page 5 is of relevance here) https://github.com/shelhamer/fcn.berkeleyvision.org/blob/master/voc-fcn8s/net.py

aolsenjazz avatar Apr 09 '18 20:04 aolsenjazz

I think the author used part of vgg19, while the paper used vgg16. Layers after relu5_3 is not needed.

worstprogrammerCN avatar May 23 '18 21:05 worstprogrammerCN

Yes, the authors here have used a part of VGG-19 architecture. (not exactly sure why) I did the math, and the reason they have stopped it at CONV5_3 is becuause, when you start with a 224x224x3 image, after various operations, at CONV5_3 you end up with 1x1x512 dimension tensor. Computing beyond this (CONV5_4) will lead to errors, due to negative demensions.

The VGG-19 architecture specificiation were referred from here to calculate tensor dimensions.

@shekkizh Is this correct?

varungupta31 avatar Apr 25 '22 11:04 varungupta31