模型:
google/efficientnet-b3
EfficientNet模型在ImageNet-1k数据集上进行训练,分辨率为300x300。该模型由Mingxing Tan和Quoc V. Le在论文中提出,并于 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-b3")
model = EfficientNetForImageClassification.from_pretrained("google/efficientnet-b3")
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}
}