[WIP] Allow for pooling over the first blob axis based on a key #3732
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Internally, we have found that treating images as a collection and pooling over them results in improved performance for some tasks.
In an attempt to generalize this, I have started work on a key-based pooling layer. The idea is that in addition to the bottom blob representing the input data, a second blob is provided that indicates the keys associated with each of the entries in the batch (first dimension). An additional pooling step is then used to pool over all images withe the same key.
This can be seen as something similar to a reduce-by-key operation.
Although I am implementing this as an additional layer (which has a pooling layer member), there are some open questions which may indicate that it would be worth it to extend the pooling layer itself. As the initial proof of concept, I am performing the MAX pooling over the keys as a hard-coded step. Ideally, this should be handled by the pooling layer itself. Does it make sense to add further parameters to the pooling layer that handles these options? Is it feasible to pool over color channels, for example?