Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic pooling (Or variable-size pooling?) #12645

Closed
celinaum opened this issue Apr 9, 2019 · 1 comment
Closed

Dynamic pooling (Or variable-size pooling?) #12645

celinaum opened this issue Apr 9, 2019 · 1 comment
Labels
type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.

Comments

@celinaum
Copy link

celinaum commented Apr 9, 2019

Is there a way of performing dynamic pooling in Keras? (1D CNN)
Like Goldberg elaborates: Splitting the resulting output from the convolution (conv layer) into r groups, thus apply pooling separately on each group, where the groups can be of different sizes.
Or is there a way of performing variable-size pooling?

Example:
Given a text of sentences, text = [sentence1, sentence2, sentence3], where sentence1 is of length 20, sentence2 of length 15, and sentence3 of length 18 (counted in words).
Is there a way of grouping the convolution associated with the words from sentence1, sentence2, and sentence3? Thus apply pooling at each group.
...
conv = Conv1D(filters=100 kernel_size=2, strides=1, padding="valid", activation="relu")(training)
pool_0 = MaxPooling1D(pool_size=20, stride=20)(conv[0])
pool_1 = MaxPooling1D(pool_size=15, stride=15)(conv[1])
pool_2 = MaxPooling1D(pool_size=18, stride=18)(conv[2])
traning = concatenate([pool_0, pool_1, pool_2)
...

Or performing variable-size pooling, a structure like:
...
conv = Conv1D(filters=100 kernel_size=2, strides=1, padding="valid", activation="relu")(training)
pool = MaxPooling1D(pool_size=[20, 15, 18], stride=[20, 15, 18])(conv)
traning = concatenate([pool[0], pool[1], pool[2])
...

Thanks.

@jvishnuvardhan jvishnuvardhan added the type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited. label Apr 9, 2019
@rjurney
Copy link

rjurney commented Sep 20, 2019

I need this as well to implement XML-CNN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.
Projects
None yet
Development

No branches or pull requests

4 participants