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

Feature: add option global_pool='max' to VisionTransformer #2207

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

fcossio
Copy link
Contributor

@fcossio fcossio commented Jun 14, 2024

Most of the CNNs models have a max global pooling option. I would like to extend ViT to have this option.

Most of the CNNs have a max global pooling option. I would like to extend ViT to have this option.
@rwightman
Copy link
Collaborator

@fcossio better to use amax for this... but before adding, I'd like some signal/indication that it's worth the LoC. Have you trained models from scratch or fine-tuned with the swap and shown noteworthy results vs avg pool?

@fcossio
Copy link
Contributor Author

fcossio commented Jun 14, 2024

For high resolution images where the foreground has a small area, fine-tuning with max pooling worked slightly better both in target metrics and interpretability. I would like to contribute these LoC so that I don't need to keep a custom branch while at the same time it might benefit someone else.

Will be happy to edit the PR to amax if you think the PR is worth merging

@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 mentioned this pull request Jun 15, 2024
@rwightman rwightman merged commit 9567cf6 into huggingface:main Jun 17, 2024
22 checks passed
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