Skip to content

Vectorize compute_iou_matrix with NumPy #377

@dpascualhe

Description

@dpascualhe

In our detection_metrics module, compute_iou_matrix currently uses a Python double for loop to fill a matrix of IoU values, which is slow for large datasets.

# current (slow)
for i, pb in enumerate(pred_boxes):
    for j, gb in enumerate(gt_boxes):
        iou_matrix[i, j] = compute_iou(pb, gb)

Deliverables: rewrite said function using fully vectorized NumPy broadcasting to compute all pairwise IoUs at once and make sure that the new implementation still yields the exact same results

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