resnet 50

Providermicrosoft
Categoryimage-classification
Licenseapache-2.0
Downloads969
Stars4

Overview

ResNet-50 is a foundational deep residual network that solved the vanishing gradient problem in deep architectures through the use of skip connections. For developers, this model serves as a reliable, industry-standard baseline for image classification tasks. Unlike deeper variants, ResNet-50 balances computational efficiency with high accuracy, making it ideal for deployment in resource-constrained environments or as a feature extractor for downstream transfer learning. It integrates seamlessly with major frameworks like PyTorch and TensorFlow, offering extensive pre-trained weights on ImageNet. Whether you are building a visual search engine or an automated tagging system, ResNet-50 provides the stability and speed required for production-grade computer vision pipelines.

Highlights

  • Skip connections enable stable training of deep architectures
  • Efficient balance between inference speed and classification accuracy
  • Industry-standard baseline for transfer learning and feature extraction
  • Broad compatibility across all major deep learning frameworks
  • Permissive Apache-2.0 license for flexible commercial deployment

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("microsoft/resnet-50")
tokenizer = AutoTokenizer.from_pretrained("microsoft/resnet-50")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download microsoft/resnet-50

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download microsoft/resnet-50 config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('microsoft/resnet-50')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/microsoft/resnet-50

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/microsoft/resnet-50

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('microsoft/resnet-50')
tokenizer = AutoTokenizer.from_pretrained('microsoft/resnet-50')

Model Download

We recommend downloading the model via the ModelScope CLI or SDK.

Guidance:Before downloading, install ModelScope with:

Guidance
pip install modelscope

CLI Download

Download the full repository

Download the full repository
modelscope download --model microsoft/resnet-50

Download a single file to a local folder (e.g. README.md into ./dir)

Download a single file to a local folder (e.g. README.md into ./dir)
modelscope download --model microsoft/resnet-50 README.md --local_dir ./dir

See the docs for more CLI options

SDK Download

SDK Download
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('microsoft/resnet-50')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://www.modelscope.cn/microsoft/resnet-50.git

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/microsoft/resnet-50.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook Quickstart

Install the ModelScope library

Install the ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

Load the model and run inference

Load the model and run inference
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'microsoft/resnet-50')

Full Documentation

来源: HuggingFace

---
license: apache-2.0
tags:

  • vision

  • image-classification

datasets:
  • imagenet-1k

---

ResNet-50 v1.5

ResNet model pre-trained on ImageNet-1k at resolution 224x224. It was introduced in the paper Deep Residual Learning for Image Recognition by He et al.

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

Model description

ResNet (Residual Network) is a convolutional neural network that democratized the concepts of residual learning and skip connections. This enables to train much deeper models.

This is ResNet v1.5, which differs from the original model: in the bottleneck blocks which require downsampling, v1 has stride = 2 in the first 1x1 convolution, whereas v1.5 has stride = 2 in the 3x3 convolution. This difference makes ResNet50 v1.5 slightly more accurate (\~0.5% top1) than v1, but comes with a small performance drawback (~5% imgs/sec) according to Nvidia.

!model image

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:

python
from transformers import AutoImageProcessor, ResNetForImageClassification
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

processor = AutoImageProcessor.from_pretrained("microsoft/resnet-50")
model = ResNetForImageClassification.from_pretrained("microsoft/resnet-50")

inputs = processor(image, return_tensors="pt")

with torch.no_grad():
logits = model(**inputs).logits

model predicts one of the 1000 ImageNet classes

predicted_label = logits.argmax(-1).item() print(model.config.id2label[predicted_label])

For more code examples, we refer to the documentation.

BibTeX entry and citation info

bibtex
@inproceedings{he2016deep,
  title={Deep residual learning for image recognition},
  author={He, Kaiming and Zhang, Xiangyu and Ren, Shaoqing and Sun, Jian},
  booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
  pages={770--778},
  year={2016}
}
Join our Telegram