Ask Your Question

Revision history [back]

how to use yolov3 with opencv.js in browser

I'm new to opencv.js and have a trouble with is as below:

let utils = new Utils('errorMessage');
let cfg = 'yolo_file/test.cfg';
let weights = 'yolo_file/test.weights';
utils.createFileFromUrl('cfg', cfg, () => {
  utils.createFileFromUrl('weights', weights, () => {
    let img=cv.imread('imageSrc');
    let blob = cv.blobFromImage(img, 1/255, new cv.Size(800, 800), new cv.Scalar(0, 0, 0),true,false);
    let net = cv.readNet('cfg','weights');
    net.setInput(blob);
    let prob = net.forward();
    console.log(prob);
    //console.log(blob);
    //net.setInput(blob);
    //outs = net.forward(['yolo_82', 'yolo_94', 'yolo_106']);
  });

This code will get an error on this line let prob = net.forward();. The error detail is "Uncaught 6575912".

Can you suggest me how to resolve it?