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

Function decode_single_box

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

Source from the content-addressed store, hash-verified

141}
142
143static inline int decode_single_box(struct Dpp_Box* box, const float* box_ptr, const float* anchor_ptr,
144 const float* scales)
145{
146 int i = box->box_idx;
147
148 const float* box_coord = box_ptr + i * 4;
149 const float* anchor = anchor_ptr + i * 4;
150
151 // [0]: y [1]: x [2]: h [3]: w
152 float ycenter = box_coord[0] / scales[0] * anchor[2] + anchor[0];
153 float xcenter = box_coord[1] / scales[1] * anchor[3] + anchor[1];
154 float half_h = 0.5f * (exp(box_coord[2] / scales[2])) * anchor[2];
155 float half_w = 0.5f * (exp(box_coord[3] / scales[3])) * anchor[3];
156
157 box->y0 = ycenter - half_h;
158 box->x0 = xcenter - half_w;
159 box->y1 = ycenter + half_h;
160 box->x1 = xcenter + half_w;
161 if(box->y0 < 0 || box->x0 < 0)
162 return -1;
163 return 0;
164}
165
166void get_all_boxes_rect(struct Dpp_Box* all_class_bbox_rects, const float* box, const float* scores,
167 const float* anchor, int num_boxes, int num_classes, float* scales)

Callers 2

get_all_boxes_rectFunction · 0.85
get_all_boxes_rectMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected