Hello,
I want to calculate the iou of the predicted and ground-truth bounding boxes.
The pred_boxes has shape: torch.Size([9, 4])
The gt_boxes has shape: torch.Size([8, 4])
So I used the box_iou
function from torchvision.ops.boxes
import torchvision.ops.boxes as bops
iou = bops.box_iou(gt_boxes, pred_boxes)
I get the following output:
tensor([[0.0716, 0.8204, 0.0000, 0.0837, 0.3265, 0.2179, 0.0000, 0.0000, 0.0000],
[0.0000, 0.0000, 0.0479, 0.0000, 0.0000, 0.0000, 0.7538, 0.1388, 0.0000],
[0.0000, 0.2521, 0.0000, 0.3208, 0.1010, 0.2012, 0.0000, 0.0000, 0.0000],
[0.0000, 0.0000, 0.0000, 0.0222, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000],
[0.0000, 0.0000, 0.1546, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.2477],
[0.0000, 0.3131, 0.0000, 0.0000, 0.7549, 0.0000, 0.0000, 0.0000, 0.0000],
[0.2785, 0.4618, 0.0000, 0.0000, 0.3540, 0.0000, 0.0000, 0.0000, 0.0000],
[0.0000, 0.0000, 0.0000, 0.3132, 0.0000, 0.0322, 0.0000, 0.0000, 0.0000]])
How do I interpret this tensor?
And how do I find the gt_boxes (yes, ground truth boxes) for which the iou score between gt and pred boxes is more than 0.5?