Skip to content

Support for AdaptivePooling #183

@awsaf49

Description

@awsaf49

System information.

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

Describe the feature and the current behavior/state.
Currently, Keras doesn't have support for this feature. Adaptive pooling is widely used in architecture building as it allows for dynamic kernel size and can create a desired output shape, unlike traditional pooling methods. Even PyTorch support this AdaptivePooling.

Use-case: Let's consider an image classification task where the network needs to accept images of varying sizes. We want the network to output a fixed-size feature map regardless of the input image size. Here, adaptive pooling would be useful. By dynamically adjusting the pooling window size and stride based on the input, adaptive pooling ensures that the output feature map size is constant.

Will this change the current api? How?
No

Who will benefit from this feature?
The research community who are working on creating new architecture will benefit from this.

Contributing

  • Do you want to contribute a PR? (yes/no): Yes
  • If yes, please read this page for instructions
  • Briefly describe your candidate solution(if contributing):
    As TensorFlow Addons has support for this feature here, I would like to adapt it from there with the necessary modifications to fit Keras API. This feature may look something like this,
tf.keras.layers.AdaptiveAveragePooling2D(output_size, data_format=None, **kwargs)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions