Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- vision
|
5 |
+
- image-classification
|
6 |
+
datasets:
|
7 |
+
- imagenet-1k
|
8 |
+
widget:
|
9 |
+
- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg
|
10 |
+
example_title: Tiger
|
11 |
+
- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg
|
12 |
+
example_title: Teapot
|
13 |
+
- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg
|
14 |
+
example_title: Palace
|
15 |
+
---
|
16 |
+
|
17 |
+
# EfficientNet (b2 model)
|
18 |
+
|
19 |
+
EfficientNet model trained on ImageNet-1k at resolution 260x260. It was introduced in the paper [EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks
|
20 |
+
](https://arxiv.org/abs/1905.11946) by Mingxing Tan and Quoc V. Le, and first released in [this repository](https://github.com/keras-team/keras).
|
21 |
+
|
22 |
+
Disclaimer: The team releasing EfficientNet did not write a model card for this model so this model card has been written by the Hugging Face team.
|
23 |
+
|
24 |
+
## Model description
|
25 |
+
|
26 |
+
EfficientNet is a mobile friendly pure convolutional model (ConvNet) that proposes a new scaling method that uniformly scales all dimensions of depth/width/resolution using a simple yet highly effective compound coefficient.
|
27 |
+
|
28 |
+
![model image](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/efficientnet_architecture.png)
|
29 |
+
|
30 |
+
## Intended uses & limitations
|
31 |
+
|
32 |
+
You can use the raw model for image classification. See the [model hub](https://huggingface.co/models?search=efficientnet) to look for
|
33 |
+
fine-tuned versions on a task that interests you.
|
34 |
+
|
35 |
+
### How to use
|
36 |
+
|
37 |
+
Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
|
38 |
+
|
39 |
+
```python
|
40 |
+
import torch
|
41 |
+
from datasets import load_dataset
|
42 |
+
from transformers import EfficientNetImageProcessor, EfficientNetForImageClassification
|
43 |
+
|
44 |
+
dataset = load_dataset("huggingface/cats-image")
|
45 |
+
image = dataset["test"]["image"][0]
|
46 |
+
|
47 |
+
preprocessor = EfficientNetImageProcessor.from_pretrained("google/efficientnet-b2")
|
48 |
+
model = EfficientNetForImageClassification.from_pretrained("google/efficientnet-b2")
|
49 |
+
|
50 |
+
inputs = preprocessor(image, return_tensors="pt")
|
51 |
+
|
52 |
+
with torch.no_grad():
|
53 |
+
logits = model(**inputs).logits
|
54 |
+
|
55 |
+
# model predicts one of the 1000 ImageNet classes
|
56 |
+
predicted_label = logits.argmax(-1).item()
|
57 |
+
print(model.config.id2label[predicted_label]),
|
58 |
+
```
|
59 |
+
|
60 |
+
For more code examples, we refer to the [documentation](https://huggingface.co/docs/transformers/master/en/model_doc/efficientnet).
|
61 |
+
|
62 |
+
### BibTeX entry and citation info
|
63 |
+
|
64 |
+
```bibtex
|
65 |
+
@article{Tan2019EfficientNetRM,
|
66 |
+
title={EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks},
|
67 |
+
author={Mingxing Tan and Quoc V. Le},
|
68 |
+
journal={ArXiv},
|
69 |
+
year={2019},
|
70 |
+
volume={abs/1905.11946}
|
71 |
+
}
|
72 |
+
```
|