keras icon indicating copy to clipboard operation
keras copied to clipboard

Add Generalized Mean Pooling layer

Open innat opened this issue 3 years ago • 2 comments

System information.

TensorFlow version (you are using): 2.8 Are you willing to contribute it (Yes/No) : No

Describe the feature and the current behavior/state.

Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. Formally:

$$ \textbf{e} = \left[\left(\frac{1}{|\Omega|}\sum_{u\in{\Omega}}x^{p}_{cu}\right)^{\frac{1}{p}}\right]_{c=1,\cdots,C} $$

where $p > 0$ is a parameter. Setting this exponent as $p > 1$ increases the contrast of the pooled feature map and focuses on the salient features of the image.

Paper: https://ieeexplore.ieee.org/document/8382272 Citation: 662

Will this change the current api? How?


tf.keras.layers.GeneralizedMeanPooling1D
tf.keras.layers.GeneralizedMeanPooling2D
tf.keras.layers.GeneralizedMeanPooling3D

Who will benefit from this feature?

keras practitioners.

Contributing

innat avatar Jun 21 '22 08:06 innat

This sounds reasonable and the citation count is sufficient to consider inclusion. GeMPooling*D seems like a better name.

Can you mention some architectures that use this pooling operation?

Do you want to contribute a PR? (yes/no): No.

Why not?

fchollet avatar Jun 29 '22 18:06 fchollet

This sounds reasonable and the citation count is sufficient to consider inclusion. GeMPooling*D seems like a better name.

The suggested layer name is reasonable to choose. But I'm wondering won't it be confusing with other similar type of *_pooling layer name to the end-user?

Do you want to contribute a PR? (yes/no): No. Why not?

No mentionable reason. I will send PR asap.

innat avatar Jun 29 '22 19:06 innat