Ask Your Question

Revision history [back]

model.forward give an error. opencv.js

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 

});

}