Giter Club home page Giter Club logo

Comments (5)

Charrin avatar Charrin commented on May 23, 2024

if you use caffe, replace cube to "caffe:Blob"

from retinaface-cpp.

dwjlw1314 avatar dwjlw1314 commented on May 23, 2024

mxnet 如何替换,有没有提示性质的建议

from retinaface-cpp.

Charrin avatar Charrin commented on May 23, 2024

参考mxnet c++接口的例子

from retinaface-cpp.

dwjlw1314 avatar dwjlw1314 commented on May 23, 2024

int AnchorGenerator::FilterAnchor(mxnet::cpp::NDArray& cls, mxnet::cpp::NDArray& reg, mxnet::cpp::NDArray& pts, std::vector& result)
{
assert(cls.GetShape()[1] == anchor_num2);
assert(reg.GetShape()[1] == anchor_num
4);
int pts_length = 0;

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;

}

from retinaface-cpp.

luan1412167 avatar luan1412167 commented on May 23, 2024

@Charrin @dwjlw1314 @zys1994 What is Cube? is it C++ class?

from retinaface-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.