sail / poolformer_m48

huggingface.co
Total runs: 6
24-hour runs: 0
7-day runs: -2
30-day runs: -1
Model's Last Updated: September 19 2023
image-classification

Introduction of poolformer_m48

Model Details of poolformer_m48

PoolFormer (M48 model)

PoolFormer model trained on ImageNet-1k (1 million images, 1,000 classes) at resolution 224x224. It was first introduced in the paper MetaFormer is Actually What You Need for Vision by Yu et al. and first released in this repository .

Model description

PoolFormer is a model that replaces attention token mixer in transfomrers with extremely simple operator, pooling.

Transformers have shown great potential in computer vision tasks. A common belief is their attention-based token mixer module contributes most to their competence. However, recent works show the attention-based module in transformers can be replaced by spatial MLPs and the resulted models still perform quite well. Based on this observation, we hypothesize that the general architecture of the transformers, instead of the specific token mixer module, is more essential to the model's performance. To verify this, we deliberately replace the attention module in transformers with an embarrassingly simple spatial pooling operator to conduct only the most basic token mixing. Surprisingly, we observe that the derived model, termed as PoolFormer, achieves competitive performance on multiple computer vision tasks. For example, on ImageNet-1K, PoolFormer achieves 82.1% top-1 accuracy, surpassing well-tuned vision transformer/MLP-like baselines DeiT-B/ResMLP-B24 by 0.3%/1.1% accuracy with 35%/52% fewer parameters and 48%/60% fewer MACs. The effectiveness of PoolFormer verifies our hypothesis and urges us to initiate the concept of "MetaFormer", a general architecture abstracted from transformers without specifying the token mixer. Based on the extensive experiments, we argue that MetaFormer is the key player in achieving superior results for recent transformer and MLP-like models on vision tasks. This work calls for more future research dedicated to improving MetaFormer instead of focusing on the token mixer modules. Additionally, our proposed PoolFormer could serve as a starting baseline for future MetaFormer architecture design.

Intended uses & limitations

You can use the raw model for image classification. See the model hub to look for fine-tuned versions on a task that interests you.

How to use

Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:

from transformers import PoolFormerFeatureExtractor, PoolFormerForImageClassification
from PIL import Image
import requests
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
image = Image.open(requests.get(url, stream=True).raw)
feature_extractor = PoolFormerFeatureExtractor.from_pretrained('sail/poolformer_m48')
model = PoolFormerForImageClassification.from_pretrained('sail/poolformer_m48')
inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
# model predicts one of the 1000 ImageNet classes
predicted_class_idx = logits.argmax(-1).item()
print("Predicted class:", model.config.id2label[predicted_class_idx])

Currently, both the feature extractor and model support PyTorch.

Training data

The poolformer model was trained on ImageNet-1k , a dataset consisting of 1 million images and 1k classes.

Training procedure
Preprocessing

The exact details of preprocessing of images during training/validation can be found here .

Pretraining

The model was trained on TPU-v3s. Training resolution is 224. For all hyperparameters (such as batch size and learning rate), please refer to the original paper.

Evaluation results
Model ImageNet top-1 accuracy # params URL
PoolFormer-S12 77.2 12M https://huggingface.co/sail/poolformer_s12
PoolFormer-S24 80.3 21M https://huggingface.co/sail/poolformer_s24
PoolFormer-S36 81.4 31M https://huggingface.co/sail/poolformer_s36
PoolFormer-M36 82.1 56M https://huggingface.co/sail/poolformer_m36
PoolFormer-M48 82.5 73M https://huggingface.co/sail/poolformer_m48
BibTeX entry and citation info
@article{yu2021metaformer,
  title={MetaFormer is Actually What You Need for Vision},
  author={Yu, Weihao and Luo, Mi and Zhou, Pan and Si, Chenyang and Zhou, Yichen and Wang, Xinchao and Feng, Jiashi and Yan, Shuicheng},
  journal={arXiv preprint arXiv:2111.11418},
  year={2021}
}

Runs of sail poolformer_m48 on huggingface.co

6
Total runs
0
24-hour runs
-1
3-day runs
-2
7-day runs
-1
30-day runs

More Information About poolformer_m48 huggingface.co Model

More poolformer_m48 license Visit here:

https://choosealicense.com/licenses/apache-2.0

poolformer_m48 huggingface.co

poolformer_m48 huggingface.co is an AI model on huggingface.co that provides poolformer_m48's model effect (), which can be used instantly with this sail poolformer_m48 model. huggingface.co supports a free trial of the poolformer_m48 model, and also provides paid use of the poolformer_m48. Support call poolformer_m48 model through api, including Node.js, Python, http.

poolformer_m48 huggingface.co Url

https://huggingface.co/sail/poolformer_m48

sail poolformer_m48 online free

poolformer_m48 huggingface.co is an online trial and call api platform, which integrates poolformer_m48's modeling effects, including api services, and provides a free online trial of poolformer_m48, you can try poolformer_m48 online for free by clicking the link below.

sail poolformer_m48 online free url in huggingface.co:

https://huggingface.co/sail/poolformer_m48

poolformer_m48 install

poolformer_m48 is an open source model from GitHub that offers a free installation service, and any user can find poolformer_m48 on GitHub to install. At the same time, huggingface.co provides the effect of poolformer_m48 install, users can directly use poolformer_m48 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

poolformer_m48 install url in huggingface.co:

https://huggingface.co/sail/poolformer_m48

Url of poolformer_m48

poolformer_m48 huggingface.co Url

Provider of poolformer_m48 huggingface.co

sail
ORGANIZATIONS

Other API from sail

huggingface.co

Total runs: 646
Run Growth: -16
Growth Rate: -2.48%
Updated:September 19 2023
huggingface.co

Total runs: 276
Run Growth: 117
Growth Rate: 42.39%
Updated:February 20 2025
huggingface.co

Total runs: 264
Run Growth: 117
Growth Rate: 44.32%
Updated:December 21 2024
huggingface.co

Total runs: 156
Run Growth: 68
Growth Rate: 43.59%
Updated:February 20 2025
huggingface.co

Total runs: 78
Run Growth: 4
Growth Rate: 5.13%
Updated:December 21 2024
huggingface.co

Total runs: 68
Run Growth: 30
Growth Rate: 44.12%
Updated:December 21 2024
huggingface.co

Total runs: 66
Run Growth: 40
Growth Rate: 60.61%
Updated:February 20 2025
huggingface.co

Total runs: 64
Run Growth: -48
Growth Rate: -75.00%
Updated:December 21 2024
huggingface.co

Total runs: 57
Run Growth: 44
Growth Rate: 77.19%
Updated:April 08 2022
huggingface.co

Total runs: 54
Run Growth: -235
Growth Rate: -435.19%
Updated:December 21 2024
huggingface.co

Total runs: 49
Run Growth: 43
Growth Rate: 87.76%
Updated:April 08 2022
huggingface.co

Total runs: 48
Run Growth: -22
Growth Rate: -45.83%
Updated:December 21 2024
huggingface.co

Total runs: 41
Run Growth: -43
Growth Rate: -104.88%
Updated:December 21 2024
huggingface.co

Total runs: 37
Run Growth: 24
Growth Rate: 64.86%
Updated:February 20 2025
huggingface.co

Total runs: 33
Run Growth: -47
Growth Rate: -142.42%
Updated:April 29 2025
huggingface.co

Total runs: 29
Run Growth: 8
Growth Rate: 27.59%
Updated:April 15 2025
huggingface.co

Total runs: 28
Run Growth: 14
Growth Rate: 50.00%
Updated:February 20 2025
huggingface.co

Total runs: 24
Run Growth: -2
Growth Rate: -8.33%
Updated:April 15 2025
huggingface.co

Total runs: 21
Run Growth: -10
Growth Rate: -47.62%
Updated:February 20 2025
huggingface.co

Total runs: 19
Run Growth: 15
Growth Rate: 78.95%
Updated:February 20 2025
huggingface.co

Total runs: 17
Run Growth: 10
Growth Rate: 58.82%
Updated:February 20 2025
huggingface.co

Total runs: 16
Run Growth: -926
Growth Rate: -5787.50%
Updated:December 21 2024
huggingface.co

Total runs: 16
Run Growth: 1
Growth Rate: 6.25%
Updated:February 20 2025
huggingface.co

Total runs: 10
Run Growth: 1
Growth Rate: 10.00%
Updated:February 20 2025
huggingface.co

Total runs: 9
Run Growth: -7
Growth Rate: -77.78%
Updated:December 21 2024
huggingface.co

Total runs: 9
Run Growth: 0
Growth Rate: 0.00%
Updated:February 20 2025
huggingface.co

Total runs: 8
Run Growth: -5
Growth Rate: -62.50%
Updated:February 20 2025
huggingface.co

Total runs: 7
Run Growth: 2
Growth Rate: 28.57%
Updated:February 20 2025
huggingface.co

Total runs: 7
Run Growth: 4
Growth Rate: 57.14%
Updated:February 20 2025
huggingface.co

Total runs: 5
Run Growth: -10
Growth Rate: -200.00%
Updated:April 29 2025
huggingface.co

Total runs: 4
Run Growth: -2
Growth Rate: -50.00%
Updated:September 19 2023
huggingface.co

Total runs: 4
Run Growth: 1
Growth Rate: 25.00%
Updated:February 20 2025
huggingface.co

Total runs: 3
Run Growth: -10
Growth Rate: -333.33%
Updated:February 24 2025
huggingface.co

Total runs: 2
Run Growth: -5
Growth Rate: -250.00%
Updated:February 20 2025
huggingface.co

Total runs: 1
Run Growth: -1
Growth Rate: -100.00%
Updated:April 18 2023
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:June 27 2023
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:December 11 2022
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:June 02 2023
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:October 31 2022