Function to compute intersection over union of boxes

Is there code in python available for intersection over union (iou) of bounding boxes?

I have been able to find non maximal suppression function in tensorflow which must be computing iou but I have not found a public function.

It’s not included in the PyTorch tensor library, but I compute iou (jaccard index) of bounding boxes using PyTorch tensors here: https://github.com/amdegroot/ssd.pytorch/blob/master/box_utils.py#L33-L70.

2 Likes

@amdegroot
This link does not open.
Can you please help.
I need to see the function on how to compute iou of bounding boxes

Sorry for just now seeing this, but to update the link: https://github.com/amdegroot/ssd.pytorch/blob/master/layers/box_utils.py#L48.

3 Likes

Torchvision has a function to compute iou of boxes:
https://pytorch.org/vision/main/ops.html#box-operators