🚀 EfficientNet (b7模型)
EfficientNet是一个在图像分类领域表现出色的模型。它基于ImageNet - 1k数据集,以600x600的分辨率进行训练,能高效准确地对图像进行分类。
🚀 快速开始
EfficientNet模型可用于图像分类任务。你可以在模型中心查找针对你感兴趣任务的微调版本。
以下是使用该模型将COCO 2017数据集中的图像分类为1000个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-b7")
model = EfficientNetForImageClassification.from_pretrained("google/efficientnet-b7")
inputs = preprocessor(image, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label]),
更多代码示例请参考文档。
✨ 主要特性
EfficientNet是一种对移动设备友好的纯卷积模型(ConvNet),它提出了一种新的缩放方法,使用简单而高效的复合系数统一缩放深度、宽度和分辨率的所有维度。

💻 使用示例
基础用法
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-b7")
model = EfficientNetForImageClassification.from_pretrained("google/efficientnet-b7")
inputs = preprocessor(image, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label]),
📚 详细文档
EfficientNet模型由Mingxing Tan和Quoc V. Le在论文EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks中提出,并首次在此仓库发布。
免责声明
发布EfficientNet的团队并未为此模型编写模型卡片,此模型卡片由Hugging Face团队编写。
📄 许可证
本项目采用Apache - 2.0许可证。
BibTeX引用和引用信息
@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}
}
属性 |
详情 |
模型类型 |
图像分类模型 |
训练数据 |
ImageNet - 1k |