mirror of https://github.com/vladmandic/human
update handtrack skip algorithm
parent
9505c8c80e
commit
37a8892cfe
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
### **HEAD -> main** 2021/10/13 mandic00@live.com
|
### **HEAD -> main** 2021/10/13 mandic00@live.com
|
||||||
|
|
||||||
|
- add optional anti-spoofing module
|
||||||
- add node-match advanced example using worker thread pool
|
- add node-match advanced example using worker thread pool
|
||||||
- package updates
|
- package updates
|
||||||
- optimize image preprocessing
|
- optimize image preprocessing
|
||||||
|
|
|
@ -196,9 +196,11 @@ export async function predict(input: Tensor, config: Config): Promise<HandResult
|
||||||
return cache.hands; // return cached results without running anything
|
return cache.hands; // return cached results without running anything
|
||||||
}
|
}
|
||||||
return new Promise(async (resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
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)));
|
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.boxes = await detectHands(input, config);
|
||||||
cache.hands = await Promise.all(cache.boxes.map((handBox) => detectFingers(input, handBox, config)));
|
cache.hands = await Promise.all(cache.boxes.map((handBox) => detectFingers(input, handBox, config)));
|
||||||
skipped = 0;
|
skipped = 0;
|
||||||
|
|
|
@ -173,7 +173,7 @@ async function test(Human, inputConfig) {
|
||||||
await human.load();
|
await human.load();
|
||||||
const models = Object.keys(human.models).map((model) => ({ name: model, loaded: (human.models[model] !== null) }));
|
const models = Object.keys(human.models).map((model) => ({ name: model, loaded: (human.models[model] !== null) }));
|
||||||
const loaded = models.filter((model) => model.loaded);
|
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);
|
else log('error', 'failed: models loaded', models.length, loaded.length, models);
|
||||||
|
|
||||||
// increase defaults
|
// increase defaults
|
||||||
|
|
Loading…
Reference in New Issue