TensorFlow: Unpooling

There is a couple of tensorflow implementations here pooling.py

Namely:

1) unpool operation (source) that utilizes output of tf.nn.max_pool_with_argmax. Although please notice, that as of tensorflow 1.0 tf.nn.max_pool_with_argmax is GPU-only

2) upsample operation that mimics inverse of max-pooling by filling positions of unpooled region with either zeros or copies of max element. Comparing to tensorpack it allows copies of elements instead of zeros and supports strides other than [2, 2].

No recompile, back-prop friendly.

Illustration: Upsampling

Unpooling


I don't think there is an official unpooling layer yet which is frustrating because you have to use image resize (bilinear interpolation or nearest neighbor) which is like an average unpooling operation and it's reaaaly slow. Look at the tf api in the section 'image' and you will find it.

Tensorflow has a maxpooling_with_argmax thing where you get you maxpooled output as well as the activation map which is nice as you could use it in an unpooling layer to preserve the 'lost' spacial information but it seems as there isn't such an unpooling operation that does it. I guess that they are planning to add it ... soon.

Edit: I found some guy on google discuss a week ago who seems to have implemented something like this but I personally haven't tried it yet. https://github.com/ppwwyyxx/tensorpack/blob/master/tensorpack/models/pool.py#L66