f-fl0
commited on
[Update] test bbox nms (#115)
Browse files* Update comment about the expected output from bbox_nms
* Remove debug print
tests/test_utils/test_bounding_box_utils.py
CHANGED
@@ -185,13 +185,15 @@ def test_bbox_nms():
|
|
185 |
nms_cfg = NMSConfig(min_confidence=0.5, min_iou=0.5, max_bbox=400)
|
186 |
|
187 |
# Batch 1:
|
188 |
-
# - box 1 is kept with
|
189 |
-
# - box 2 is kept with
|
190 |
-
# - box 3 is rejected by the confidence filter
|
|
|
191 |
# Batch 2:
|
192 |
-
# - box
|
193 |
-
# - box 2 is rejected by the confidence filter
|
194 |
-
# - box 3 is kept with
|
|
|
195 |
expected_output = torch.tensor(
|
196 |
[
|
197 |
[
|
@@ -214,7 +216,6 @@ def test_bbox_nms():
|
|
214 |
)
|
215 |
|
216 |
output = bbox_nms(cls_dist, bbox, nms_cfg)
|
217 |
-
print(output)
|
218 |
for out, exp in zip(output, expected_output):
|
219 |
assert allclose(out, exp, atol=1e-4), f"Output: {out} Expected: {exp}"
|
220 |
|
|
|
185 |
nms_cfg = NMSConfig(min_confidence=0.5, min_iou=0.5, max_bbox=400)
|
186 |
|
187 |
# Batch 1:
|
188 |
+
# - 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.
|
189 |
+
# - box 2 is kept with classes 0, 1, 2 as it does not overlap with any other box.
|
190 |
+
# - box 3 is rejected by the confidence filter.
|
191 |
+
# - box 4 is kept with class 1 as it overlaps with box 1 and has a higher confidence for class 1.
|
192 |
# Batch 2:
|
193 |
+
# - 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.
|
194 |
+
# - box 2 is rejected by the confidence filter.
|
195 |
+
# - box 3 is kept with classes 0, 1, 2 as it does not overlap with any other box.
|
196 |
+
# - box 4 is kept with class 0 as it overlaps with box 1 and has a higher confidence for class 0.
|
197 |
expected_output = torch.tensor(
|
198 |
[
|
199 |
[
|
|
|
216 |
)
|
217 |
|
218 |
output = bbox_nms(cls_dist, bbox, nms_cfg)
|
|
|
219 |
for out, exp in zip(output, expected_output):
|
220 |
assert allclose(out, exp, atol=1e-4), f"Output: {out} Expected: {exp}"
|
221 |
|