Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated boxes during soft_nms #150

Open
0phoff opened this issue Jul 14, 2020 · 1 comment
Open

Duplicated boxes during soft_nms #150

0phoff opened this issue Jul 14, 2020 · 1 comment

Comments

@0phoff
Copy link

0phoff commented Jul 14, 2020

Whilst going through your code in order to try and understand your results, I noticed that in your test code you do not use the resulting keep list from the soft_nms algorithm.

However, if I correctly understand the algorithm, it seems that whenever a box score gets below a certain threshold (0.001 by default), it gets removed from the list by swapping it with the last box from the list and decreasing the number of detections N.
At the end of the algorithm, they return a list with indices of valid detections to keep, but since you do not use it to filter the list, this results in some detections showing double, because the algorithm overwrites low scoring detections with another one.

I quickly tested my hypothesis by modifying this line of code:

# Note that since keep is just a list of increasing numbers [0,1,2,3,...]
# you could probable simplify this code by writing top_bboxes[j+1][:len(keep)]
keep = soft_nms(top_bboxes[j + 1], Nt=nms_threshold, method=nms_algorithm)
top_bboxes[j + 1] = top_bboxes[j+1][np.array(keep, dtype=np.int64)]

I tested this code on a single image and it indeed gives a different result, which makes me believe that there seems to be something weird going on. I don't know whether this change makes the results better or worse, but if my analysis is correct, this seems to be a mistake nonetheless.

@liushuai839
Copy link

Whilst going through your code in order to try and understand your results, I noticed that in your test code you do not use the resulting keep list from the soft_nms algorithm.

However, if I correctly understand the algorithm, it seems that whenever a box score gets below a certain threshold (0.001 by default), it gets removed from the list by swapping it with the last box from the list and decreasing the number of detections N.
At the end of the algorithm, they return a list with indices of valid detections to keep, but since you do not use it to filter the list, this results in some detections showing double, because the algorithm overwrites low scoring detections with another one.

I quickly tested my hypothesis by modifying this line of code:

# Note that since keep is just a list of increasing numbers [0,1,2,3,...]
# you could probable simplify this code by writing top_bboxes[j+1][:len(keep)]
keep = soft_nms(top_bboxes[j + 1], Nt=nms_threshold, method=nms_algorithm)
top_bboxes[j + 1] = top_bboxes[j+1][np.array(keep, dtype=np.int64)]

I tested this code on a single image and it indeed gives a different result, which makes me believe that there seems to be something weird going on. I don't know whether this change makes the results better or worse, but if my analysis is correct, this seems to be a mistake nonetheless.

Hi,guys, I have some questions about the code in your question.and i want to ask you. can you give me your wechat number? Mine is 14704133471.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants