Credits :: Tensorflow's Issue No 2169 and all the people invloved there.
Unpooling of tensor that has been pooled using max_pool_with_argmax
This figure below illustrates it perfectly
More on max pooling here ::Max Pooling
The original paper on unpooling :: Unpooling
Some more resources one may find useful::
- Broadcasting in Numpy
- Scatter in tensorflow
- Cocatanation in Tensorflow
- Max Pool with Arg Max in Tensorflow
Example Usage ::
- Declare a tensor
original_tensor = tf.random_uniform([1,4,4,3],maxval=100,dtype='float32',seed=2)
- Use the max pool with arg max function to pool the tensor
pooled_tensor,max_indices=tf.nn.max_pool_with_argmax(original_tensor, ksize=[1,2,2,1], strides=[1,2,2,1], padding='SAME')
- Now armed with
pooled_tensor
andmax_indices
you can call theunpool_with_argamx
function !
unpooled_tensor=unpool_with_with_argmax(pooled_tensor,max_indices)
- It's done !
Lets have a look at it
- Original Tensor
- Pooled Tensor
- Max Indices