Update README.md
Browse files
README.md
CHANGED
|
@@ -5,10 +5,20 @@ library_name: transformers
|
|
| 5 |
|
| 6 |
|
| 7 |
```python
|
| 8 |
-
from transformers import AutoModelForObjectDetection
|
| 9 |
|
| 10 |
|
| 11 |
-
|
| 12 |
"RationAI/LSP-DETR", trust_remote_code=True
|
| 13 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
```
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
```python
|
| 8 |
+
from transformers import AutoModelForObjectDetection, AutoImageProcessor
|
| 9 |
|
| 10 |
|
| 11 |
+
processor = AutoImageProcessor.from_pretrained(
|
| 12 |
"RationAI/LSP-DETR", trust_remote_code=True
|
| 13 |
)
|
| 14 |
+
model = AutoModelForObjectDetection.from_pretrained(
|
| 15 |
+
"RationAI/LSP-DETR", trust_remote_code=True
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
inputs = processor(img, device=device, return_tensors="pt")
|
| 19 |
+
outputs = model(**inputs)
|
| 20 |
+
results = processor.post_process(outputs)
|
| 21 |
+
results = processor.post_process_instance(
|
| 22 |
+
results, height=img.size[1], width=img.size[0]
|
| 23 |
+
)
|
| 24 |
```
|