MCPcopy Create free account
hub / github.com/OAID/Tengine / nms_sorted_bboxes

Function nms_sorted_bboxes

executor/operator/ref/kernel/dpp/ref_dpp_kernel.h:80–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80static inline void nms_sorted_bboxes(const struct Dpp_Box* boxes, int boxes_size, int* picked, int* picked_size,
81 float nms_threshold)
82{
83 float areas[boxes_size];
84 int n_picked = 0;
85 for(int i = 0; i < boxes_size; i++)
86 {
87 float width = boxes[i].x1 - boxes[i].x0;
88 float height = boxes[i].y1 - boxes[i].y0;
89
90 areas[i] = width * height;
91 }
92
93 for(int i = 0; i < boxes_size; i++)
94 {
95 int keep = 1;
96 for(int j = 0; j < n_picked; j++)
97 {
98 // intersection over union
99 float inter_area = intersection_area(boxes[i], boxes[picked[j]]);
100 float union_area = areas[i] + areas[picked[j]] - inter_area;
101 // float IoU = inter_area / union_area
102 if(inter_area / union_area > nms_threshold)
103 keep = 0;
104 }
105
106 if(keep)
107 {
108 picked[n_picked] = i;
109 n_picked++;
110 }
111 }
112 *picked_size = n_picked;
113}
114
115void sort_boxes_by_score(struct Dpp_Box* boxes, int size)
116{

Callers 3

ref_dpp_commonFunction · 0.70
RunMethod · 0.50
RunMethod · 0.50

Calls 1

intersection_areaFunction · 0.70

Tested by

no test coverage detected