0

I am trying to apply 2 convolutional layers with the tf.slim.conv2d function, they basically reduce the size of my input image by half each time. Then I want to apply the convolution2d_transpose to get my original image shape back. The problem is I don't exactly know how to use the transpose convolution function, and the documentation is not much help.

I am using a custom wrapper, but here is what I have so far:

Input Batch [8, 161, 141] ----> Conv2d [outputs = 32, 
kernel_size = [41,11], stride= [2,2]] 
which cuts the original image in half, and another such layer which cuts it again.

How can I apply the convolution_transpose function to reverse the effect of these two layers now ?

Qubix
  • 4,161
  • 7
  • 36
  • 73
  • One way to start is with the [test](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/kernel_tests/conv2d_transpose_test.py) case file, if that helps more than the docs. – drpng Feb 14 '17 at 05:56

1 Answers1

1

According to the tensorflow api-docs link you provided above:

def convolution2d_transpose(
inputs,
num_outputs,
kernel_size,
stride=1,
padding='SAME',
data_format=DATA_FORMAT_NHWC,
activation_fn=nn.relu,
normalizer_fn=None,
normalizer_params=None,
weights_initializer=initializers.xavier_initializer(),
weights_regularizer=None,
biases_initializer=init_ops.zeros_initializer(),
biases_regularizer=None,
reuse=None,
variables_collections=None,
outputs_collections=None,
trainable=True,
scope=None):

you can, for your example, utilize it like this:

slim.convolution2d_transpose(input_tensor, 32, [4,4], [2,2], scope='output')
Itamar
  • 46
  • 2