模型:
google/efficientnet-b6
EfficientNet模型在ImageNet-1k上以528x528的分辨率进行训练。它在Mingxing Tan和Quoc V. Le的论文 EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks 中提出,并在 this repository 中首次发布。
免责声明:EfficientNet发布团队未为此模型编写模型卡片,因此此模型卡片是由Hugging Face团队编写的。
EfficientNet是一个移动友好的纯卷积模型(ConvNet),提出了一种新的缩放方法,使用简单但非常有效的复合系数,均匀地缩放深度/宽度/分辨率的所有维度。
您可以使用原始模型进行图像分类。请参阅 model hub 以查找您感兴趣的任务上的微调版本。
这是如何使用此模型将COCO 2017数据集中的图像分类为1,000个ImageNet类之一的示例:
import torch
from datasets import load_dataset
from transformers import EfficientNetImageProcessor, EfficientNetForImageClassification
dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]
preprocessor = EfficientNetImageProcessor.from_pretrained("google/efficientnet-b6")
model = EfficientNetForImageClassification.from_pretrained("google/efficientnet-b6")
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{Tan2019EfficientNetRM,
title={EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks},
author={Mingxing Tan and Quoc V. Le},
journal={ArXiv},
year={2019},
volume={abs/1905.11946}
}