<p>If you want to classify the image then you will have to use fully connected layers which requires fixed image dimension, which can be avoided by using SPATIAL PYRAMID POOLING.</p>

<p>In <a href="https://arxiv.org/pdf/1406.4729.pdf" rel="nofollow noreferrer">spatial pyramid pooling</a> the input dimension doesn't have to be fixed it can be of any variable dimension .
By adding a new SPP layer on top of the last convolutional layer, before the fully connected layer followed by a softmax layer  will solve the problem.</p>

<p>implementation discussion <a href="https://github.com/tensorflow/tensorflow/issues/6011" rel="nofollow noreferrer">github</a>, <a href="https://stackoverflow.com/questions/40913794/how-to-implement-the-fixed-length-spatial-pyramid-pooling-layer">stackoverflow</a></p>
How to ouput 6 classes with (None,None,3) image size using VGG16
<p>I am using VGG16 to train a neural network to identify 3 classes, but I don't have any fixed image size (all I know for an image that is m x n, m,n&lt;300). So I set <code>input_shape</code> of the input layer as <code>(None, None, 3)</code>. The question is how can I go down to one dimension from 3 dimensions (row, col, channel)</p>