enumerate additional models

pull/293/head
Vladimir Mandic 2022-08-12 09:13:48 -04:00
parent 9a80bbc39d
commit 8ec586e2b8
15 changed files with 295 additions and 2390 deletions

View File

@ -9,12 +9,13 @@
## Changelog ## Changelog
### **HEAD -> main** 2022/08/10 mandic00@live.com
### **2.9.3** 2022/08/10 mandic00@live.com ### **2.9.3** 2022/08/10 mandic00@live.com
- rehault testing framework - rehault testing framework
- release refresh
### **origin/main** 2022/08/08 mandic00@live.com
- add insightface - add insightface
### **2.9.2** 2022/08/08 mandic00@live.com ### **2.9.2** 2022/08/08 mandic00@live.com

View File

@ -1,12 +1,22 @@
const fs = require('fs'); const fs = require('fs');
const path = require('path');
const log = require('@vladmandic/pilogger'); const log = require('@vladmandic/pilogger');
const Build = require('@vladmandic/build').Build; const Build = require('@vladmandic/build').Build;
const APIExtractor = require('@microsoft/api-extractor'); const APIExtractor = require('@microsoft/api-extractor');
const tf = require('@tensorflow/tfjs-node'); const tf = require('@tensorflow/tfjs-node');
const package = require('./package.json'); const package = require('./package.json');
const modelsDir = '../human-models/models';
const modelsOut = 'models/models.json'; const modelsOut = 'models/models.json';
const modelsFolders = [
'./models',
'../human-models/models',
'../blazepose/model/',
'../anti-spoofing/model',
'../efficientpose/models',
'../insightface/models',
'../movenet/models',
'../nanodet/models',
];
const apiExtractorIgnoreList = [ // eslint-disable-line @typescript-eslint/no-unused-vars const apiExtractorIgnoreList = [ // eslint-disable-line @typescript-eslint/no-unused-vars
'ae-missing-release-tag', 'ae-missing-release-tag',
@ -27,29 +37,33 @@ function copy(src, dst) {
} }
async function analyzeModels() { async function analyzeModels() {
log.info('Analyze:', { modelsDir, modelsOut }); log.info('Analyze models:', { folders: modelsFolders.length, result: modelsOut });
let totalSize = 0; let totalSize = 0;
const models = {}; const models = {};
let dir; const allModels = [];
try { for (const folder of modelsFolders) {
dir = fs.readdirSync(modelsDir); try {
} catch { if (!fs.existsSync(folder)) continue;
log.warn('Cannot enumerate:', modelsDir); const stat = fs.statSync(folder);
if (!stat.isDirectory) continue;
const dir = fs.readdirSync(folder);
const found = dir.map((f) => `file://${folder}/${f}`).filter((f) => f.endsWith('json'));
log.state('Models', { folder, models: found.length });
allModels.push(...found);
} catch {
// log.warn('Cannot enumerate:', modelFolder);
}
} }
if (!dir || dir.length === 0) { for (const url of allModels) {
log.warn('No models found:', modelsDir); // if (!f.endsWith('.json')) continue;
return; // const url = `file://${modelsDir}/${f}`;
}
for (const f of dir) {
if (!f.endsWith('.json')) continue;
const url = `file://${modelsDir}/${f}`;
const model = new tf.GraphModel(url); // create model prototype and decide if load from cache or from original modelurl const model = new tf.GraphModel(url); // create model prototype and decide if load from cache or from original modelurl
model.findIOHandler(); model.findIOHandler();
const artifacts = await model.handler.load(); const artifacts = await model.handler.load();
const size = artifacts?.weightData?.byteLength || 0; const size = artifacts?.weightData?.byteLength || 0;
totalSize += size; totalSize += size;
const name = f.replace('.json', ''); const name = path.basename(url).replace('.json', '');
models[name] = size; if (!models[name]) models[name] = size;
} }
const json = JSON.stringify(models, null, 2); const json = JSON.stringify(models, null, 2);
fs.writeFileSync(modelsOut, json); fs.writeFileSync(modelsOut, json);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

159
dist/human.esm.js vendored
View File

@ -73524,10 +73524,12 @@ var env2 = new Env();
var models_exports = {}; var models_exports = {};
__export(models_exports, { __export(models_exports, {
age: () => age, age: () => age,
"anti-spoofing": () => anti_spoofing,
antispoof: () => antispoof, antispoof: () => antispoof,
blazeface: () => blazeface, blazeface: () => blazeface,
"blazeface-back": () => blazeface_back, "blazeface-back": () => blazeface_back,
"blazeface-front": () => blazeface_front, "blazeface-front": () => blazeface_front,
"blazepose-detect": () => blazepose_detect,
"blazepose-detector2d": () => blazepose_detector2d, "blazepose-detector2d": () => blazepose_detector2d,
"blazepose-detector3d": () => blazepose_detector3d, "blazepose-detector3d": () => blazepose_detector3d,
"blazepose-full": () => blazepose_full, "blazepose-full": () => blazepose_full,
@ -73535,6 +73537,9 @@ __export(models_exports, {
"blazepose-lite": () => blazepose_lite, "blazepose-lite": () => blazepose_lite,
default: () => models_default, default: () => models_default,
efficientpose: () => efficientpose, efficientpose: () => efficientpose,
"efficientpose-i-lite": () => efficientpose_i_lite,
"efficientpose-ii-lite": () => efficientpose_ii_lite,
"efficientpose-iv": () => efficientpose_iv,
emotion: () => emotion, emotion: () => emotion,
faceboxes: () => faceboxes, faceboxes: () => faceboxes,
facemesh: () => facemesh, facemesh: () => facemesh,
@ -73554,104 +73559,144 @@ __export(models_exports, {
"handlandmark-sparse": () => handlandmark_sparse, "handlandmark-sparse": () => handlandmark_sparse,
handskeleton: () => handskeleton, handskeleton: () => handskeleton,
handtrack: () => handtrack, handtrack: () => handtrack,
"insightface-efficientnet-b0": () => insightface_efficientnet_b0,
"insightface-ghostnet-strides1": () => insightface_ghostnet_strides1,
"insightface-ghostnet-strides2": () => insightface_ghostnet_strides2,
"insightface-mobilenet-emore": () => insightface_mobilenet_emore,
"insightface-mobilenet-swish": () => insightface_mobilenet_swish,
iris: () => iris, iris: () => iris,
liveness: () => liveness, liveness: () => liveness,
"mb3-centernet": () => mb3_centernet, "mb3-centernet": () => mb3_centernet,
meet: () => meet, meet: () => meet,
mobileface: () => mobileface, mobileface: () => mobileface,
mobilefacenet: () => mobilefacenet, mobilefacenet: () => mobilefacenet,
models: () => models,
"movenet-lightning": () => movenet_lightning, "movenet-lightning": () => movenet_lightning,
"movenet-multipose": () => movenet_multipose, "movenet-multipose": () => movenet_multipose,
"movenet-thunder": () => movenet_thunder, "movenet-thunder": () => movenet_thunder,
nanodet: () => nanodet, nanodet: () => nanodet,
"nanodet-e": () => nanodet_e,
"nanodet-g": () => nanodet_g,
"nanodet-m": () => nanodet_m,
"nanodet-t": () => nanodet_t,
posenet: () => posenet, posenet: () => posenet,
selfie: () => selfie selfie: () => selfie
}); });
var age = 161240;
var antispoof = 853098; var antispoof = 853098;
var blazeface = 538928;
var emotion = 820516;
var facemesh = 1477958;
var faceres = 6978814;
var handlandmark_full = 5431368;
var handtrack = 2964837;
var iris = 2599092;
var liveness = 592976;
var mb3_centernet = 4030290;
var models = 0;
var movenet_lightning = 4650216;
var selfie = 212886;
var age = 161240;
var blazeface_back = 538928; var blazeface_back = 538928;
var blazeface_front = 402048; var blazeface_front = 402048;
var blazeface = 538928;
var blazepose_detector2d = 7499400; var blazepose_detector2d = 7499400;
var blazepose_detector3d = 5928856; var blazepose_detector3d = 5928856;
var blazepose_full = 6338290; var blazepose_full = 6338290;
var blazepose_heavy = 27501554; var blazepose_heavy = 27501554;
var blazepose_lite = 2725490; var blazepose_lite = 2725490;
var efficientpose = 5651240; var efficientpose = 5651240;
var emotion = 820516;
var faceboxes = 2013002; var faceboxes = 2013002;
var facemesh_attention_alt = 2387598; var facemesh_attention_alt = 2387598;
var facemesh_attention = 2382414; var facemesh_attention = 2382414;
var facemesh_detection_full = 1026192; var facemesh_detection_full = 1026192;
var facemesh_detection_short = 201268; var facemesh_detection_short = 201268;
var facemesh_orig = 2955780; var facemesh_orig = 2955780;
var facemesh = 1477958;
var faceres_deep = 13957620; var faceres_deep = 13957620;
var faceres = 6978814;
var gear = 1498916; var gear = 1498916;
var gender_ssrnet_imdb = 161236; var gender_ssrnet_imdb = 161236;
var gender = 201808; var gender = 201808;
var handdetect = 3515612; var handdetect = 3515612;
var handlandmark_full = 5431368;
var handlandmark_lite = 2023432; var handlandmark_lite = 2023432;
var handlandmark_sparse = 5286322; var handlandmark_sparse = 5286322;
var handskeleton = 5502280; var handskeleton = 5502280;
var handtrack = 2964837;
var iris = 2599092;
var liveness = 592976;
var mb3_centernet = 4030290;
var meet = 372228; var meet = 372228;
var mobileface = 2183192; var mobileface = 2183192;
var mobilefacenet = 5171976; var mobilefacenet = 5171976;
var movenet_lightning = 4650216;
var movenet_multipose = 9448838; var movenet_multipose = 9448838;
var movenet_thunder = 12477112; var movenet_thunder = 12477112;
var nanodet = 7574558; var nanodet = 7574558;
var posenet = 5032780; var posenet = 5032780;
var selfie = 212886; var blazepose_detect = 5928804;
var anti_spoofing = 853098;
var efficientpose_i_lite = 2269064;
var efficientpose_ii_lite = 5651240;
var efficientpose_iv = 25643252;
var insightface_efficientnet_b0 = 13013224;
var insightface_ghostnet_strides1 = 8093408;
var insightface_ghostnet_strides2 = 8049584;
var insightface_mobilenet_emore = 6938536;
var insightface_mobilenet_swish = 12168584;
var nanodet_e = 12319156;
var nanodet_g = 7574558;
var nanodet_m = 1887474;
var nanodet_t = 5294216;
var models_default = { var models_default = {
age,
antispoof, antispoof,
blazeface,
emotion,
facemesh,
faceres,
"handlandmark-full": handlandmark_full,
handtrack,
iris,
liveness,
"mb3-centernet": mb3_centernet,
models,
"movenet-lightning": movenet_lightning,
selfie,
age,
"blazeface-back": blazeface_back, "blazeface-back": blazeface_back,
"blazeface-front": blazeface_front, "blazeface-front": blazeface_front,
blazeface,
"blazepose-detector2d": blazepose_detector2d, "blazepose-detector2d": blazepose_detector2d,
"blazepose-detector3d": blazepose_detector3d, "blazepose-detector3d": blazepose_detector3d,
"blazepose-full": blazepose_full, "blazepose-full": blazepose_full,
"blazepose-heavy": blazepose_heavy, "blazepose-heavy": blazepose_heavy,
"blazepose-lite": blazepose_lite, "blazepose-lite": blazepose_lite,
efficientpose, efficientpose,
emotion,
faceboxes, faceboxes,
"facemesh-attention-alt": facemesh_attention_alt, "facemesh-attention-alt": facemesh_attention_alt,
"facemesh-attention": facemesh_attention, "facemesh-attention": facemesh_attention,
"facemesh-detection-full": facemesh_detection_full, "facemesh-detection-full": facemesh_detection_full,
"facemesh-detection-short": facemesh_detection_short, "facemesh-detection-short": facemesh_detection_short,
"facemesh-orig": facemesh_orig, "facemesh-orig": facemesh_orig,
facemesh,
"faceres-deep": faceres_deep, "faceres-deep": faceres_deep,
faceres,
gear, gear,
"gender-ssrnet-imdb": gender_ssrnet_imdb, "gender-ssrnet-imdb": gender_ssrnet_imdb,
gender, gender,
handdetect, handdetect,
"handlandmark-full": handlandmark_full,
"handlandmark-lite": handlandmark_lite, "handlandmark-lite": handlandmark_lite,
"handlandmark-sparse": handlandmark_sparse, "handlandmark-sparse": handlandmark_sparse,
handskeleton, handskeleton,
handtrack,
iris,
liveness,
"mb3-centernet": mb3_centernet,
meet, meet,
mobileface, mobileface,
mobilefacenet, mobilefacenet,
"movenet-lightning": movenet_lightning,
"movenet-multipose": movenet_multipose, "movenet-multipose": movenet_multipose,
"movenet-thunder": movenet_thunder, "movenet-thunder": movenet_thunder,
nanodet, nanodet,
posenet, posenet,
selfie "blazepose-detect": blazepose_detect,
"anti-spoofing": anti_spoofing,
"efficientpose-i-lite": efficientpose_i_lite,
"efficientpose-ii-lite": efficientpose_ii_lite,
"efficientpose-iv": efficientpose_iv,
"insightface-efficientnet-b0": insightface_efficientnet_b0,
"insightface-ghostnet-strides1": insightface_ghostnet_strides1,
"insightface-ghostnet-strides2": insightface_ghostnet_strides2,
"insightface-mobilenet-emore": insightface_mobilenet_emore,
"insightface-mobilenet-swish": insightface_mobilenet_swish,
"nanodet-e": nanodet_e,
"nanodet-g": nanodet_g,
"nanodet-m": nanodet_m,
"nanodet-t": nanodet_t
}; };
// src/models.ts // src/models.ts
@ -77669,7 +77714,7 @@ function scale2(box, scaleFact) {
// src/body/blazepose.ts // src/body/blazepose.ts
var env3 = { initial: true }; var env3 = { initial: true };
var models = { detector: null, landmarks: null }; var models2 = { detector: null, landmarks: null };
var inputSize3 = { detector: [224, 224], landmarks: [256, 256] }; var inputSize3 = { detector: [224, 224], landmarks: [256, 256] };
var skipped5 = Number.MAX_SAFE_INTEGER; var skipped5 = Number.MAX_SAFE_INTEGER;
var outputNodes = { var outputNodes = {
@ -77683,28 +77728,28 @@ var lastTime5 = 0;
var sigmoid6 = (x) => 1 - 1 / (1 + Math.exp(x)); var sigmoid6 = (x) => 1 - 1 / (1 + Math.exp(x));
async function loadDetect(config3) { async function loadDetect(config3) {
if (env3.initial) if (env3.initial)
models.detector = null; models2.detector = null;
if (!models.detector && config3.body["detector"] && config3.body["detector"]["modelPath"] || "") { if (!models2.detector && config3.body["detector"] && config3.body["detector"]["modelPath"] || "") {
models.detector = await loadModel(config3.body["detector"]["modelPath"]); models2.detector = await loadModel(config3.body["detector"]["modelPath"]);
const inputs = Object.values(models.detector.modelSignature["inputs"]); const inputs = Object.values(models2.detector.modelSignature["inputs"]);
inputSize3.detector[0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0; inputSize3.detector[0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
inputSize3.detector[1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0; inputSize3.detector[1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
} else if (config3.debug && models.detector) } else if (config3.debug && models2.detector)
log("cached model:", models.detector["modelUrl"]); log("cached model:", models2.detector["modelUrl"]);
await createAnchors(); await createAnchors();
return models.detector; return models2.detector;
} }
async function loadPose(config3) { async function loadPose(config3) {
if (env3.initial) if (env3.initial)
models.landmarks = null; models2.landmarks = null;
if (!models.landmarks) { if (!models2.landmarks) {
models.landmarks = await loadModel(config3.body.modelPath); models2.landmarks = await loadModel(config3.body.modelPath);
const inputs = Object.values(models.landmarks.modelSignature["inputs"]); const inputs = Object.values(models2.landmarks.modelSignature["inputs"]);
inputSize3.landmarks[0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0; inputSize3.landmarks[0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
inputSize3.landmarks[1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0; inputSize3.landmarks[1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
} else if (config3.debug) } else if (config3.debug)
log("cached model:", models.landmarks["modelUrl"]); log("cached model:", models2.landmarks["modelUrl"]);
return models.landmarks; return models2.landmarks;
} }
async function prepareImage(input2, size2) { async function prepareImage(input2, size2) {
const t2 = {}; const t2 = {};
@ -77779,7 +77824,7 @@ async function fixKeypoints(keypoints) {
async function detectLandmarks(input2, config3, outputSize2) { async function detectLandmarks(input2, config3, outputSize2) {
var _a; var _a;
const t2 = {}; const t2 = {};
[t2.ld, t2.segmentation, t2.heatmap, t2.world, t2.poseflag] = (_a = models.landmarks) == null ? void 0 : _a.execute(input2, outputNodes.landmarks); [t2.ld, t2.segmentation, t2.heatmap, t2.world, t2.poseflag] = (_a = models2.landmarks) == null ? void 0 : _a.execute(input2, outputNodes.landmarks);
const poseScore = (await t2.poseflag.data())[0]; const poseScore = (await t2.poseflag.data())[0];
const points = await t2.ld.data(); const points = await t2.ld.data();
const distances = await t2.world.data(); const distances = await t2.world.data();
@ -83002,7 +83047,7 @@ function fakeOps(kernelNames, config3) {
} }
// src/hand/handtrack.ts // src/hand/handtrack.ts
var models2 = [null, null]; var models3 = [null, null];
var modelOutputNodes = ["StatefulPartitionedCall/Postprocessor/Slice", "StatefulPartitionedCall/Postprocessor/ExpandDims_1"]; var modelOutputNodes = ["StatefulPartitionedCall/Postprocessor/Slice", "StatefulPartitionedCall/Postprocessor/ExpandDims_1"];
var inputSize7 = [[0, 0], [0, 0]]; var inputSize7 = [[0, 0], [0, 0]];
var classes = ["hand", "fist", "pinch", "point", "face", "tip", "pinchtip"]; var classes = ["hand", "fist", "pinch", "point", "face", "tip", "pinchtip"];
@ -83029,33 +83074,33 @@ var fingerMap = {
async function loadDetect2(config3) { async function loadDetect2(config3) {
var _a; var _a;
if (env2.initial) if (env2.initial)
models2[0] = null; models3[0] = null;
if (!models2[0]) { if (!models3[0]) {
fakeOps(["tensorlistreserve", "enter", "tensorlistfromtensor", "merge", "loopcond", "switch", "exit", "tensorliststack", "nextiteration", "tensorlistsetitem", "tensorlistgetitem", "reciprocal", "shape", "split", "where"], config3); fakeOps(["tensorlistreserve", "enter", "tensorlistfromtensor", "merge", "loopcond", "switch", "exit", "tensorliststack", "nextiteration", "tensorlistsetitem", "tensorlistgetitem", "reciprocal", "shape", "split", "where"], config3);
models2[0] = await loadModel((_a = config3.hand.detector) == null ? void 0 : _a.modelPath); models3[0] = await loadModel((_a = config3.hand.detector) == null ? void 0 : _a.modelPath);
const inputs = Object.values(models2[0].modelSignature["inputs"]); const inputs = Object.values(models3[0].modelSignature["inputs"]);
inputSize7[0][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0; inputSize7[0][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
inputSize7[0][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0; inputSize7[0][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
} else if (config3.debug) } else if (config3.debug)
log("cached model:", models2[0]["modelUrl"]); log("cached model:", models3[0]["modelUrl"]);
return models2[0]; return models3[0];
} }
async function loadSkeleton(config3) { async function loadSkeleton(config3) {
var _a; var _a;
if (env2.initial) if (env2.initial)
models2[1] = null; models3[1] = null;
if (!models2[1]) { if (!models3[1]) {
models2[1] = await loadModel((_a = config3.hand.skeleton) == null ? void 0 : _a.modelPath); models3[1] = await loadModel((_a = config3.hand.skeleton) == null ? void 0 : _a.modelPath);
const inputs = Object.values(models2[1].modelSignature["inputs"]); const inputs = Object.values(models3[1].modelSignature["inputs"]);
inputSize7[1][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0; inputSize7[1][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
inputSize7[1][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0; inputSize7[1][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
} else if (config3.debug) } else if (config3.debug)
log("cached model:", models2[1]["modelUrl"]); log("cached model:", models3[1]["modelUrl"]);
return models2[1]; return models3[1];
} }
async function detectHands(input2, config3) { async function detectHands(input2, config3) {
const hands = []; const hands = [];
if (!input2 || !models2[0]) if (!input2 || !models3[0])
return hands; return hands;
const t2 = {}; const t2 = {};
const ratio = (input2.shape[2] || 1) / (input2.shape[1] || 1); const ratio = (input2.shape[2] || 1) / (input2.shape[1] || 1);
@ -83063,7 +83108,7 @@ async function detectHands(input2, config3) {
const width = Math.round(height * ratio / 8) * 8; const width = Math.round(height * ratio / 8) * 8;
t2.resize = image.resizeBilinear(input2, [height, width]); t2.resize = image.resizeBilinear(input2, [height, width]);
t2.cast = cast(t2.resize, "int32"); t2.cast = cast(t2.resize, "int32");
[t2.rawScores, t2.rawBoxes] = await models2[0].executeAsync(t2.cast, modelOutputNodes); [t2.rawScores, t2.rawBoxes] = await models3[0].executeAsync(t2.cast, modelOutputNodes);
t2.boxes = squeeze(t2.rawBoxes, [0, 2]); t2.boxes = squeeze(t2.rawBoxes, [0, 2]);
t2.scores = squeeze(t2.rawScores, [0]); t2.scores = squeeze(t2.rawScores, [0]);
const classScores = unstack(t2.scores, 1); const classScores = unstack(t2.scores, 1);
@ -83109,12 +83154,12 @@ async function detectFingers(input2, h, config3) {
landmarks: {}, landmarks: {},
annotations: {} annotations: {}
}; };
if (input2 && models2[1] && config3.hand.landmarks && h.score > (config3.hand.minConfidence || 0)) { if (input2 && models3[1] && config3.hand.landmarks && h.score > (config3.hand.minConfidence || 0)) {
const t2 = {}; const t2 = {};
const boxCrop = [h.boxRaw[1], h.boxRaw[0], h.boxRaw[3] + h.boxRaw[1], h.boxRaw[2] + h.boxRaw[0]]; const boxCrop = [h.boxRaw[1], h.boxRaw[0], h.boxRaw[3] + h.boxRaw[1], h.boxRaw[2] + h.boxRaw[0]];
t2.crop = image.cropAndResize(input2, [boxCrop], [0], [inputSize7[1][0], inputSize7[1][1]], "bilinear"); t2.crop = image.cropAndResize(input2, [boxCrop], [0], [inputSize7[1][0], inputSize7[1][1]], "bilinear");
t2.div = div(t2.crop, constants.tf255); t2.div = div(t2.crop, constants.tf255);
[t2.score, t2.keypoints] = models2[1].execute(t2.div, ["Identity_1", "Identity"]); [t2.score, t2.keypoints] = models3[1].execute(t2.div, ["Identity_1", "Identity"]);
const rawScore = (await t2.score.data())[0]; const rawScore = (await t2.score.data())[0];
const score = (100 - Math.trunc(100 / (1 + Math.exp(rawScore)))) / 100; const score = (100 - Math.trunc(100 / (1 + Math.exp(rawScore)))) / 100;
if (score >= (config3.hand.minConfidence || 0)) { if (score >= (config3.hand.minConfidence || 0)) {
@ -83135,7 +83180,7 @@ async function detectFingers(input2, h, config3) {
} }
async function predict14(input2, config3) { async function predict14(input2, config3) {
var _a, _b; var _a, _b;
if (!models2[0] || !models2[1] || !((_a = models2[0]) == null ? void 0 : _a.inputs[0].shape) || !((_b = models2[1]) == null ? void 0 : _b.inputs[0].shape)) if (!models3[0] || !models3[1] || !((_a = models3[0]) == null ? void 0 : _a.inputs[0].shape) || !((_b = models3[1]) == null ? void 0 : _b.inputs[0].shape))
return []; return [];
outputSize = [input2.shape[2] || 0, input2.shape[1] || 0]; outputSize = [input2.shape[2] || 0, input2.shape[1] || 0];
skipped12++; skipped12++;

File diff suppressed because one or more lines are too long

152
dist/human.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

8
dist/human.node.js vendored

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1,44 +1,59 @@
{ {
"age": 161240,
"antispoof": 853098, "antispoof": 853098,
"blazeface": 538928,
"emotion": 820516,
"facemesh": 1477958,
"faceres": 6978814,
"handlandmark-full": 5431368,
"handtrack": 2964837,
"iris": 2599092,
"liveness": 592976,
"mb3-centernet": 4030290,
"models": 0,
"movenet-lightning": 4650216,
"selfie": 212886,
"age": 161240,
"blazeface-back": 538928, "blazeface-back": 538928,
"blazeface-front": 402048, "blazeface-front": 402048,
"blazeface": 538928,
"blazepose-detector2d": 7499400, "blazepose-detector2d": 7499400,
"blazepose-detector3d": 5928856, "blazepose-detector3d": 5928856,
"blazepose-full": 6338290, "blazepose-full": 6338290,
"blazepose-heavy": 27501554, "blazepose-heavy": 27501554,
"blazepose-lite": 2725490, "blazepose-lite": 2725490,
"efficientpose": 5651240, "efficientpose": 5651240,
"emotion": 820516,
"faceboxes": 2013002, "faceboxes": 2013002,
"facemesh-attention-alt": 2387598, "facemesh-attention-alt": 2387598,
"facemesh-attention": 2382414, "facemesh-attention": 2382414,
"facemesh-detection-full": 1026192, "facemesh-detection-full": 1026192,
"facemesh-detection-short": 201268, "facemesh-detection-short": 201268,
"facemesh-orig": 2955780, "facemesh-orig": 2955780,
"facemesh": 1477958,
"faceres-deep": 13957620, "faceres-deep": 13957620,
"faceres": 6978814,
"gear": 1498916, "gear": 1498916,
"gender-ssrnet-imdb": 161236, "gender-ssrnet-imdb": 161236,
"gender": 201808, "gender": 201808,
"handdetect": 3515612, "handdetect": 3515612,
"handlandmark-full": 5431368,
"handlandmark-lite": 2023432, "handlandmark-lite": 2023432,
"handlandmark-sparse": 5286322, "handlandmark-sparse": 5286322,
"handskeleton": 5502280, "handskeleton": 5502280,
"handtrack": 2964837,
"iris": 2599092,
"liveness": 592976,
"mb3-centernet": 4030290,
"meet": 372228, "meet": 372228,
"mobileface": 2183192, "mobileface": 2183192,
"mobilefacenet": 5171976, "mobilefacenet": 5171976,
"movenet-lightning": 4650216,
"movenet-multipose": 9448838, "movenet-multipose": 9448838,
"movenet-thunder": 12477112, "movenet-thunder": 12477112,
"nanodet": 7574558, "nanodet": 7574558,
"posenet": 5032780, "posenet": 5032780,
"selfie": 212886 "blazepose-detect": 5928804,
"anti-spoofing": 853098,
"efficientpose-i-lite": 2269064,
"efficientpose-ii-lite": 5651240,
"efficientpose-iv": 25643252,
"insightface-efficientnet-b0": 13013224,
"insightface-ghostnet-strides1": 8093408,
"insightface-ghostnet-strides2": 8049584,
"insightface-mobilenet-emore": 6938536,
"insightface-mobilenet-swish": 12168584,
"nanodet-e": 12319156,
"nanodet-g": 7574558,
"nanodet-m": 1887474,
"nanodet-t": 5294216
} }

View File

@ -7,6 +7,13 @@
"module": "dist/human.esm.js", "module": "dist/human.esm.js",
"browser": "dist/human.esm.js", "browser": "dist/human.esm.js",
"types": "types/human.d.ts", "types": "types/human.d.ts",
"exports": {
"require": "./dist/human.node.js",
"import": "./dist/human.esm.js",
"script": "./dist/human.js",
"module": "./dist/human.esm.js",
"types": "./types/human.d.ts"
},
"author": "Vladimir Mandic <mandic00@live.com>", "author": "Vladimir Mandic <mandic00@live.com>",
"bugs": { "bugs": {
"url": "https://github.com/vladmandic/human/issues" "url": "https://github.com/vladmandic/human/issues"
@ -59,7 +66,7 @@
"node-webcam": "^0.8.1" "node-webcam": "^0.8.1"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/api-extractor": "^7.29.0", "@microsoft/api-extractor": "^7.29.2",
"@tensorflow/tfjs": "^3.19.0", "@tensorflow/tfjs": "^3.19.0",
"@tensorflow/tfjs-backend-cpu": "^3.19.0", "@tensorflow/tfjs-backend-cpu": "^3.19.0",
"@tensorflow/tfjs-backend-wasm": "^3.19.0", "@tensorflow/tfjs-backend-wasm": "^3.19.0",
@ -72,15 +79,15 @@
"@tensorflow/tfjs-node": "^3.19.0", "@tensorflow/tfjs-node": "^3.19.0",
"@tensorflow/tfjs-node-gpu": "^3.19.0", "@tensorflow/tfjs-node-gpu": "^3.19.0",
"@tensorflow/tfjs-tflite": "0.0.1-alpha.8", "@tensorflow/tfjs-tflite": "0.0.1-alpha.8",
"@types/node": "^18.6.4", "@types/node": "^18.7.2",
"@types/offscreencanvas": "^2019.7.0", "@types/offscreencanvas": "^2019.7.0",
"@typescript-eslint/eslint-plugin": "^5.32.0", "@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.32.0", "@typescript-eslint/parser": "^5.33.0",
"@vladmandic/build": "^0.7.8", "@vladmandic/build": "^0.7.9",
"@vladmandic/pilogger": "^0.4.6", "@vladmandic/pilogger": "^0.4.6",
"@vladmandic/tfjs": "github:vladmandic/tfjs", "@vladmandic/tfjs": "github:vladmandic/tfjs",
"@webgpu/types": "^0.1.21", "@webgpu/types": "^0.1.21",
"esbuild": "^0.14.54", "esbuild": "^0.15.1",
"eslint": "8.21.0", "eslint": "8.21.0",
"eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-html": "^7.1.0", "eslint-plugin-html": "^7.1.0",

View File

@ -1,24 +1,24 @@
2022-08-10 13:47:25 INFO:  Application: {"name":"@vladmandic/human","version":"2.9.3"} 2022-08-12 09:12:16 INFO:  Application: {"name":"@vladmandic/human","version":"2.9.3"}
2022-08-10 13:47:25 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true} 2022-08-12 09:12:16 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2022-08-10 13:47:25 INFO:  Toolchain: {"build":"0.7.8","esbuild":"0.14.54","typescript":"4.7.4","typedoc":"0.23.10","eslint":"8.21.0"} 2022-08-12 09:12:16 INFO:  Toolchain: {"build":"0.7.9","esbuild":"0.15.1","typescript":"4.7.4","typedoc":"0.23.10","eslint":"8.21.0"}
2022-08-10 13:47:25 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]} 2022-08-12 09:12:16 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2022-08-10 13:47:25 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]} 2022-08-12 09:12:16 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":608} 2022-08-12 09:12:16 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":608}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":654091,"outputBytes":306229} 2022-08-12 09:12:16 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":654779,"outputBytes":307161}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":612} 2022-08-12 09:12:16 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":612}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":654095,"outputBytes":306233} 2022-08-12 09:12:16 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":654783,"outputBytes":307165}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":664} 2022-08-12 09:12:16 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":664}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":654147,"outputBytes":306283} 2022-08-12 09:12:16 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":654835,"outputBytes":307215}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1069,"outputBytes":358} 2022-08-12 09:12:16 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1069,"outputBytes":358}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1032,"outputBytes":583} 2022-08-12 09:12:16 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1032,"outputBytes":583}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":654066,"outputBytes":305082} 2022-08-12 09:12:16 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":654754,"outputBytes":306014}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1271,"outputBytes":2787569} 2022-08-12 09:12:17 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1271,"outputBytes":2787569}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3441052,"outputBytes":1667923} 2022-08-12 09:12:17 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3441740,"outputBytes":1668900}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3441052,"outputBytes":3070725} 2022-08-12 09:12:17 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3441740,"outputBytes":3072630}
2022-08-10 13:47:31 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":30} 2022-08-12 09:12:23 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":30}
2022-08-10 13:47:34 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true} 2022-08-12 09:12:25 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
2022-08-10 13:47:34 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6716,"outputBytes":3141} 2022-08-12 09:12:25 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6716,"outputBytes":3141}
2022-08-10 13:47:34 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15629,"outputBytes":7798} 2022-08-12 09:12:25 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15629,"outputBytes":7798}
2022-08-10 13:47:43 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":109,"errors":0,"warnings":0} 2022-08-12 09:12:35 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":109,"errors":0,"warnings":0}
2022-08-10 13:47:43 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"} 2022-08-12 09:12:35 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2022-08-10 13:47:43 INFO:  Done... 2022-08-12 09:12:35 INFO:  Done...