/ Модель

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

Лицензия
Своя лицензия
Архитектура
mambavision · dense
Библиотека
transformers
Опубликована
14 июл 2024

MambaVision-L-1K

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

Гибридная модель NVIDIA на базе Mamba и Transformer для классификации изображений и извлечения визуальных признаков.

124скачиваний за 30 дней6лайковвеса обновлены27 мар 2025

Бенчмарки

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

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

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

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

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

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

MambaVision-L-1K — модель компьютерного зрения, разработанная NVIDIA. Это вариант семейства MambaVision с гибридной иерархической архитектурой, сочетающей Mamba-блоки и блоки self-attention на поздних слоях, чтобы эффективно учитывать дальние пространственные зависимости. Модель предназначена для классификации изображений; также её можно использовать как экстрактор признаков, получая представления с четырёх этапов сети и итоговые признаки после усреднённого пулинга.

Карточка заявляет высокую точность Top-1 и пропускную способность относительно компромиссной границы этих показателей. В качестве набора данных указан ImageNet-1K; пример в README демонстрирует классификацию изображения с меткой «бурый медведь». Доступны веса в формате safetensors и использование через Transformers. Лицензия указана как other, поэтому перед применением следует проверить условия лицензирования репозитория.

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

  • классификация объектов на изображениях
  • определение классов изображений ImageNet
  • извлечение признаков из изображений для последующих задач

Ограничения

Модель ориентирована на классификацию изображений и извлечение признаков; возможности генерации изображений в карточке не заявлены. Лицензия обозначена как other, поэтому условия использования следует уточнить в репозитории.

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

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

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

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

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

Открыть на Hugging Face

MambaVision: A Hybrid Mamba-Transformer Vision Backbone.

Model Overview

We have developed the first hybrid model for computer vision which leverages the strengths of Mamba and Transformers. Specifically, our core contribution includes redesigning the Mamba formulation to enhance its capability for efficient modeling of visual features. In addition, we conducted a comprehensive ablation study on the feasibility of integrating Vision Transformers (ViT) with Mamba. Our results demonstrate that equipping the Mamba architecture with several self-attention blocks at the final layers greatly improves the modeling capacity to capture long-range spatial dependencies. Based on our findings, we introduce a family of MambaVision models with a hierarchical architecture to meet various design criteria.

Model Performance

MambaVision demonstrates a strong performance by achieving a new SOTA Pareto-front in terms of Top-1 accuracy and throughput.

Model Usage

It is highly recommended to install the requirements for MambaVision by running the following:

pip install mambavision

For each model, we offer two variants for image classification and feature extraction that can be imported with 1 line of code.

Image Classification

In the following example, we demonstrate how MambaVision can be used for image classification.

Given the following image from COCO dataset val set as an input:

The following snippet can be used for image classification:

from transformers import AutoModelForImageClassification
from PIL import Image
from timm.data.transforms_factory import create_transform
import requests

model = AutoModelForImageClassification.from_pretrained("nvidia/MambaVision-L-1K", trust_remote_code=True)

# eval mode for inference
model.cuda().eval()

# prepare image for the model
url = 'http://images.cocodataset.org/val2017/000000020247.jpg'
image = Image.open(requests.get(url, stream=True).raw)
input_resolution = (3, 224, 224)  # MambaVision supports any input resolutions

transform = create_transform(input_size=input_resolution,
                             is_training=False,
                             mean=model.config.mean,
                             std=model.config.std,
                             crop_mode=model.config.crop_mode,
                             crop_pct=model.config.crop_pct)

inputs = transform(image).unsqueeze(0).cuda()
# model inference
outputs = model(inputs)
logits = outputs['logits'] 
predicted_class_idx = logits.argmax(-1).item()
print("Predicted class:", model.config.id2label[predicted_class_idx])

The predicted label is brown bear, bruin, Ursus arctos.

Feature Extraction

MambaVision can also be used as a generic feature extractor.

Specifically, we can extract the outputs of each stage of model (4 stages) as well as the final averaged-pool features that are flattened.

The following snippet can be used for feature extraction:

from transformers import AutoModel
from PIL import Image
from timm.data.transforms_factory import create_transform
import requests

model = AutoModel.from_pretrained("nvidia/MambaVision-L-1K", trust_remote_code=True)

# eval mode for inference
model.cuda().eval()

# prepare image for the model
url = 'http://images.cocodataset.org/val2017/000000020247.jpg'
image = Image.open(requests.get(url, stream=True).raw)
input_resolution = (3, 224, 224)  # MambaVision supports any input resolutions

transform = create_transform(input_size=input_resolution,
                             is_training=False,
                             mean=model.config.mean,
                             std=model.config.std,
                             crop_mode=model.config.crop_mode,
                             crop_pct=model.config.crop_pct)
inputs = transform(image).unsqueeze(0).cuda()
# model inference
out_avg_pool, features = model(inputs)
print("Size of the averaged pool features:", out_avg_pool.size())  # torch.Size([1, 640])
print("Number of stages in extracted features:", len(features)) # 4 stages
print("Size of extracted features in stage 1:", features[0].size()) # torch.Size([1, 80, 56, 56])
print("Size of extracted features in stage 4:", features[3].size()) # torch.Size([1, 640, 7, 7])

License:

NVIDIA Source Code License-NC

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
MambaVisionModelForImageClassification
Ревизия весов
63df00c

0 моделей