nielsr HF staff commited on
Commit
d60c294
1 Parent(s): a3e4b9a

Improve code snippet

Browse files
Files changed (1) hide show
  1. README.md +3 -2
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
- logits = outputs.logits
28
- bboxes = outputs.pred_boxes
 
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
  ```