Update README.md
Browse filesminor fix so the bounding boxes returned can be drawn on the original image. Similar to the example in this page: https://huggingface.co/docs/transformers/en/model_doc/owlv2
README.md
CHANGED
@@ -64,7 +64,7 @@ def get_preprocessed_image(pixel_values):
|
|
64 |
|
65 |
unnormalized_image = get_preprocessed_image(inputs.pixel_values)
|
66 |
|
67 |
-
target_sizes = torch.Tensor([
|
68 |
# Convert outputs (bounding boxes and class logits) to final bounding boxes and scores
|
69 |
results = processor.post_process_object_detection(
|
70 |
outputs=outputs, threshold=0.2, target_sizes=target_sizes
|
|
|
64 |
|
65 |
unnormalized_image = get_preprocessed_image(inputs.pixel_values)
|
66 |
|
67 |
+
target_sizes = target_sizes = torch.Tensor([image.size[::-1]]) # the bounding boxes can be drawn on the original image
|
68 |
# Convert outputs (bounding boxes and class logits) to final bounding boxes and scores
|
69 |
results = processor.post_process_object_detection(
|
70 |
outputs=outputs, threshold=0.2, target_sizes=target_sizes
|