EduardoPacheco
commited on
Commit
•
131c6d7
1
Parent(s):
419cbc4
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -26,11 +26,27 @@ We show that a lot of this bulk is actually _unnecessary_. Instead of manually a
|
|
26 |
|
27 |
## Intended uses & limitations
|
28 |
|
29 |
-
Hiera can be used for image classification, feature extraction or masked image modeling.
|
30 |
|
31 |
### How to use
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
|
36 |
### BibTeX entry and citation info
|
|
|
26 |
|
27 |
## Intended uses & limitations
|
28 |
|
29 |
+
Hiera can be used for image classification, feature extraction or masked image modeling. This checkpoint in specific is intended for **Masked Image Modeling**.
|
30 |
|
31 |
### How to use
|
32 |
|
33 |
+
```python
|
34 |
+
from transformers import AutoImageProcessor, HieraForPreTraining
|
35 |
+
import torch
|
36 |
+
from PIL import Image
|
37 |
+
import requests
|
38 |
+
|
39 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
40 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
41 |
+
|
42 |
+
image_processor = AutoImageProcessor.from_pretrained("facebook/hiera-tiny-224-mae-hf")
|
43 |
+
model = HieraForPreTraining.from_pretrained("facebook/hiera-tiny-224-mae-hf")
|
44 |
+
|
45 |
+
inputs = image_processor(images=image, return_tensors="pt")
|
46 |
+
outputs = model(**inputs)
|
47 |
+
logits = outputs.logits
|
48 |
+
loss = outputs.loss
|
49 |
+
```
|
50 |
|
51 |
|
52 |
### BibTeX entry and citation info
|