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

ViT pooling refactor #2209

Merged
merged 4 commits into from
Jun 17, 2024
Merged

ViT pooling refactor #2209

merged 4 commits into from
Jun 17, 2024

Conversation

rwightman
Copy link
Collaborator

Subsume #2207 .. testing.

fcossio and others added 2 commits June 14, 2024 15:24
Most of the CNNs have a max global pooling option. I would like to extend ViT to have this option.
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@rwightman rwightman merged commit e41125c into main Jun 17, 2024
25 checks passed
@fcossio
Copy link
Contributor

fcossio commented Jun 17, 2024

Exciting! Looking forward to testing the new 'avgmax' do you have a reference to where this was proposed?

@rwightman
Copy link
Collaborator Author

rwightman commented Jun 17, 2024

@fcossio I forget the exact origin, I think my use was influenced by the Dual-Path-Net mean-max pooling, though they used it at test time. https://arxiv.org/abs/1707.01629

I've been using a form of it since before timm was a thing, it was useful in some satellite imagery situations in my early Kaggle adventures. Been one of the 2d pooling options in timm for a long long time https://github.com/huggingface/pytorch-image-models/blob/main/timm/layers/adaptive_avgmax_pool.py

Seems to work pretty well here too. When I was testing the max pool on resisc (satellite), avgmax was actually doing better than max or avg. I was never a huge fan of max because it sparsifies the gradient so much.

@rwightman
Copy link
Collaborator Author

I believe fastai added an option for the combined avg + max pooling in a similar time frame for convnets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants