justadudewhohacks / face-api.js

JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js
MIT License
16.6k stars 3.69k forks source link

Conflict with Jimp plugin? #558

Open chrizonline opened 4 years ago

chrizonline commented 4 years ago

Hi,

my vuejs project includes face-api.js@0.22.1 and jimp@0.9.3. For some reasons on Safari (works on chrome, firefox and microsoft edge), when I used jimp plugin, I'm getting TypedArray.from requires its this argument subclass a TypedArray constructor when I load the models. If I commented out import Jimp from "jimp";, the error goes away.

Below is my code:

import * as faceapi from "face-api.js";
import Jimp from "jimp";
...
try{
    await faceapi.nets.tinyFaceDetector.loadFromUri("/models");
} catch(err) {
    console.log(err);
}
justadudewhohacks commented 4 years ago

Hmm apparently importing jimp has some side effects then. I am not familar with jimp sorry, so I am not sure what it does and how to avoid it breaking other packages.