Skip to content

Commit

Permalink
Update format_results to get unnormalized coordinates bbox
Browse files Browse the repository at this point in the history
  • Loading branch information
Idan-BenAmi committed Aug 19, 2024
1 parent 173ed44 commit 382ac7f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def format_results(self, outputs: List, img_ids: List, orig_img_dims: List, outp
detections = []
h_model, w_model = output_resize['shape']
preserve_aspect_ratio = output_resize['aspect_ratio_preservation']
normalized_coords = output_resize.get('normalized_coords', True)

if self.task == 'Detection':
# Process model outputs and convert to detection format
Expand All @@ -149,7 +150,7 @@ def format_results(self, outputs: List, img_ids: List, orig_img_dims: List, outp
output[2].numpy())).squeeze() # Convert COCO 80-class indices to COCO 91-class indices
boxes = output[0].numpy().squeeze() # Extract bounding boxes
boxes = scale_boxes(boxes, orig_img_dims[idx][0], orig_img_dims[idx][1], h_model, w_model,
preserve_aspect_ratio)
preserve_aspect_ratio, normalized_coords)

for score, label, box in zip(scores, labels, boxes):
detection = {
Expand Down

0 comments on commit 382ac7f

Please sign in to comment.