Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
-
tags:
|
4 |
datasets:
|
5 |
- imagenet
|
6 |
---
|
@@ -34,18 +33,18 @@ You can use the raw model for image classification. See the [model hub](https://
|
|
34 |
Here is how to use this model in PyTorch:
|
35 |
|
36 |
```python
|
37 |
-
from transformers import
|
38 |
import requests
|
39 |
from PIL import Image
|
40 |
|
41 |
-
|
42 |
model = PerceiverForImageClassificationFourier.from_pretrained("deepmind/vision-perceiver-fourier")
|
43 |
|
44 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
45 |
image = Image.open(requests.get(url, stream=True).raw)
|
46 |
|
47 |
# prepare input
|
48 |
-
inputs =
|
49 |
# forward pass
|
50 |
outputs = model(inputs)
|
51 |
logits = outputs.logits
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
3 |
datasets:
|
4 |
- imagenet
|
5 |
---
|
|
|
33 |
Here is how to use this model in PyTorch:
|
34 |
|
35 |
```python
|
36 |
+
from transformers import PerceiverImageProcessor, PerceiverForImageClassificationFourier
|
37 |
import requests
|
38 |
from PIL import Image
|
39 |
|
40 |
+
processor = PerceiverImageProcessor.from_pretrained("deepmind/vision-perceiver-fourier")
|
41 |
model = PerceiverForImageClassificationFourier.from_pretrained("deepmind/vision-perceiver-fourier")
|
42 |
|
43 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
44 |
image = Image.open(requests.get(url, stream=True).raw)
|
45 |
|
46 |
# prepare input
|
47 |
+
inputs = processor(image, return_tensors="pt").pixel_values
|
48 |
# forward pass
|
49 |
outputs = model(inputs)
|
50 |
logits = outputs.logits
|