/ Модель

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

Лицензия
Apache 2.0
Архитектура
custom_resnet · dense
Базовая модель
resnet50d.ra2_in1k
Библиотека
transformers
Опубликована
18 окт 2026

custom-resnet50d

Классификация изображенийИзображение → label3 профессии
74скачиваний за 30 дней0лайковвеса обновлены18 окт 2026

Описание модели

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

Экспорт ResNet50D для классификации изображений по 1 000 классам ImageNet-1k и извлечения визуальных признаков через Transformers.

Это совместимый с Transformers экспорт сверточного классификатора ResNet50D, созданный по учебному руководству. Веса скопированы из timm/resnet50d.ra2_in1k без дополнительного обучения; модель содержит 25 576 264 параметра и предсказывает один из 1 000 классов ImageNet-1k. Репозиторий включает веса safetensors, конфигурацию, код модели, названия классов и обработчик изображений.

Модель предназначена для классификации изображений и извлечения визуальных признаков, в том числе в проектах, использующих интерфейс Transformers. Экспорт проверяет загрузку через AutoClass и совпадение весов и выходов с исходной реализацией timm, но эти проверки не оценивают точность классификации. Дополнительного обучения и оценки смещений для экспорта не проводилось; предсказания ограничены классами ImageNet-1k. Лицензия — Apache-2.0.

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

  • классификация изображений по классам ImageNet-1k
  • извлечение визуальных признаков из изображений
  • интеграция ResNet50D в приложение на Transformers

Ограничения

Классификатор ограничен 1 000 классами ImageNet-1k. Для этого экспорта не проводились дополнительное обучение, оценка точности или оценка смещений.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

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

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

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

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

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

Открыть на Hugging Face

Custom ResNet50d

A Transformers-compatible wrapper around the pretrained timm/resnet50d.ra2_in1k ImageNet-1k classifier, following the custom model tutorial. The pretrained weights are copied from timm without additional training.

The model has 25,576,264 parameters and predicts 1,000 ImageNet classes. The repository includes the custom Python code, safetensors weights, configuration, ImageNet class names, and image processor.

Usage

Install the dependencies in requirements.txt, then load the model and processor:

import torch
from PIL import Image
from transformers import AutoImageProcessor, AutoModelForImageClassification

repo_id = "Dadigua12581/custom-resnet50d"
processor = AutoImageProcessor.from_pretrained(repo_id)
model = AutoModelForImageClassification.from_pretrained(
    repo_id, trust_remote_code=True
).eval()

image = Image.open("image.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
with torch.inference_mode():
    logits = model(**inputs)["logits"]
label = logits.argmax(-1).item()
print(model.config.id2label[label])

The processor converts images to RGB, resizes the shorter edge to 256 pixels using bicubic interpolation, center-crops to 224 x 224, rescales to [0, 1], and normalizes with ImageNet mean and standard deviation.

Pass integer class indices as labels to compute cross-entropy loss:

outputs = model(**inputs, labels=torch.tensor([label]))
loss = outputs["loss"]

For spatial features, load AutoModel instead:

from transformers import AutoModel

backbone = AutoModel.from_pretrained(repo_id, trust_remote_code=True).eval()
with torch.inference_mode():
    features = backbone(**inputs)  # (batch, 2048, 7, 7) for 224 x 224 inputs

Reproduce the export

The local project uses the tutorial's Python package structure under src/:

src/
└── resnet_model/
    ├── __init__.py
    ├── configuration_resnet.py
    └── modeling_resnet.py

Import the model and configuration as in the tutorial:

from resnet_model.configuration_resnet import ResnetConfig
from resnet_model.modeling_resnet import ResnetModel, ResnetModelForImageClassification

The top-level cfg.py and model.py retain their original import paths. save_pretrained() copies configuration_resnet.py and modeling_resnet.py to the exported model directory; the export script also includes __init__.py. modeling_resnet.py uses a relative import of .configuration_resnet. The saved auto_map points AutoConfig and AutoModel classes to these files.

uv run prepare_model.py --repo-id Dadigua12581/custom-resnet50d
hf upload Dadigua12581/custom-resnet50d artifacts/custom-resnet50d .

The export checks that AutoClass can reload both models, preserve all pretrained weights exactly, and reproduce timm's logits and spatial features within floating point tolerance on a sample input. It also checks that classification loss is finite. These checks do not measure model accuracy.

Intended use and limitations

This is a tutorial export for image classification and feature extraction. Predictions are restricted to ImageNet-1k classes. No additional fine-tuning, accuracy evaluation, or bias evaluation was performed for this export. See the source model card for details about the original training and results.

License

Apache-2.0, consistent with the source timm model. ResNet architecture: Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun, Deep Residual Learning for Image Recognition (2015).

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

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

GPU в ailist

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

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
ResnetModelForImageClassification
Ревизия весов
21475ce

0 моделей