jeeliz / jeelizFaceFilter

Javascript/WebGL lightweight face tracking library designed for augmented reality webcam filters. Features : multiple faces detection, rotation, mouth opening. Various integration examples are provided (Three.js, Babylon.js, FaceSwap, Canvas2D, CSS3D...).
https://jeeliz.com
Apache License 2.0
2.71k stars 535 forks source link

jeelizFaceFilter.js err after camera turns on & model weights load #183

Closed sharonzhou closed 4 years ago

sharonzhou commented 4 years ago
Uncaught SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at jeelizFaceFilter.js:32
    at XMLHttpRequest.e.onreadystatechange (jeelizFaceFilter.js:39)

I'm trying to load the face draw canvas2D demo but getting this error, at a cryptic place in the jeelizFaceFilter.js script. Not sure what function this is pointing to.

What works: the camera turns on (main() runs and according to the network, the weights file is fetched successfully), all css/styles load.

sharonzhou commented 4 years ago

Err on the line with d = JSON.parse(d); (pretty printed the minified script). Is this function for storing a byte (sb)? What's the greater context that it is for?

        function Sb(a) {
            if (I.ma)
                Db("string" === typeof I.ma ? JSON.parse(I.ma) : I.ma, a);
            else {
                var c = I.Ab;
                "JSON" !== c.toUpperCase().split(".").pop() && (c += H.save);
                Eb.get(c, function(d) {
                    d = JSON.parse(d);
                    Db(d, a)
                })
            }
        }
sharonzhou commented 4 years ago

I'm using node.js backend w/ parcel to build, vanilla js / html frontend (copied demo files to see if it could work)

xavierjs commented 4 years ago

The JSON NNC.json model seems to be loaded successfully but in fact it is not (check but I am sure it is not JON) The problem does not come from the lib but from parcel. You see that NNC.json is here in the network tab of the debug tools but in fact it may be an HTML page with a 404 error inside.