Commit
·
bbd712b
1
Parent(s):
199695c
swtiched to YolosImageProcessor
Browse files
README.md
CHANGED
|
@@ -35,18 +35,18 @@ You can use the raw model for object detection. See the [model hub](https://hugg
|
|
| 35 |
Here is how to use this model:
|
| 36 |
|
| 37 |
```python
|
| 38 |
-
from transformers import
|
| 39 |
from PIL import Image
|
|
|
|
| 40 |
import requests
|
| 41 |
|
| 42 |
-
url =
|
| 43 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 44 |
|
| 45 |
-
feature_extractor = YolosFeatureExtractor.from_pretrained('hustvl/yolos-tiny')
|
| 46 |
model = YolosForObjectDetection.from_pretrained('hustvl/yolos-tiny')
|
| 47 |
-
image_processor =
|
| 48 |
|
| 49 |
-
inputs =
|
| 50 |
outputs = model(**inputs)
|
| 51 |
|
| 52 |
# model predicts bounding boxes and corresponding COCO classes
|
|
|
|
| 35 |
Here is how to use this model:
|
| 36 |
|
| 37 |
```python
|
| 38 |
+
from transformers import YolosImageProcessor, YolosForObjectDetection
|
| 39 |
from PIL import Image
|
| 40 |
+
import torch
|
| 41 |
import requests
|
| 42 |
|
| 43 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 44 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 45 |
|
|
|
|
| 46 |
model = YolosForObjectDetection.from_pretrained('hustvl/yolos-tiny')
|
| 47 |
+
image_processor = YolosImageProcessor.from_pretrained("hustvl/yolos-tiny")
|
| 48 |
|
| 49 |
+
inputs = image_processor(images=image, return_tensors="pt")
|
| 50 |
outputs = model(**inputs)
|
| 51 |
|
| 52 |
# model predicts bounding boxes and corresponding COCO classes
|