Commit 14b20fdf authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

Suppress IOU based on box references instead of copying over boxes

This saves us two copies of the entire box class to this call and instead
works on reference of these objects that are created within the loops instead
parent aa3fba66
...@@ -186,7 +186,7 @@ struct nonmaxsuppression ...@@ -186,7 +186,7 @@ struct nonmaxsuppression
return result; return result;
} }
inline bool suppress_by_iou(box b1, box b2, double iou_threshold) const inline bool suppress_by_iou(box& b1, box& b2, double iou_threshold) const
{ {
b1.sort(); b1.sort();
b2.sort(); b2.sort();
...@@ -290,10 +290,10 @@ struct nonmaxsuppression ...@@ -290,10 +290,10 @@ struct nonmaxsuppression
while(not boxes_heap.empty()) while(not boxes_heap.empty())
{ {
auto iou_candidate_box = boxes_heap.top(); auto iou_candidate_box = boxes_heap.top();
if(not this->suppress_by_iou( auto iou_candidate = batch_box(batch_boxes_start, iou_candidate_box.second);
batch_box(batch_boxes_start, iou_candidate_box.second), auto suppress_box =
next_box, this->suppress_by_iou(iou_candidate, next_box, iou_threshold);
iou_threshold)) if(not suppress_box)
{ {
remainder_boxes.push(iou_candidate_box); remainder_boxes.push(iou_candidate_box);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment