Hello,
I am following this https://pytorch.org/vision/main/_modules/torchvision/ops/boxes.html#box_iou:~:text=%23%20implementation%20from%20https,inter%2C%20union link to find the intersection bbox between two input box tensors.
def _box_inter_union(boxes1: Tensor, boxes2: Tensor) -> Tuple[Tensor, Tensor]:
area1 = box_area(boxes1)
area2 = box_area(boxes2)
lt = torch.max(boxes1[:, None, :2], boxes2[:, :2]) # [N,M,2]
rb = torch.min(boxes1[:, None, 2:], boxes2[:, 2:]) # [N,M,2]
wh = _upcast(rb - lt).clamp(min=0) # [N,M,2]
inter = wh[:, :, 0] * wh[:, :, 1] # [N,M]
union = area1[:, None] + area2 - inter
return inter, union
But I am stuck in the wh
part. It will be a great help if someone help me to find the intersection/overlap box as output.