HuggingFace镜像/resnet-50
模型介绍文件和版本分析

ResNet-50 v1.5

在分辨率为224x224的ImageNet-1k数据集上预训练的ResNet模型。该模型由He等人提出,并在论文Deep Residual Learning for Image Recognition中介绍。

免责声明:发布ResNet的团队并未为此模型编写模型卡,因此此模型卡由Hugging Face团队编写。

模型描述

ResNet(残差网络)是一种卷积神经网络,推广了残差学习和跳跃连接的概念。这使得训练更深的模型成为可能。

这是ResNet v1.5版本,与原始模型有所不同:在需要下采样的瓶颈块中,v1版本在第一个1x1卷积中使用步幅=2,而v1.5版本在3x3卷积中使用步幅=2。根据Nvidia的说法,这种差异使得ResNet50 v1.5比v1版本略微更准确(约0.5% top1),但伴随着轻微的性能损失(约5% imgs/sec)。

模型图像

预期用途与限制

您可以使用原始模型进行图像分类。请访问模型中心查找您感兴趣的任务上的微调版本。

如何使用

以下是如何使用此模型将COCO 2017数据集中的图像分类为1,000个ImageNet类别之一的示例:

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])

对于更多的代码示例,我们请参考文档。

BibTeX 引用条目和引用信息

如果您需要引用相关资料,可以使用BibTeX格式来添加引用。具体的条目内容应根据实际文献提供,但一般结构如下所示,您应该替换<author>、<year>等占位符以匹配实际的信息:

@misc{example_bibtex_entry,
  title   = {Transformers Library Model Documentation: ResNet},
  author  = {<author>},
  year    = {<year>},
  url     = "https://huggingface.co/docs/transformers/main/en/model_doc/resnet",
}

请在您的学术作品中适当位置使用这个引用,确保遵循正确的引用格式要求。

@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}
}

当然,我会遵循您的要求,提供高质量的翻译服务。请提供您希望翻译的文本内容。

下载使用量0