🚀 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 |