add model card
Browse files
README.md
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
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 |
+
# MobileNet V1
|
18 |
+
|
19 |
+
MobileNet V1 model pre-trained on ImageNet-1k at resolution 192x192. It was introduced in [MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications](https://arxiv.org/abs/1704.04861) by Howard et al, and first released in [this repository](https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet_v1.md).
|
20 |
+
|
21 |
+
Disclaimer: The team releasing MobileNet V1 did not write a model card for this model so this model card has been written by the Hugging Face team.
|
22 |
+
|
23 |
+
## Model description
|
24 |
+
|
25 |
+
From the [original README](https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet_v1.md):
|
26 |
+
|
27 |
+
> MobileNets are small, low-latency, low-power models parameterized to meet the resource constraints of a variety of use cases. They can be built upon for classification, detection, embeddings and segmentation similar to how other popular large scale models, such as Inception, are used. MobileNets can be run efficiently on mobile devices [...] MobileNets trade off between latency, size and accuracy while comparing favorably with popular models from the literature.
|
28 |
+
|
29 |
+
## Intended uses & limitations
|
30 |
+
|
31 |
+
You can use the raw model for image classification. See the [model hub](https://huggingface.co/models?search=mobilenet_v1) to look for fine-tuned versions on a task that interests you.
|
32 |
+
|
33 |
+
### How to use
|
34 |
+
|
35 |
+
Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
|
36 |
+
|
37 |
+
```python
|
38 |
+
from transformers import MobileNetV1FeatureExtractor, MobileNetV1ForImageClassification
|
39 |
+
from PIL import Image
|
40 |
+
import requests
|
41 |
+
|
42 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
43 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
44 |
+
|
45 |
+
feature_extractor = MobileNetV1FeatureExtractor.from_pretrained("Matthijs/mobilenet_v1_1.0_224")
|
46 |
+
model = MobileNetV1ForImageClassification.from_pretrained("Matthijs/mobilenet_v1_1.0_224")
|
47 |
+
|
48 |
+
inputs = feature_extractor(images=image, return_tensors="pt")
|
49 |
+
|
50 |
+
outputs = model(**inputs)
|
51 |
+
logits = outputs.logits
|
52 |
+
|
53 |
+
# model predicts one of the 1000 ImageNet classes
|
54 |
+
predicted_class_idx = logits.argmax(-1).item()
|
55 |
+
print("Predicted class:", model.config.id2label[predicted_class_idx])
|
56 |
+
```
|
57 |
+
|
58 |
+
Note: This model actually predicts 1001 classes, the 1000 classes from ImageNet plus an extra “background” class (index 0).
|
59 |
+
|
60 |
+
Currently, both the feature extractor and model support PyTorch.
|