英文

ConvNeXT (xlarge-sized model)

ConvNeXT模型在ImageNet-22k上进行预训练,并在分辨率为384x384的ImageNet-1k上进行了微调。该模型由刘等人在论文 A ConvNet for the 2020s 中提出,并首次在 this repository 中发布。

免责声明:发布ConvNeXT模型的团队未为该模型撰写模型卡片,因此这个模型卡片是由Hugging Face团队撰写的。

模型描述

ConvNeXT是一个纯卷积模型(ConvNet),受到Vision Transformers设计的启发,声称在性能上超越了Vision Transformers。作者从一个ResNet开始,并通过借鉴Swin Transformer的设计来“现代化”其设计。

预期用途和限制

您可以使用原始模型进行图像分类。详情请参阅 model hub ,以查找您感兴趣的任务的微调版本。

如何使用

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

from transformers import ConvNextImageProcessor, ConvNextForImageClassification
import torch
from datasets import load_dataset

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

processor = ConvNextImageProcessor.from_pretrained("facebook/convnext-xlarge-384-22k-1k")
model = ConvNextForImageClassification.from_pretrained("facebook/convnext-xlarge-384-22k-1k")

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

有关更多代码示例,请参阅 documentation

BibTeX条目和引用信息

@article{DBLP:journals/corr/abs-2201-03545,
  author    = {Zhuang Liu and
               Hanzi Mao and
               Chao{-}Yuan Wu and
               Christoph Feichtenhofer and
               Trevor Darrell and
               Saining Xie},
  title     = {A ConvNet for the 2020s},
  journal   = {CoRR},
  volume    = {abs/2201.03545},
  year      = {2022},
  url       = {https://arxiv.org/abs/2201.03545},
  eprinttype = {arXiv},
  eprint    = {2201.03545},
  timestamp = {Thu, 20 Jan 2022 14:21:35 +0100},
  biburl    = {https://dblp.org/rec/journals/corr/abs-2201-03545.bib},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}