Instructions to use facebook/deit-tiny-patch16-224 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/deit-tiny-patch16-224 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="facebook/deit-tiny-patch16-224") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("facebook/deit-tiny-patch16-224") model = AutoModelForImageClassification.from_pretrained("facebook/deit-tiny-patch16-224") - Inference
- Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -34,12 +34,15 @@ Since this model is a more efficiently trained ViT model, you can plug it into V
|
|
| 34 |
Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
|
| 35 |
|
| 36 |
```python
|
| 37 |
-
from transformers import
|
| 38 |
from PIL import Image
|
| 39 |
import requests
|
| 40 |
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
|
| 41 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
model = ViTForImageClassification.from_pretrained('facebook/deit-tiny-patch16-224')
|
| 44 |
inputs = feature_extractor(images=image, return_tensors="pt")
|
| 45 |
outputs = model(**inputs)
|
|
|
|
| 34 |
Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
|
| 35 |
|
| 36 |
```python
|
| 37 |
+
from transformers import AutoImageProcessor, ViTForImageClassification
|
| 38 |
from PIL import Image
|
| 39 |
import requests
|
| 40 |
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
|
| 41 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 42 |
+
processor = AutoImageProcessor.from_pretrained("facebook/deit-tiny-patch16-224")
|
| 43 |
+
model = AutoModelForImageClassification.from_pretrained("facebook/deit-tiny-patch16-224")
|
| 44 |
+
|
| 45 |
+
|
| 46 |
model = ViTForImageClassification.from_pretrained('facebook/deit-tiny-patch16-224')
|
| 47 |
inputs = feature_extractor(images=image, return_tensors="pt")
|
| 48 |
outputs = model(**inputs)
|