Commit to enable true fully convolutional application of network #684
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
The original implementation of VGG models has fully connected layers implemented as convolution.
It gives predictable results when the network is used for classification.
It is also possible to apply the network in a fully convolutional manner like it is described in the paper
"fully convolutional networks for Image Segmentation".This part also works except one small detail --
the padding that is specified for the fc layer that is implemented as convolution is specified to be 'VALID'.
This gives the downsampled ouput of (input / 32) - 6. To be able to apply the network like it was
described in the paper the ouput should be (input / 32). This can be achieved by using 'SAME' padding.
This makes it possible to upsample the ouput by 32 and get predictions of the same size as an input image. Here are examples where I have applied the vgg network in a fully convolutional manner
, giving prediction map for 1000 classes of Imagenet:
Input
Valid padding
Same padding
You can see that in the second picture the image was downsampled by 32 while on the first one
we also lost 6 pixels.
I suggest to add one more argument to the definition of models to be able to switch between those two
types of paddings depending on what user wants to do.