"test/vscode:/vscode.git/clone" did not exist on "8ec065fd7b2d86fc2b17de24c5328d8bd5b26bc8"
Commit aa3fba66 authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

Create next_box from next_top_score once during IOU suppression

We're continually creating/destroying batch box in the while() check as we
run through the boxes_heap() by calling batch_box() constantly.

Make this next_box and only calculate it before we pop that box from the boxes_heap.

should get rid of function overhead of constant calls in the case of a large
batch size
parent 7b42f05c
...@@ -279,7 +279,9 @@ struct nonmaxsuppression ...@@ -279,7 +279,9 @@ struct nonmaxsuppression
// select next top scorer box and remove any boxes from boxes_heap that exceeds IOU // select next top scorer box and remove any boxes from boxes_heap that exceeds IOU
// threshold with the selected box // threshold with the selected box
const auto next_top_score = boxes_heap.top(); const auto next_top_score = boxes_heap.top();
auto next_box = batch_box(batch_boxes_start, next_top_score.second);
boxes_heap.pop(); boxes_heap.pop();
selected_boxes_inside_class.push_back(next_top_score); selected_boxes_inside_class.push_back(next_top_score);
selected_indices.push_back(batch_idx); selected_indices.push_back(batch_idx);
selected_indices.push_back(class_idx); selected_indices.push_back(class_idx);
...@@ -290,7 +292,7 @@ struct nonmaxsuppression ...@@ -290,7 +292,7 @@ struct nonmaxsuppression
auto iou_candidate_box = boxes_heap.top(); auto iou_candidate_box = boxes_heap.top();
if(not this->suppress_by_iou( if(not this->suppress_by_iou(
batch_box(batch_boxes_start, iou_candidate_box.second), batch_box(batch_boxes_start, iou_candidate_box.second),
batch_box(batch_boxes_start, next_top_score.second), next_box,
iou_threshold)) iou_threshold))
{ {
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