victordibia / handtrack.js

A library for prototyping realtime hand detection (bounding box), directly in the browser.
https://victordibia.com/handtrack.js/
MIT License
2.83k stars 250 forks source link

Cannot load model #51

Closed ngochai27595 closed 3 years ago

ngochai27595 commented 3 years ago

Dear author, I have face with this problem when try to do example const video = document.getElementById('largeVideo'); // const canvas = document.getElementById("canvas"); // const context = canvas.getContext("2d");

    // Load the model.
    handTrack.load().then(model => {
        // detect objects in the image.
        console.log("model loaded")
        model.detect(video).then(predictions => {
            console.log('Predictions: ', predictions);
            // model.renderPredictions(predictions, canvas, context, video);
            // requestAnimationFrame(runDetection);
        });
    });

--> "UnhandledError: Request to https://cdn.jsdelivr.net/npm/handtrackjs@latest/models/webmodel/centernet512fpn/base/model.json failed with status code 404. Please verify this URL points to the model JSON of the model to load" Could you help me. Thanks

victordibia commented 3 years ago

Hi,

Thanks for pointing this out. Its a bug with the recent release that has experimental support for centernet models. I have fixed the bug in a new npm minor release but it may take a short amount of time to propagate to the jsdeliver cdn. In the mean time you can specify the ssd320fpnlite model when you load handtrack.js.


const defaultParams = { 
  modelType: "ssd320fpnlite"
};

handTrack.load(defaultParams).then(model => {
        // detect objects in the image.
        console.log("model loaded")
        model.detect(video).then(predictions => {
            console.log('Predictions: ', predictions); 
        });
});
ngochai27595 commented 3 years ago

Thank you. And I have one more question. Can I hand track realtime with an available live video?