Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignoring Conv5_4 #94

Open
aolsenjazz opened this issue Apr 9, 2018 · 3 comments
Open

Ignoring Conv5_4 #94

aolsenjazz opened this issue Apr 9, 2018 · 3 comments

Comments

@aolsenjazz
Copy link

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
Copy link
Author

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

@worstprogrammerCN
Copy link

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

@varungupta31
Copy link

varungupta31 commented Apr 25, 2022

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?

This was referenced Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants