Solved – auto-encoder for unequal image sizes

autoencodersclassificationdeep learningimage processingMATLAB

I would like to use an autoencoder on my training images. The problem is that each image has different size and Matlab gives me an error:

hiddenSize = 25;
autoenc = trainAutoencoder(x',hiddenSize,...
        'EncoderTransferFunction','satlin',...
        'DecoderTransferFunction','purelin',...
        'L2WeightRegularization',0.01,...
        'SparsityRegularization',4,...
        'SparsityProportion',0.10);

Error using Autoencoder>iConvertToDouble (line 863)
Training data for an autoencoder must either be a matrix, or a cell array of equal size images.

Error in Autoencoder.train (line 489)
            [X,visualizationDimensions, trainedOnImages] = iConvertToDouble(X);

Error in trainAutoencoder (line 105)
autoenc = Autoencoder.train(X, autonet, paramsStruct.UseGPU);

My question is : Using auto-encoder for unequal image sizes is the limitation of Matlab or the limitation of autoencoder?
or maybe in simpler form: Can I use auto-encoder on unequal image sizes?

Best Answer

The structure of auto-encoder must define the number of neuron inputs plus each hidden layer to the compressed layer and the same apply for the decoder part. In case of having different image sizer, why don't you re-size your images or apply image sliding on your inputs. You can find implementation on CNN which produce image captioning on image sliding.