Fully convolutional auto-encoder for variable-size images in keras

I want to build a convolutional autocoder where the input size is not constant. I do this by adding conv-pool levels until I reach the coding level, and then do the opposite with upsample-conv levels. The problem is that no matter what settings I use, I canโ€™t get the exact size at the output level as the input layer. The reason for this is because the UpSampling level (given size (2.2)) doubles the size of the input, so I cannot get odd sizes, for example. Is there a way to associate the output size of this layer with the input size of the previous layer for individual samples (as I said, the input size for the maximum pool layer in the variable)?

+5
source share
1 answer

Yes there is.

You can use three methods

Filling will only work for larger sizes. Not useful for downsizing.

Resizing should be a more expensive but optimal solution for each case (up or down). It will save all values โ€‹โ€‹in a range and simply convert them to resize at a given size.

Crop or Pad will work as resizing, and it will be more efficient in terms of calculation, since there is no interpolation in this method. However, if you want to resize it to a smaller size, it will be cropped from the edges.

Using these 3, you can arrange the sizes of your layer.

0
source

All Articles