Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions tests/test_utils/test_bounding_box_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,15 @@ def test_bbox_nms():
nms_cfg = NMSConfig(min_confidence=0.5, min_iou=0.5, max_bbox=400)

# Batch 1:
# - box 1 is kept with class 0 as it has a higher confidence than box 4 i.e. box 4 is filtered out
# - box 2 is kept with class 1
# - box 3 is rejected by the confidence filter
# - box 1 is kept with classes 0 and 2 as it overlaps with box 4 and has a higher confidence for classes 0 and 2.
# - box 2 is kept with classes 0, 1, 2 as it does not overlap with any other box.
# - box 3 is rejected by the confidence filter.
# - box 4 is kept with class 1 as it overlaps with box 1 and has a higher confidence for class 1.
# Batch 2:
# - box 4 is kept with class 0 as it has a higher confidence than box 1 i.e. box 1 is filtered out
# - box 2 is rejected by the confidence filter
# - box 3 is kept with class 2
# - box 1 is kept with classes 1 and 2 as it overlaps with box 1 and has a higher confidence for classes 1 and 2.
# - box 2 is rejected by the confidence filter.
# - box 3 is kept with classes 0, 1, 2 as it does not overlap with any other box.
# - box 4 is kept with class 0 as it overlaps with box 1 and has a higher confidence for class 0.
expected_output = torch.tensor(
[
[
Expand All @@ -214,7 +216,6 @@ def test_bbox_nms():
)

output = bbox_nms(cls_dist, bbox, nms_cfg)
print(output)
for out, exp in zip(output, expected_output):
assert allclose(out, exp, atol=1e-4), f"Output: {out} Expected: {exp}"

Expand Down
Loading