/ Модель

Характеристики

Лицензия
Apache 2.0
Архитектура
poolformer · dense
Опубликована
2 мар 2022

poolformer_s12

Классификация изображенийИзображение → label3 профессии

PoolFormer-S12 — модель классификации изображений на 1 000 классов ImageNet, использующая pooling вместо внимания.

11 045скачиваний за 30 дней1лайквеса обновлены19 сен 2023

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

PoolFormer-S12 — модель компьютерного зрения для классификации изображений, разработанная авторами Yu et al. в работе «MetaFormer is Actually What You Need for Vision». Это архитектура семейства PoolFormer: вместо механизма внимания в блоках используется пространственная операция pooling. Модель обучена на ImageNet-1k с изображениями размером 224×224 и распознаёт 1 000 классов. Вариант S12 содержит около 12 млн параметров; в таблице результатов README для него указана точность top-1 77,2% на ImageNet.

Модель предназначена для присвоения изображению класса ImageNet и может служить базовой моделью для экспериментов с задачами компьютерного зрения. Метаданные указывают pipeline image-classification, архитектуру PoolFormerForImageClassification и форматы PyTorch и safetensors. Лицензия — Apache-2.0. Она обучена на ImageNet-1k, поэтому качество и набор классов ограничены этой задачей; для других сценариев может потребоваться дообучение.

Сценарии применения

  • Классификация изображений по классам ImageNet
  • Определение объекта на фотографии
  • Создание базового классификатора для экспериментов с компьютерным зрением

Ограничения

Модель ориентирована на 1 000 классов ImageNet-1k и обучалась на разрешении 224×224; для задач и классов за пределами этого набора может потребоваться адаптация.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

PoolFormer (S12 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_s12')
model = PoolFormerForImageClassification.from_pretrained('sail/poolformer_s12')
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

ModelImageNet top-1 accuracy# paramsURL
PoolFormer-S1277.212Mhttps://huggingface.co/sail/poolformer_s12
PoolFormer-S2480.321Mhttps://huggingface.co/sail/poolformer_s24
PoolFormer-S3681.431Mhttps://huggingface.co/sail/poolformer_s36
PoolFormer-M3682.156Mhttps://huggingface.co/sail/poolformer_m36
PoolFormer-M4882.573Mhttps://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}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · image-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
PoolFormerForImageClassification
Ревизия весов
01bcf57

0 моделей