Commit 347e79c1 authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

Pass by value to suppress_by_iou()

Make copies here since we're doing this calc in parallel
parent 8cced061
......@@ -187,7 +187,7 @@ struct nonmaxsuppression
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();
b2.sort();
......@@ -302,16 +302,14 @@ struct nonmaxsuppression
std::vector<std::pair<double, int64_t>> remainder_boxes(boxes_heap.size());
auto it =
std::copy_if(std::execution::par,
auto it = std::copy_if(
std::execution::par,
boxes_heap.begin(),
boxes_heap.end(),
remainder_boxes.begin(),
[&](auto iou_candidate_box) {
auto iou_box =
batch_box(batch_boxes_start, iou_candidate_box.second);
return not this->suppress_by_iou(
std::ref(iou_box), std::ref(next_box), iou_threshold);
auto iou_box = batch_box(batch_boxes_start, iou_candidate_box.second);
return not this->suppress_by_iou(iou_box, next_box, iou_threshold);
});
remainder_boxes.resize(it - remainder_boxes.begin());
......
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