Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 11cdd70

Browse files
ppwwyyxxrmlarsen
authored andcommitted
Update non_max_suppression_op.cc (tensorflow#12527)
1 parent f286c78 commit 11cdd70

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tensorflow/core/kernels/non_max_suppression_op.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ void DoNonMaxSuppressionOp(OpKernelContext* context,
122122
for (int i = 0; i < num_boxes; ++i) {
123123
if (selected.size() >= output_size) break;
124124
bool should_select = true;
125-
for (int j = 0; j < num_selected; ++j) {
125+
// Overlapping boxes are likely to have similar scores,
126+
// therefore we iterate through the selected boxes backwards.
127+
for (int j = num_selected - 1; j >= 0; --j) {
126128
if (IOUGreaterThanThreshold(boxes_data, sorted_indices[i],
127129
sorted_indices[selected_indices[j]],
128130
iou_threshold)) {

0 commit comments

Comments
 (0)