model.forward give an error. opencv.js

asked 2020-09-30 04:05:24 -0600

I am trying to implement opencv.js in ionic. But currently received ERROR Error: Uncaught (in promise): 7298928 - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.

This is my code. The error start in var detections = model.forward();

imageProcess(image){   

let face_detected  = cv.imread (image);

var utils = new Utils('');
var model = undefined;
let proto = 'deploy.prototxt';
let weights = 'weights.caffemodel';

var promise = new Promise( (resolve, reject) => {
  utils.createFileFromUrl(weights, window.location.origin + '/assets/'+ weights, () =>
  {
      utils.createFileFromUrl(proto, window.location.origin + '/assets/'+ proto, () =>
      {
        model = cv.readNetFromCaffe(proto,  weights);
        resolve();
      });
  });
});

promise.then(() => {

  var blob = cv.blobFromImage(face_detected, 1.0,{width: 192, height: 144},[104, 177, 123,0])
  model.setInput(blob)
  var detections = model.forward(); //error start 

});

}
edit retag flag offensive close merge delete