update hand landmarks model

pull/356/head
Vladimir Mandic 2021-10-31 09:06:33 -04:00
parent 355529b074
commit 0c4978310f
6 changed files with 302 additions and 5 deletions

View File

@ -9,9 +9,15 @@ import Human from "../../dist/human.esm.js";
var config = {
modelBasePath: "../../models",
backend: "humangl",
async: true
async: true,
face: { enabled: true },
body: { enabled: true },
hand: { enabled: true },
object: { enabled: false },
gesture: { enabled: true }
};
var human = new Human(config);
human.env.perfadd = false;
var result;
var dom = {
video: document.getElementById("video"),
@ -80,7 +86,6 @@ async function drawLoop() {
async function main() {
log("human version:", human.version, "tfjs:", human.tf.version_core);
log("platform:", human.env.platform, "agent:", human.env.agent);
human.env.perfadd = true;
status("loading...");
await human.load();
status("initializing...");

View File

@ -7,15 +7,23 @@
* @license MIT
*/
/// <reference path="../../types/src//human.d.ts" />
import Human from '../../dist/human.esm.js'; // equivalent of @vladmandic/human
const config = {
modelBasePath: '../../models',
backend: 'humangl',
async: true,
face: { enabled: true },
body: { enabled: true },
hand: { enabled: true },
object: { enabled: false },
gesture: { enabled: true },
};
const human = new Human(config);
human.env.perfadd = false;
let result;
const dom = {
@ -88,7 +96,6 @@ async function drawLoop() {
async function main() {
log('human version:', human.version, 'tfjs:', human.tf.version_core);
log('platform:', human.env.platform, 'agent:', human.env.agent);
human.env.perfadd = true;
status('loading...');
await human.load();
status('initializing...');

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -348,7 +348,7 @@ const config: Config = {
modelPath: 'handtrack.json',
},
skeleton: {
modelPath: 'handskeleton.json',
modelPath: 'handlandmark-full.json',
},
},
object: {

View File

@ -156,7 +156,7 @@ async function detectFingers(input: Tensor, h: HandDetectResult, config: Config)
t.crop = tf.image.cropAndResize(input, [h.boxCrop], [0], [inputSize[1][0], inputSize[1][1]], 'bilinear');
t.cast = tf.cast(t.crop, 'float32');
t.div = tf.div(t.cast, 255);
[t.score, t.keypoints] = models[1].execute(t.div) as Tensor[];
[t.score, t.keypoints] = models[1].execute(t.div, ['Identity_1', 'Identity']) as Tensor[];
const rawScore = (await t.score.data())[0];
const score = (100 - Math.trunc(100 / (1 + Math.exp(rawScore)))) / 100; // reverse sigmoid value
if (score >= (config.hand.minConfidence || 0)) {