Open zys1994 opened 5 years ago
if you use caffe, replace cube to "caffe:Blob"
mxnet 如何替换,有没有提示性质的建议
参考mxnet c++接口的例子
int AnchorGenerator::FilterAnchor(mxnet::cpp::NDArray& cls, mxnet::cpp::NDArray& reg, mxnet::cpp::NDArray& pts, std::vector
assert(pts.GetShape()[1] % anchor_num == 0);
pts_length = pts.GetShape()[1]/anchor_num/2;
int w = cls.GetShape()[3];
int h = cls.GetShape()[2];
for (int i = 0; i < h; ++i) {
for (int j = 0; j < w; ++j) {
int id = i * w + j;
for (int a = 0; a < anchor_num; ++a)
{
//std::cout<< j << "--------"<< i << "--------"<< id << "--------"<<cls.channel(anchor_num + a)[id]<<std::endl;
if (cls.GetData()[(anchor_num + a) * h * w + id] >= cls_threshold) {
//printf("cls %f\n", cls.channel(anchor_num + a)[id]);
CRect2f box(j * anchor_stride + preset_anchors[a][0],
i * anchor_stride + preset_anchors[a][1],
j * anchor_stride + preset_anchors[a][2],
i * anchor_stride + preset_anchors[a][3]);
//printf("%f %f %f %f\n", box[0], box[1], box[2], box[3]);
CRect2f delta(reg.GetData()[(a*4+0) * h * w+id],
reg.GetData()[(a*4+1) * h * w+id],
reg.GetData()[(a*4+2) * h * w+id],
reg.GetData()[(a*4+3) * h * w+id]);
Anchor res;
res.anchor = cv::Rect_< float >(box[0], box[1], box[2], box[3]);
bbox_pred(box, delta, res.finalbox);
//printf("bbox pred\n");
res.score = cls.GetData()[(anchor_num + a) * h * w+id];
res.center = cv::Point(j,i);
//printf("center %d %d\n", j, i);
if (1) {
std::vector<cv::Point2f> pts_delta(pts_length);
for (int p = 0; p < pts_length; ++p) {
pts_delta[p].x = pts.GetData()[(a*pts_length*2+p*2) * h * w+id];
pts_delta[p].y = pts.GetData()[(a*pts_length*2+p*2+1) * h * w+id];
}
//printf("ready landmark_pred\n");
landmark_pred(box, pts_delta, res.pts);
//printf("landmark_pred\n");
}
result.push_back(res);
}
}
}
}
return 0;
}
@Charrin @dwjlw1314 @zys1994 What is Cube? is it C++ class?