模型:
facebook/convnextv2-large-1k-224
ConvNeXt V2 模型是在 FCMAE 框架上进行预训练,并在 ImageNet-1K 数据集上进行了 224x224 分辨率的微调。该模型是由 Woo 等人在论文 ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders 中提出的,并在 this repository 首次发布。
声明:ConvNeXT V2 团队没有为这个模型编写模型卡片,因此这个模型卡片是由 Hugging Face 团队编写的。
ConvNeXt V2 是一个纯卷积模型(ConvNet),它引入了完全卷积的遮罩自编码器框架(FCMAE)和一个新的全局响应归一化(GRN)层到 ConvNeXt。ConvNeXt V2 在各种识别基准上显著改善了纯 ConvNet 的性能。
您可以使用原始模型进行图像分类。请参阅 model hub ,寻找您感兴趣的任务的微调版本。
在这里,您可以了解如何使用此模型将 COCO 2017 数据集中的图像分类为 1,000 个 ImageNet 类别之一:
from transformers import AutoImageProcessor, ConvNextV2ForImageClassification
import torch
from datasets import load_dataset
dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]
preprocessor = AutoImageProcessor.from_pretrained("facebook/convnextv2-large-1k-224")
model = ConvNextV2ForImageClassification.from_pretrained("facebook/convnextv2-large-1k-224")
inputs = preprocessor(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 。
@article{DBLP:journals/corr/abs-2301-00808,
author = {Sanghyun Woo and
Shoubhik Debnath and
Ronghang Hu and
Xinlei Chen and
Zhuang Liu and
In So Kweon and
Saining Xie},
title = {ConvNeXt {V2:} Co-designing and Scaling ConvNets with Masked Autoencoders},
journal = {CoRR},
volume = {abs/2301.00808},
year = {2023},
url = {https://doi.org/10.48550/arXiv.2301.00808},
doi = {10.48550/arXiv.2301.00808},
eprinttype = {arXiv},
eprint = {2301.00808},
timestamp = {Tue, 10 Jan 2023 15:10:12 +0100},
biburl = {https://dblp.org/rec/journals/corr/abs-2301-00808.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}