0
votes

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 is False (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?

1

1 Answers

1
votes

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)