Skip to content

Commit ca6c93e

Browse files
committed
prevent issue when 0 or 1 hit left after score thresholding in NMS
1 parent 12db2da commit ca6c93e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

MTM/NMS.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ def NMS(tableHit, scoreThreshold=None, sortAscending=False, N_object=float("inf"
116116
elif sortAscending : # We keep hit below the threshold
117117
threshTable = tableHit[ tableHit['Score']<=scoreThreshold ]
118118

119+
# The score thresholding might return 1 or 0 hit, which would be an issue line 130/131
120+
if len(threshTable.index)<=1: return threshTable
121+
119122
# Sort score to have best predictions first (ie lower score if difference-based, higher score if correlation-based)
120123
# important as we loop testing the best boxes against the other boxes)
121124
threshTable.sort_values("Score", ascending=sortAscending, inplace=True) # Warning here is fine

0 commit comments

Comments
 (0)