I want to implement a convolution-deconvolution network for a image segmentation project. In the deconvolution part, I am planning to upsample the feature map by 2. e.g. The original feature map is of dimension 64*64*4 and I want to upsample it into 128*128*4. Does anyone know a tensor operation that does this? Thanks!
In the Downsampling network, simple CNN architectures are used and abstract representations of the input image are produced. In the Upsampling network, the abstract image representations are upsampled using various techniques to make their spatial dimensions equal to the input image.
Its role is to bring back the resolution to the resolution of previous layer. Theoretically, we can eliminate the down/up sampling layers altogether. However to reduce the number of computations, we can downsample the input before a layers and then upsample its output.
It works by repeating the rows and columns of the input. A more elaborate approach is to perform a backwards convolutional operation, originally referred to as a deconvolution, which is incorrect, but is more commonly referred to as a fractional convolutional layer or a transposed convolutional layer.
You could use tf.image.resize_images()
. It takes batches of images or single images and supports the most common methods such as bilinear
and nearest_neighbor
.
Here's the link to the TensorFlow API reference: resizing
You can also take a look at how the upsampling operation is implemented in a higher-level API such as tflearn. You can find upsample_2d
and upscore_layer
in their Github repo: conv.py
Note: the output might be cast to tf.float32
in older TF versions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With