标签:精确 orm template class .cpp ast cas box ons
这个函数完成的功能就是把bounding box regression的结果对输入的prior_bbox(其实就是faster中的输入的region proposal)进行回归获得更精确的框坐标,然后存储在pred_data
template <typename Dtype> void DecodeBBoxesWithPrior(const Dtype* bbox_data, const vector<BBox> prior_bboxes, const int bbox_dim, const Dtype* means, const Dtype* stds, Dtype* pred_data) { const int num = prior_bboxes.size(); const int cls_num = bbox_dim/4; for (int i = 0; i < num; i++) { Dtype pw, ph, cx, cy; pw = prior_bboxes[i].xmax-prior_bboxes[i].xmin+1; ph = prior_bboxes[i].ymax-prior_bboxes[i].ymin+1; cx = 0.5*(prior_bboxes[i].xmax+prior_bboxes[i].xmin); cy = 0.5*(prior_bboxes[i].ymax+prior_bboxes[i].ymin); for (int c = 0; c < cls_num; c++) { Dtype bx, by, bw, bh; // bbox de-normalization bx = bbox_data[i*bbox_dim+4*c]*stds[0]+means[0]; by = bbox_data[i*bbox_dim+4*c+1]*stds[1]+means[1]; bw = bbox_data[i*bbox_dim+4*c+2]*stds[2]+means[2]; bh = bbox_data[i*bbox_dim+4*c+3]*stds[3]+means[3]; Dtype tx, ty, tw, th; tx = bx*pw+cx; ty = by*ph+cy; tw = pw*exp(bw); th = ph*exp(bh); tx -= (tw-1)/2; ty -= (th-1)/2; pred_data[i*bbox_dim+4*c] = tx; pred_data[i*bbox_dim+4*c+1] = ty; pred_data[i*bbox_dim+4*c+2] = tx+tw-1; pred_data[i*bbox_dim+4*c+3] = ty+th-1; } } }
cascade bbox_util.cpp DecodeBBoxesWithPrior
标签:精确 orm template class .cpp ast cas box ons
原文地址:https://www.cnblogs.com/ymjyqsx/p/9253228.html