Improve code snippet
Browse files
README.md
CHANGED
@@ -24,6 +24,7 @@ model = DetrForObjectDetection.from_pretrained('TahaDouaji/detr-doc-table-detect
|
|
24 |
inputs = feature_extractor(images=image, return_tensors="pt")
|
25 |
outputs = model(**inputs)
|
26 |
|
27 |
-
|
28 |
-
|
|
|
29 |
```
|
|
|
24 |
inputs = feature_extractor(images=image, return_tensors="pt")
|
25 |
outputs = model(**inputs)
|
26 |
|
27 |
+
# convert outputs (bounding boxes and class logits) to COCO API
|
28 |
+
target_sizes = torch.tensor([image.size[::-1]])
|
29 |
+
results = feature_extractor.post_process(outputs, target_sizes=target_sizes)[0]
|
30 |
```
|