I need a (non-trainable) layer in Keras which does a local maximum search for a 2-dim input and sums up all entries in a certain environment around that maximum. The input shape to the layer is something like (None, 1, 24, 16).
To make it more clear let's look at how the input would look like:
The desired output of the layer should then be:
So it should find every local maximum and then sum up all entries from the (up to) 8 neighbouring pixels to that maximum.
It's a high energy physics related problem, so the interpretation of these "images" should not be too important I think.
How can I accomplish that using Keras layers?
Any suggestions? Thanks!