chenyujing1234 opened a new issue #13111: The same code in MXNet 1.2.0 and 
MXNet 1.3.0, but the reasoning results are different
URL: https://github.com/apache/incubator-mxnet/issues/13111
 
 
   When using mtcnn model for face detection, it is found that the reasoning 
result of MXNet 1.2.0 is consistent with that of TensorFlow, which is correct, 
but
   The same code in MXNet 1.2.0 and MXNet 1.3.0 inference results are 
different, but the comparison into the inference data is the same.
   Code Description: I use c++ API to recommend the main function 
(c_predict_api.h):
   MXPredCreate > MXPredSetInput > MXPredForward > MXPredGetOutputShape > 
MXPredGetOutput
   ==============================
   Explain:
   1) code address: https://github.com/deepinsight/mxnet-mtcnn/tree/master
   2) this phenomenon appears as probability, testing 50 thousand diagrams, and 
about 10% of the pictures are defective.
   3) the algorithm mtcnn used is different in the P stage.
   For 124.jpg pictures, Pyramid pictures (37, 37) big hours, reasoning results 
are different.
   [http://note.youdao.com/noteshare?id=ed4ec6f5ad2fc7cc164b0c28c86f3b84](url)
   
   4) model:
   Https://github.com/deepinsight/mxnet-mtcnn/tree/master/models/det-0001.params
   Https://github.com/deepinsight/mxnet-mtcnn/tree/master/models/det-symbol.json
   
   `void MxNetMtcnn::RunPNet(const cv::Mat& img, scale_window& win, 
std::vector<face_box>&box_list)
   {
        cv::Mat  resized;
        int scale_h=win.h;
        int scale_w=win.w;
        float scale=win.scale;
   
   
        LoadPNet(scale_h,scale_w);
   
        cv::resize(img, resized, cv::Size(scale_w, scale_h), 0, 0, 
cv::INTER_LINEAR);
   
        std::vector<float> input(3*scale_h*scale_w);
   
        std::vector<cv::Mat> input_channels;
   
        set_input_buffer(input_channels, input.data(), scale_h, scale_w);
   
        cv::split(resized, input_channels);
   
        // 这里对比了输入的数据,都是一样的。
        MXPredSetInput(PNet_,"data",input.data(),input.size());
        MXPredForward(PNet_);
   
        mx_uint *shape = NULL;
        mx_uint shape_len = 0;
   
        MXPredGetOutputShape(PNet_,0,&shape,&shape_len);
   
   
        int reg_size=1;
   
        for(unsigned int i=0;i<shape_len;i++)
                reg_size*=shape[i];
   
        MXPredGetOutputShape(PNet_,1,&shape,&shape_len);
   
        int confidence_size=1;
   
        for(unsigned int i=0;i<shape_len;i++)
                confidence_size*=shape[i];
   
        std::vector<float> reg(reg_size);
        std::vector<float> confidence(confidence_size);
       
        // 下面两步出来的结果是错的。
        MXPredGetOutput(PNet_,0, reg.data(), reg_size);
        MXPredGetOutput(PNet_,1, confidence.data(), confidence_size);
   
   
        std::vector<face_box>  candidate_boxes;
   
        int feature_h=shape[2]; 
        int feature_w=shape[3];
   
        generate_bounding_box(confidence.data(),confidence.size(), reg.data(), 
scale, pnet_threshold_, feature_h, feature_w, candidate_boxes,false);
        nms_boxes(candidate_boxes, 0.5, NMS_UNION,box_list);
   
   }`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to