Downloads · 30 days
17
1% of all-time downloads
snap-research/efficientformer-l7-300
efficientformer-l7-300 is a image classification model from snap-research. Use it when you need a label for an image. It is set up for timm. The card lists the license as apache-2.0.
- EfficientFormer-L7 - Table of Contents - Model Details - How to Get Started with the Model - Uses - Direct Use - Downstream Use - Misuse and Out-of-scope Use
Downloads · 30 days
17
1% of all-time downloads
All-time downloads
2.4K
Public
Repo size
989 MB
Likes
1
Public
Click a slice to open those files.
.bin330 MB · 100%
From the Hugging Face model README
<model_details>
EfficientFormer-L7, developed by Snap Research, is one of three EfficientFormer models. The EfficientFormer models were released as part of an effort to prove that properly designed transformers can reach extremely low latency on mobile devices while maintaining high performance.
This checkpoint of EfficientFormer-L7 was trained for 300 epochs.
</model_details>
<how_to_start>
Use the code below to get started with the model.
import requests
import torch
from PIL import Image
from transformers import EfficientFormerImageProcessor, EfficientFormerForImageClassificationWithTeacher
# Load a COCO image of two cats to test the model
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
# Load preprocessor and pretrained model
model_name = "huggingface/efficientformer-l7-300"
processor = EfficientFormerImageProcessor.from_pretrained(model_name)
model = EfficientFormerForImageClassificationWithTeacher.from_pretrained(model_name)
# Preprocess input image
inputs = processor(images=image, return_tensors="pt")
# Inference
with torch.no_grad():
outputs = model(**inputs)
# Print the top ImageNet1k class prediction
logits = outputs.logits
scores = torch.nn.functional.softmax(logits, dim=1)
top_pred_class = torch.argmax(scores, dim=1)
print(f"Predicted class: {top_pred_class}")
</how_to_start>
<uses>This model can be used for image classification and semantic segmentation. On mobile devices (the model was tested on iPhone 12), the CoreML checkpoints will perform these tasks with low latency.
<Limitations_and_Biases>
Though most designs in EfficientFormer are general-purposed, e.g., dimension- consistent design and 4D block with CONV-BN fusion, the actual speed of EfficientFormer may vary on other platforms. For instance, if GeLU is not well supported while HardSwish is efficiently implemented on specific hardware and compiler, the operator may need to be modified accordingly. The proposed latency-driven slimming is simple and fast. However, better results may be achieved if search cost is not a concern and an enumeration-based brute search is performed.
Since the model was trained on Imagenet-1K, the biases embedded in that dataset will be reflected in the EfficientFormer models.
</Limitations_and_Biases>
<Training>This model was trained on ImageNet-1K.
See the data card for additional information.
Trained on a cluster with NVIDIA A100 and V100 GPUs.
</Training><Eval_Results>
Top-1 Accuracy: 83.3% on ImageNet 10K Latency: 7.0ms
</Eval_Results>
<Cite>@article{li2022efficientformer,
title={EfficientFormer: Vision Transformers at MobileNet Speed},
author={Li, Yanyu and Yuan, Geng and Wen, Yang and Hu, Eric and Evangelidis, Georgios and Tulyakov, Sergey and Wang, Yanzhi and Ren, Jian},
journal={arXiv preprint arXiv:2206.01191},
year={2022}
}
</Cite>