模型:
facebook/convnextv2-large-22k-384
ConvNeXt V2模型是在FCMAE框架上预训练并在ImageNet-22K数据集上进行了384x384像素的微调。它最初由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-22k-384")
model = ConvNextV2ForImageClassification.from_pretrained("facebook/convnextv2-large-22k-384")
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}
}