diff --git a/CHANGELOG.md b/CHANGELOG.md index 06304ec2..dc121b73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### **HEAD -> main** 2021/10/13 mandic00@live.com +- add optional anti-spoofing module - add node-match advanced example using worker thread pool - package updates - optimize image preprocessing diff --git a/src/hand/handtrack.ts b/src/hand/handtrack.ts index 6c6e0520..76f37ae7 100644 --- a/src/hand/handtrack.ts +++ b/src/hand/handtrack.ts @@ -196,9 +196,11 @@ export async function predict(input: Tensor, config: Config): Promise { - if (config.skipFrame && skipped < 5 * (config.hand.skipFrames || 0) && cache.hands.length > 0) { // we have some cached results but although not sure if its enough we continute anyhow for bit longer + if (config.skipFrame && cache.hands.length === config.hand.maxDetected) { // we have all detected hands cache.hands = await Promise.all(cache.boxes.map((handBox) => detectFingers(input, handBox, config))); - } else { + } else if (config.skipFrame && skipped < 3 * (config.hand.skipFrames || 0) && cache.hands.length > 0) { // we have some cached results but although not sure if its enough we continute anyhow for bit longer + cache.hands = await Promise.all(cache.boxes.map((handBox) => detectFingers(input, handBox, config))); + } else { // finally rerun detector cache.boxes = await detectHands(input, config); cache.hands = await Promise.all(cache.boxes.map((handBox) => detectFingers(input, handBox, config))); skipped = 0; diff --git a/test/test-main.js b/test/test-main.js index 965268d2..51db904f 100644 --- a/test/test-main.js +++ b/test/test-main.js @@ -173,7 +173,7 @@ async function test(Human, inputConfig) { await human.load(); const models = Object.keys(human.models).map((model) => ({ name: model, loaded: (human.models[model] !== null) })); const loaded = models.filter((model) => model.loaded); - if (models.length === 20 && loaded.length === 10) log('state', 'passed: models loaded', models.length, loaded.length, models); + if (models.length === 21 && loaded.length === 10) log('state', 'passed: models loaded', models.length, loaded.length, models); else log('error', 'failed: models loaded', models.length, loaded.length, models); // increase defaults