Skip to content

Batched box scale #4835

@vadimkantorov

Description

@vadimkantorov

🚀 The feature

Frequent utility in postprocessing box detections:

def batched_box_scale(boxes, image_shape, target_image_shape):
  fx = target_image_shape[..., -1] / image_shape[...., -1]
  fy = target_image_shape[..., -2] / image_shape[..., -2]
  return boxes * torch.stack([fx, fy, fx, fy], dim = -1).to(boxes.device)

Motivation, pitch

This is a frequently needed utility to bring back computed detections to a common / original coordinate frame.

cc @vfdev-5 @datumbox

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions