/ Модель

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

Лицензия
Своя лицензия
Архитектура
mobilevit · dense
Опубликована
30 мая 2022

mobilevit-small

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

Компактная модель Apple MobileViT-S классифицирует изображения по 1000 классам ImageNet и рассчитана на эффективное применение в компьютерном зрении.

7 680скачиваний за 30 дней94лайкавеса обновлены24 фев 2025

Бенчмарки

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

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

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

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

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

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

apple/mobilevit-small — компактная модель MobileViT-S для классификации изображений, опубликованная Apple. Она сочетает слои свёрточной сети в стиле MobileNetV2 с блоками трансформера: изображения преобразуются в патчи для глобальной обработки, а затем снова в карты признаков. Модель обучена с нуля на ImageNet-1k и рассчитана на эффективное применение в сценариях компьютерного зрения, в том числе на мобильных устройствах.

Модель относит изображение к одному из 1000 классов ImageNet. В README приведены результаты на ImageNet: точность top-1 — 78,4%, top-5 — 94,1%; для варианта MobileViT-S указано 5,6 млн параметров. Для вывода требуется подготовить изображение: в карточке описаны изменение размера и центральное кадрирование до 256×256 пикселей, нормализация значений пикселей в диапазон [0, 1] и порядок каналов BGR. Доступны веса PyTorch, TensorFlow и Core ML. Лицензия — Apple Sample Code License.

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

  • классификация объектов на фотографиях
  • определение класса изображения из 1000 категорий ImageNet
  • классификация изображений на мобильном устройстве

Ограничения

Модель предназначена для классификации по классам ImageNet-1k и не является специализированным решением для произвольных наборов категорий. Для предсказаний важна описанная в карточке предобработка, включая порядок каналов BGR.

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

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

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

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

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

Открыть на Hugging Face

MobileViT (small-sized model)

MobileViT model pre-trained on ImageNet-1k at resolution 256x256. It was introduced in MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer by Sachin Mehta and Mohammad Rastegari, and first released in this repository. The license used is Apple sample code license.

Disclaimer: The team releasing MobileViT did not write a model card for this model so this model card has been written by the Hugging Face team.

Model description

MobileViT is a light-weight, low latency convolutional neural network that combines MobileNetV2-style layers with a new block that replaces local processing in convolutions with global processing using transformers. As with ViT (Vision Transformer), the image data is converted into flattened patches before it is processed by the transformer layers. Afterwards, the patches are "unflattened" back into feature maps. This allows the MobileViT-block to be placed anywhere inside a CNN. MobileViT does not require any positional embeddings.

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 MobileViTFeatureExtractor, MobileViTForImageClassification
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 = MobileViTFeatureExtractor.from_pretrained("apple/mobilevit-small")
model = MobileViTForImageClassification.from_pretrained("apple/mobilevit-small")

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 MobileViT model was pretrained on ImageNet-1k, a dataset consisting of 1 million images and 1,000 classes.

Training procedure

Preprocessing

Training requires only basic data augmentation, i.e. random resized cropping and horizontal flipping.

To learn multi-scale representations without requiring fine-tuning, a multi-scale sampler was used during training, with image sizes randomly sampled from: (160, 160), (192, 192), (256, 256), (288, 288), (320, 320).

At inference time, images are resized/rescaled to the same resolution (288x288), and center-cropped at 256x256.

Pixels are normalized to the range [0, 1]. Images are expected to be in BGR pixel order, not RGB.

Pretraining

The MobileViT networks are trained from scratch for 300 epochs on ImageNet-1k on 8 NVIDIA GPUs with an effective batch size of 1024 and learning rate warmup for 3k steps, followed by cosine annealing. Also used were label smoothing cross-entropy loss and L2 weight decay. Training resolution varies from 160x160 to 320x320, using multi-scale sampling.

Evaluation results

ModelImageNet top-1 accuracyImageNet top-5 accuracy# paramsURL
MobileViT-XXS69.088.91.3 Mhttps://huggingface.co/apple/mobilevit-xx-small
MobileViT-XS74.892.32.3 Mhttps://huggingface.co/apple/mobilevit-x-small
MobileViT-S78.494.15.6 Mhttps://huggingface.co/apple/mobilevit-small

BibTeX entry and citation info

@inproceedings{vision-transformer,
title = {MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer},
author = {Sachin Mehta and Mohammad Rastegari},
year = {2022},
URL = {https://arxiv.org/abs/2110.02178}
}

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
MobileViTForImageClassification
Ревизия весов
6c86125

0 моделей