Reputation: 663
I am trying to model a fully convolutional neural network using the Keras library, Tensorflow backend.
The issue I face is that of feeding ]differently sized images in batches to model.fit()
function. The training set consists of images of different sizes varying from 768x501 to 1024x760.
Not more than 5 images have the same dimensions, so grouping them into batches seems to be of no help.
Numpy allows storing the data in a single variable in list form. But the keras model.fit()
function throws an error on receiving a list type training array.
I do not wish to resize and lose the data as I already have a very small dataset.
How do I go about training this network?
Upvotes: 16
Views: 3832
Reputation: 88
I think Spatial Pyramid Pooling (SPP) might be helpful. Checkout this paper.
We note that SPP has several remarkable properties for deep CNNs:
1) SPP is able to generate a fixed-length output regardless of the input size, while the sliding window pooling used in the previous deep networks cannot;
2) SPP uses multi-level spatial bins, while the sliding window pooling uses only a single window size. Multi-level pooling has been shown to be robust to object deformations;
3) SPP can pool features extracted at variable scales thanks to the flexibility of input scales. Through experiments we show that all these factors elevate the recognition accuracy of deep networks.
yhenon
has implemented SPP for Keras on Github.
Upvotes: 3