I am currently getting into image segmentation with Keras, and I am using an encoder-decoder type as in the image below. Encoder-Decoder with skip connections

My problem is that applying a MaxPooling2D layer of size (2,2) cannot be reliably reversed by using an UpSampling2D layer of size (2,2), as the input and output sizes do not match if the input dimensions are odd. The same problem arises with a Conv2D layer with a stride >1 which I want to "reverse" with a Conv2DTranspose layer. This leads to the problem that the skip connections sometimes connect layers of differing sizes such that I cannot concatenate these layers.

Is any canonical way to deal with this problem in Keras, while maintaining skip connections and allowing arbitrary input sizes?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.