Issue
I know that the input_shape
for Inception V3 is (299,299,3)
. But in Keras it is possible to construct versions of Inception V3 that have custom input_shape
if include_top
is False
.
"input_shape: optional shape tuple, only to be specified if
include_top
isFalse
(otherwise the input shape has to be(299, 299, 3)
(with'channels_last'
data format) or(3, 299, 299)
(with'channels_first'
data format). It should have exactly 3 inputs channels, and width and height should be no smaller than 75. E.g.(150, 150, 3)
would be one valid value" - https://keras.io/applications/#inceptionv3
How is this possible and why can it only have custom input_shape if include_top
is false
?
Solution
This is possible because the model is fully convolutional. Convolutions don't care about the image size, they're "sliding filters". If you have big images, you have big outputs, if small images, small outputs. (The filters, though, have a fixed size defined by kernel_size
and input and output filters)
You cannot do that when you use include_top
because this model is probably using a Flatten()
layer followed by Dense
layers at the end. Dense
layers require a fixed input size (given by flatten based on the image size), otherwise it would be impossible to create trainable weights (having a variable number of weights doesn't make sense)
Answered By - Daniel Möller
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.