Max pool layer vs Convolution with stride performance

Yes that can be done. Its explained in the paper ‘Striving for simplicity: The all convolutional net’ https://arxiv.org/pdf/1412.6806.pdf. Quote from the paper: ‘We find that max-pooling can simply be replaced by a convolutional layer with increased stride without loss in accuracy on several image recognition benchmarks’

Why does Keras LSTM batch size used for prediction have to be the same as fitting batch size?

Unfortunately what you want to do is impossible with Keras … I’ve also struggle a lot of time on this problems and the only way is to dive into the rabbit hole and work with Tensorflow directly to do LSTM rolling prediction. First, to be clear on terminology, batch_size usually means number of sequences that … Read more

What does backbone mean in a neural network?

In my understanding, the “backbone” refers to the feature extracting network which is used within the DeepLab architecture. This feature extractor is used to encode the network’s input into a certain feature representation. The DeepLab framework “wraps” functionalities around this feature extractor. By doing so, the feature extractor can be exchanged and a model can … Read more

Keras: model.predict for a single image

Since you trained your model on mini-batches, your input is a tensor of shape [batch_size, image_width, image_height, number_of_channels]. When predicting, you have to respect this shape even if you have only one image. Your input should be of shape: [1, image_width, image_height, number_of_channels]. You can do this in numpy easily. Let’s say you have a … Read more

How to use return_sequences option and TimeDistributed layer in Keras?

The LSTM layer and the TimeDistributed wrapper are two different ways to get the “many to many” relationship that you want. LSTM will eat the words of your sentence one by one, you can chose via “return_sequence” to outuput something (the state) at each step (after each word processed) or only output something after the … Read more

Error when checking model input: expected convolution2d_input_1 to have 4 dimensions, but got array with shape (32, 32, 3)

The input shape you have defined is the shape of a single sample. The model itself expects some array of samples as input (even if its an array of length 1). Your output really should be 4-d, with the 1st dimension to enumerate the samples. i.e. for a single image you should return a shape … Read more