Ask Your Question

Revision history [back]

OpenCV + Darknet+YOLOv3 problem

In OpenCV3.4.3 use YOLOv3 model emerging questions : This is my code: String modelConfiguration = "models/digital.cfg"; String modelWeights = "models/digital.weights"; fprintf(fp, "->readNetFromDarknet Start.\n"); Net net = readNetFromDarknet(modelConfiguration, modelWeights); net.setPreferableBackend(DNN_BACKEND_OPENCV); net.setPreferableTarget(DNN_TARGET_CPU);; Mat blob,Input; resize(_srcImg,Input,Size(416, 416)); blobFromImage(Input, blob, 1/255.0, cvSize(416, 416), Scalar(0,0,0), true, false); net.setInput(blob); vector<mat> outs; net.forward(outs, GetOutputsNames(net)); The following errors occur when running to "net.forward(outs, GetOutputsNames(net));": OpenCV(3.4.3) F:\opencv\opencv-3.4.3\opencv\sources\modules\core\src\matrix.cpp:367: error: (-215:Assertion failed) u != 0 in function 'cv::Mat::create';

The path is right. Sometimes it can be identified, sometimes not. Please help me see why. Thank you.

click to hide/show revision 2
None

updated 2018-12-19 01:16:35 -0600

berak gravatar image

OpenCV + Darknet+YOLOv3 problem

In OpenCV3.4.3 use YOLOv3 model emerging questions : This is my code: code:

            String modelConfiguration = "models/digital.cfg";
     String modelWeights = "models/digital.weights";
     fprintf(fp, "->readNetFromDarknet Start.\n");
     Net net = readNetFromDarknet(modelConfiguration, modelWeights);
     net.setPreferableBackend(DNN_BACKEND_OPENCV);
     net.setPreferableTarget(DNN_TARGET_CPU);;
     Mat blob,Input;
     resize(_srcImg,Input,Size(416, 416));
     blobFromImage(Input, blob, 1/255.0, cvSize(416, 416), Scalar(0,0,0), true, false);
     net.setInput(blob);
        vector<mat> vector<Mat> outs;
     net.forward(outs, GetOutputsNames(net));

The following errors occur when running to "net.forward(outs, GetOutputsNames(net));": GetOutputsNames(net));":

 OpenCV(3.4.3) F:\opencv\opencv-3.4.3\opencv\sources\modules\core\src\matrix.cpp:367: error: (-215:Assertion failed) u != 0 in function 'cv::Mat::create';

'cv::Mat::create';

The path is right. Sometimes it can be identified, sometimes not. Please help me see why. Thank you. you.

click to hide/show revision 3
None

updated 2018-12-19 01:16:51 -0600

berak gravatar image

OpenCV + Darknet+YOLOv3 problem

In OpenCV3.4.3 use YOLOv3 model emerging questions : This is my code:

     String modelConfiguration = "models/digital.cfg";
    String modelWeights = "models/digital.weights";
    fprintf(fp, "->readNetFromDarknet Start.\n");
    Net net = readNetFromDarknet(modelConfiguration, modelWeights);
    net.setPreferableBackend(DNN_BACKEND_OPENCV);
    net.setPreferableTarget(DNN_TARGET_CPU);;
    Mat blob,Input;
    resize(_srcImg,Input,Size(416, 416));
    blobFromImage(Input, blob, 1/255.0, cvSize(416, 416), Scalar(0,0,0), true, false);
    net.setInput(blob);
    vector<Mat> outs;
    net.forward(outs, GetOutputsNames(net));

The following errors occur when running to "net.forward(outs, GetOutputsNames(net));":

 OpenCV(3.4.3) F:\opencv\opencv-3.4.3\opencv\sources\modules\core\src\matrix.cpp:367: error: (-215:Assertion failed) u != 0 in function 'cv::Mat::create';

The path is right. Sometimes it can be identified, sometimes not. Please help me see why. Thank you.

click to hide/show revision 4
None

updated 2018-12-19 01:17:40 -0600

berak gravatar image

OpenCV + Darknet+YOLOv3 problem

In OpenCV3.4.3 use YOLOv3 model emerging questions : This is my code:

 String modelConfiguration = "models/digital.cfg";
 String modelWeights = "models/digital.weights";
 fprintf(fp, "->readNetFromDarknet Start.\n");
 Net net = readNetFromDarknet(modelConfiguration, modelWeights);
 net.setPreferableBackend(DNN_BACKEND_OPENCV);
 net.setPreferableTarget(DNN_TARGET_CPU);;
 Mat blob,Input;
 resize(_srcImg,Input,Size(416, 416));
 blobFromImage(Input, blob, 1/255.0, cvSize(416, 416), Scalar(0,0,0), true, false);
 net.setInput(blob);
 vector<Mat> outs;
 net.forward(outs, GetOutputsNames(net));

The following errors occur when running to "net.forward(outs, GetOutputsNames(net));":

 OpenCV(3.4.3) F:\opencv\opencv-3.4.3\opencv\sources\modules\core\src\matrix.cpp:367: error: (-215:Assertion failed) u != 0 in function 'cv::Mat::create';

The path is right. Sometimes it can be identified, sometimes not. Please help me see why. Thank you.