initial work on skipTime

pull/233/head
Vladimir Mandic 2021-10-22 16:09:52 -04:00
parent 54498226a0
commit ebfd0b01e0
67 changed files with 30731 additions and 121501 deletions

View File

@ -11,6 +11,9 @@
### **HEAD -> main** 2021/10/22 mandic00@live.com ### **HEAD -> main** 2021/10/22 mandic00@live.com
### **origin/main** 2021/10/22 mandic00@live.com
- add optional autodetected custom wasm path - add optional autodetected custom wasm path
### **2.3.6** 2021/10/21 mandic00@live.com ### **2.3.6** 2021/10/21 mandic00@live.com

View File

@ -137,6 +137,7 @@
"format": "esm", "format": "esm",
"input": "tfjs/tf-browser.ts", "input": "tfjs/tf-browser.ts",
"output": "dist/tfjs.esm.js", "output": "dist/tfjs.esm.js",
"minify": true,
"sourcemap": true, "sourcemap": true,
"external": ["fs", "os", "buffer", "util"] "external": ["fs", "os", "buffer", "util"]
}, },

View File

@ -1,6 +1,4 @@
// import * as tf from '../../assets/tf.es2017.js'; import Human from '../../dist/human.custom.esm.js';
// import '../../assets/tf-backend-webgpu.es2017.js';
import Human from '../../dist/human.esm.js';
const loop = 20; const loop = 20;

View File

@ -136,6 +136,7 @@ var config = {
rotation: true, rotation: true,
maxDetected: 1, maxDetected: 1,
skipFrames: 11, skipFrames: 11,
skipTime: 2e3,
minConfidence: 0.2, minConfidence: 0.2,
iouThreshold: 0.1, iouThreshold: 0.1,
return: false return: false
@ -152,17 +153,20 @@ var config = {
enabled: true, enabled: true,
minConfidence: 0.1, minConfidence: 0.1,
skipFrames: 12, skipFrames: 12,
skipTime: 2e3,
modelPath: "emotion.json" modelPath: "emotion.json"
}, },
description: { description: {
enabled: true, enabled: true,
modelPath: "faceres.json", modelPath: "faceres.json",
skipFrames: 13, skipFrames: 13,
skipTime: 2e3,
minConfidence: 0.1 minConfidence: 0.1
}, },
antispoof: { antispoof: {
enabled: false, enabled: false,
skipFrames: 14, skipFrames: 14,
skipTime: 2e3,
modelPath: "antispoof.json" modelPath: "antispoof.json"
} }
}, },
@ -174,12 +178,14 @@ var config = {
}, },
maxDetected: -1, maxDetected: -1,
minConfidence: 0.3, minConfidence: 0.3,
skipFrames: 1 skipFrames: 1,
skipTime: 2e3
}, },
hand: { hand: {
enabled: true, enabled: true,
rotation: true, rotation: true,
skipFrames: 2, skipFrames: 2,
skipTime: 2e3,
minConfidence: 0.5, minConfidence: 0.5,
iouThreshold: 0.2, iouThreshold: 0.2,
maxDetected: -1, maxDetected: -1,
@ -197,7 +203,8 @@ var config = {
minConfidence: 0.2, minConfidence: 0.2,
iouThreshold: 0.4, iouThreshold: 0.4,
maxDetected: 10, maxDetected: 10,
skipFrames: 15 skipFrames: 15,
skipTime: 2e3
}, },
segmentation: { segmentation: {
enabled: false, enabled: false,
@ -17734,14 +17741,14 @@ function formatAsFriendlyString(value) {
} }
} }
function debounce(f, waitMs, nowFunc) { function debounce(f, waitMs, nowFunc) {
let lastTime = nowFunc != null ? nowFunc() : util_exports.now(); let lastTime8 = nowFunc != null ? nowFunc() : util_exports.now();
let lastResult; let lastResult;
const f2 = (...args) => { const f2 = (...args) => {
const now22 = nowFunc != null ? nowFunc() : util_exports.now(); const now22 = nowFunc != null ? nowFunc() : util_exports.now();
if (now22 - lastTime < waitMs) { if (now22 - lastTime8 < waitMs) {
return lastResult; return lastResult;
} }
lastTime = now22; lastTime8 = now22;
lastResult = f(...args); lastResult = f(...args);
return lastResult; return lastResult;
}; };
@ -71352,6 +71359,7 @@ var model3;
var cached = []; var cached = [];
var skipped2 = Number.MAX_SAFE_INTEGER; var skipped2 = Number.MAX_SAFE_INTEGER;
var lastCount = 0; var lastCount = 0;
var last = 0;
async function load2(config3) { async function load2(config3) {
var _a, _b; var _a, _b;
if (env2.initial) if (env2.initial)
@ -71367,10 +71375,10 @@ async function load2(config3) {
return model3; return model3;
} }
async function predict(image7, config3, idx, count3) { async function predict(image7, config3, idx, count3) {
var _a; var _a, _b;
if (!model3) if (!model3)
return null; return null;
if (skipped2 < (((_a = config3.face.antispoof) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount === count3 && cached[idx]) { if (skipped2 < (((_a = config3.face.antispoof) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.antispoof) == null ? void 0 : _b.skipTime) || 0) <= now() - last && config3.skipFrame && lastCount === count3 && cached[idx]) {
skipped2++; skipped2++;
return cached[idx]; return cached[idx];
} }
@ -71381,6 +71389,7 @@ async function predict(image7, config3, idx, count3) {
const num = (await res.data())[0]; const num = (await res.data())[0];
cached[idx] = Math.round(100 * num) / 100; cached[idx] = Math.round(100 * num) / 100;
lastCount = count3; lastCount = count3;
last = now();
dispose([resize, res]); dispose([resize, res]);
resolve(cached[idx]); resolve(cached[idx]);
}); });
@ -74956,6 +74965,7 @@ var skipped3 = Number.MAX_SAFE_INTEGER;
var outputNodes; var outputNodes;
var cache = null; var cache = null;
var padding = [[0, 0], [0, 0], [0, 0], [0, 0]]; var padding = [[0, 0], [0, 0], [0, 0], [0, 0]];
var last2 = 0;
async function loadDetect(config3) { async function loadDetect(config3) {
var _a, _b, _c; var _a, _b, _c;
if (env3.initial) if (env3.initial)
@ -75072,10 +75082,11 @@ async function detectParts(input2, config3, outputSize2) {
} }
async function predict2(input2, config3) { async function predict2(input2, config3) {
const outputSize2 = [input2.shape[2] || 0, input2.shape[1] || 0]; const outputSize2 = [input2.shape[2] || 0, input2.shape[1] || 0];
if (skipped3 < (config3.body.skipFrames || 0) && config3.skipFrame && cache !== null) { if (skipped3 < (config3.body.skipFrames || 0) && (config3.body.skipTime || 0) <= now() - last2 && config3.skipFrame && cache !== null) {
skipped3++; skipped3++;
} else { } else {
cache = await detectParts(input2, config3, outputSize2); cache = await detectParts(input2, config3, outputSize2);
last2 = now();
skipped3 = 0; skipped3 = 0;
} }
if (cache) if (cache)
@ -75170,7 +75181,8 @@ var labels = [
// src/object/centernet.ts // src/object/centernet.ts
var model5; var model5;
var inputSize3 = 0; var inputSize3 = 0;
var last = []; var last3 = [];
var lastTime = 0;
var skipped4 = Number.MAX_SAFE_INTEGER; var skipped4 = Number.MAX_SAFE_INTEGER;
async function load4(config3) { async function load4(config3) {
if (env2.initial) if (env2.initial)
@ -75235,20 +75247,21 @@ async function process3(res, outputShape, config3) {
return results; return results;
} }
async function predict3(input2, config3) { async function predict3(input2, config3) {
if (skipped4 < (config3.object.skipFrames || 0) && config3.skipFrame && last.length > 0) { if (skipped4 < (config3.object.skipFrames || 0) && (config3.object.skipTime || 0) <= now() - lastTime && config3.skipFrame && last3.length > 0) {
skipped4++; skipped4++;
return last; return last3;
} }
skipped4 = 0; skipped4 = 0;
if (!env2.kernels.includes("mod") || !env2.kernels.includes("sparsetodense")) if (!env2.kernels.includes("mod") || !env2.kernels.includes("sparsetodense"))
return last; return last3;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const outputSize2 = [input2.shape[2], input2.shape[1]]; const outputSize2 = [input2.shape[2], input2.shape[1]];
const resize = image.resizeBilinear(input2, [inputSize3, inputSize3]); const resize = image.resizeBilinear(input2, [inputSize3, inputSize3]);
const objectT = config3.object.enabled ? model5 == null ? void 0 : model5.execute(resize, ["tower_0/detections"]) : null; const objectT = config3.object.enabled ? model5 == null ? void 0 : model5.execute(resize, ["tower_0/detections"]) : null;
lastTime = now();
dispose(resize); dispose(resize);
const obj = await process3(objectT, outputSize2, config3); const obj = await process3(objectT, outputSize2, config3);
last = obj; last3 = obj;
resolve(obj); resolve(obj);
}); });
} }
@ -75288,6 +75301,7 @@ var connected2 = {
// src/body/efficientpose.ts // src/body/efficientpose.ts
var model6; var model6;
var last4 = 0;
var cache2 = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} }; var cache2 = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} };
var skipped5 = Number.MAX_SAFE_INTEGER; var skipped5 = Number.MAX_SAFE_INTEGER;
async function load5(config3) { async function load5(config3) {
@ -75320,7 +75334,7 @@ function max2d(inputs, minScore) {
} }
async function predict4(image7, config3) { async function predict4(image7, config3) {
var _a; var _a;
if (skipped5 < (((_a = config3.body) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && Object.keys(cache2.keypoints).length > 0) { if (skipped5 < (((_a = config3.body) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && Object.keys(cache2.keypoints).length > 0 && (config3.body.skipTime || 0) <= now() - last4) {
skipped5++; skipped5++;
return [cache2]; return [cache2];
} }
@ -75338,6 +75352,7 @@ async function predict4(image7, config3) {
let resT; let resT;
if (config3.body.enabled) if (config3.body.enabled)
resT = await (model6 == null ? void 0 : model6.predict(tensor2)); resT = await (model6 == null ? void 0 : model6.predict(tensor2));
last4 = now();
dispose(tensor2); dispose(tensor2);
if (resT) { if (resT) {
cache2.keypoints.length = 0; cache2.keypoints.length = 0;
@ -75398,8 +75413,9 @@ async function predict4(image7, config3) {
// src/gear/emotion.ts // src/gear/emotion.ts
var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"]; var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"];
var model7; var model7;
var last2 = []; var last5 = [];
var lastCount2 = 0; var lastCount2 = 0;
var lastTime2 = 0;
var skipped6 = Number.MAX_SAFE_INTEGER; var skipped6 = Number.MAX_SAFE_INTEGER;
var rgb = [0.2989, 0.587, 0.114]; var rgb = [0.2989, 0.587, 0.114];
async function load6(config3) { async function load6(config3) {
@ -75417,44 +75433,45 @@ async function load6(config3) {
return model7; return model7;
} }
async function predict5(image7, config3, idx, count3) { async function predict5(image7, config3, idx, count3) {
var _a; var _a, _b;
if (!model7) if (!model7)
return null; return null;
if (skipped6 < (((_a = config3.face.emotion) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount2 === count3 && last2[idx] && last2[idx].length > 0) { if (skipped6 < (((_a = config3.face.emotion) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.emotion) == null ? void 0 : _b.skipTime) || 0) <= now() - lastTime2 && config3.skipFrame && lastCount2 === count3 && last5[idx] && last5[idx].length > 0) {
skipped6++; skipped6++;
return last2[idx]; return last5[idx];
} }
skipped6 = 0; skipped6 = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
var _a2, _b; var _a2, _b2;
const resize = image.resizeBilinear(image7, [(model7 == null ? void 0 : model7.inputs[0].shape) ? model7.inputs[0].shape[2] : 0, (model7 == null ? void 0 : model7.inputs[0].shape) ? model7.inputs[0].shape[1] : 0], false);
const [red, green, blue] = split(resize, 3, 3);
dispose(resize);
const redNorm = mul(red, rgb[0]);
const greenNorm = mul(green, rgb[1]);
const blueNorm = mul(blue, rgb[2]);
dispose(red);
dispose(green);
dispose(blue);
const grayscale = addN([redNorm, greenNorm, blueNorm]);
dispose(redNorm);
dispose(greenNorm);
dispose(blueNorm);
const normalize = tidy(() => mul(sub(grayscale, 0.5), 2));
dispose(grayscale);
const obj = []; const obj = [];
if ((_a2 = config3.face.emotion) == null ? void 0 : _a2.enabled) { if ((_a2 = config3.face.emotion) == null ? void 0 : _a2.enabled) {
const resize = image.resizeBilinear(image7, [(model7 == null ? void 0 : model7.inputs[0].shape) ? model7.inputs[0].shape[2] : 0, (model7 == null ? void 0 : model7.inputs[0].shape) ? model7.inputs[0].shape[1] : 0], false);
const [red, green, blue] = split(resize, 3, 3);
dispose(resize);
const redNorm = mul(red, rgb[0]);
const greenNorm = mul(green, rgb[1]);
const blueNorm = mul(blue, rgb[2]);
dispose(red);
dispose(green);
dispose(blue);
const grayscale = addN([redNorm, greenNorm, blueNorm]);
dispose(redNorm);
dispose(greenNorm);
dispose(blueNorm);
const normalize = tidy(() => mul(sub(grayscale, 0.5), 2));
dispose(grayscale);
const emotionT = await (model7 == null ? void 0 : model7.predict(normalize)); const emotionT = await (model7 == null ? void 0 : model7.predict(normalize));
lastTime2 = now();
const data = await emotionT.data(); const data = await emotionT.data();
dispose(emotionT); dispose(emotionT);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (data[i] > (((_b = config3.face.emotion) == null ? void 0 : _b.minConfidence) || 0)) if (data[i] > (((_b2 = config3.face.emotion) == null ? void 0 : _b2.minConfidence) || 0))
obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] }); obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] });
} }
obj.sort((a, b) => b.score - a.score); obj.sort((a, b) => b.score - a.score);
dispose(normalize);
} }
dispose(normalize); last5[idx] = obj;
last2[idx] = obj;
lastCount2 = count3; lastCount2 = count3;
resolve(obj); resolve(obj);
}); });
@ -75597,11 +75614,13 @@ var boxCache = [];
var model9 = null; var model9 = null;
var inputSize5 = 0; var inputSize5 = 0;
var skipped7 = Number.MAX_SAFE_INTEGER; var skipped7 = Number.MAX_SAFE_INTEGER;
var lastTime3 = 0;
var detectedFaces = 0; var detectedFaces = 0;
async function predict6(input2, config3) { async function predict6(input2, config3) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
if (!config3.skipFrame || (detectedFaces !== ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || !((_b = config3.face.mesh) == null ? void 0 : _b.enabled)) && skipped7 > (((_c = config3.face.detector) == null ? void 0 : _c.skipFrames) || 0)) { if (!config3.skipFrame || (detectedFaces !== ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || !((_b = config3.face.mesh) == null ? void 0 : _b.enabled)) && (skipped7 > (((_c = config3.face.detector) == null ? void 0 : _c.skipFrames) || 0) && (((_d = config3.face.description) == null ? void 0 : _d.skipTime) || 0) <= now() - lastTime3)) {
const newBoxes2 = await getBoxes(input2, config3); const newBoxes2 = await getBoxes(input2, config3);
lastTime3 = now();
boxCache = []; boxCache = [];
for (const possible of newBoxes2.boxes) { for (const possible of newBoxes2.boxes) {
const startPoint = await possible.box.startPoint.data(); const startPoint = await possible.box.startPoint.data();
@ -75637,16 +75656,16 @@ async function predict6(input2, config3) {
faceScore: 0, faceScore: 0,
annotations: {} annotations: {}
}; };
if (((_d = config3.face.detector) == null ? void 0 : _d.rotation) && ((_e = config3.face.mesh) == null ? void 0 : _e.enabled) && env2.kernels.includes("rotatewithoffset")) { if (((_e = config3.face.detector) == null ? void 0 : _e.rotation) && ((_f = config3.face.mesh) == null ? void 0 : _f.enabled) && env2.kernels.includes("rotatewithoffset")) {
[angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input2, inputSize5); [angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input2, inputSize5);
} else { } else {
rotationMatrix = IDENTITY_MATRIX; rotationMatrix = IDENTITY_MATRIX;
const cut = cutBoxFromImageAndResize({ startPoint: box4.startPoint, endPoint: box4.endPoint }, input2, ((_f = config3.face.mesh) == null ? void 0 : _f.enabled) ? [inputSize5, inputSize5] : [size(), size()]); const cut = cutBoxFromImageAndResize({ startPoint: box4.startPoint, endPoint: box4.endPoint }, input2, ((_g = config3.face.mesh) == null ? void 0 : _g.enabled) ? [inputSize5, inputSize5] : [size(), size()]);
face5.tensor = div(cut, 255); face5.tensor = div(cut, 255);
dispose(cut); dispose(cut);
} }
face5.boxScore = Math.round(100 * box4.confidence) / 100; face5.boxScore = Math.round(100 * box4.confidence) / 100;
if (!((_g = config3.face.mesh) == null ? void 0 : _g.enabled)) { if (!((_h = config3.face.mesh) == null ? void 0 : _h.enabled)) {
face5.box = getClampedBox(box4, input2); face5.box = getClampedBox(box4, input2);
face5.boxRaw = getRawBox(box4, input2); face5.boxRaw = getRawBox(box4, input2);
face5.score = Math.round(100 * box4.confidence || 0) / 100; face5.score = Math.round(100 * box4.confidence || 0) / 100;
@ -75669,17 +75688,17 @@ async function predict6(input2, config3) {
let rawCoords = await coordsReshaped.array(); let rawCoords = await coordsReshaped.array();
dispose(contourCoords); dispose(contourCoords);
dispose(coordsReshaped); dispose(coordsReshaped);
if (faceConfidence < (((_h = config3.face.detector) == null ? void 0 : _h.minConfidence) || 1)) { if (faceConfidence < (((_i = config3.face.detector) == null ? void 0 : _i.minConfidence) || 1)) {
box4.confidence = faceConfidence; box4.confidence = faceConfidence;
} else { } else {
if ((_i = config3.face.iris) == null ? void 0 : _i.enabled) if ((_j = config3.face.iris) == null ? void 0 : _j.enabled)
rawCoords = await augmentIris(rawCoords, face5.tensor, config3, inputSize5); rawCoords = await augmentIris(rawCoords, face5.tensor, config3, inputSize5);
face5.mesh = transformRawCoords(rawCoords, box4, angle, rotationMatrix, inputSize5); face5.mesh = transformRawCoords(rawCoords, box4, angle, rotationMatrix, inputSize5);
face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input2.shape[2] || 0), pt[1] / (input2.shape[1] || 0), (pt[2] || 0) / inputSize5]); face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input2.shape[2] || 0), pt[1] / (input2.shape[1] || 0), (pt[2] || 0) / inputSize5]);
box4 = { ...enlargeBox(calculateLandmarksBoundingBox(face5.mesh), 1.5), confidence: box4.confidence }; box4 = { ...enlargeBox(calculateLandmarksBoundingBox(face5.mesh), 1.5), confidence: box4.confidence };
for (const key of Object.keys(meshAnnotations)) for (const key of Object.keys(meshAnnotations))
face5.annotations[key] = meshAnnotations[key].map((index) => face5.mesh[index]); face5.annotations[key] = meshAnnotations[key].map((index) => face5.mesh[index]);
if (((_j = config3.face.detector) == null ? void 0 : _j.rotation) && config3.face.mesh.enabled && ((_k = config3.face.description) == null ? void 0 : _k.enabled) && env2.kernels.includes("rotatewithoffset")) { if (((_k = config3.face.detector) == null ? void 0 : _k.rotation) && config3.face.mesh.enabled && ((_l = config3.face.description) == null ? void 0 : _l.enabled) && env2.kernels.includes("rotatewithoffset")) {
dispose(face5.tensor); dispose(face5.tensor);
[angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input2, inputSize5); [angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input2, inputSize5);
} }
@ -75693,7 +75712,7 @@ async function predict6(input2, config3) {
faces.push(face5); faces.push(face5);
newBoxes.push(box4); newBoxes.push(box4);
} }
if ((_l = config3.face.mesh) == null ? void 0 : _l.enabled) if ((_m = config3.face.mesh) == null ? void 0 : _m.enabled)
boxCache = newBoxes.filter((a) => { boxCache = newBoxes.filter((a) => {
var _a2; var _a2;
return a.confidence > (((_a2 = config3.face.detector) == null ? void 0 : _a2.minConfidence) || 0); return a.confidence > (((_a2 = config3.face.detector) == null ? void 0 : _a2.minConfidence) || 0);
@ -75723,7 +75742,8 @@ var uvmap = UV468;
// src/face/faceres.ts // src/face/faceres.ts
var model10; var model10;
var last3 = []; var last6 = [];
var lastTime4 = 0;
var lastCount3 = 0; var lastCount3 = 0;
var skipped8 = Number.MAX_SAFE_INTEGER; var skipped8 = Number.MAX_SAFE_INTEGER;
async function load9(config3) { async function load9(config3) {
@ -75756,29 +75776,29 @@ function enhance(input2) {
return image7; return image7;
} }
async function predict7(image7, config3, idx, count3) { async function predict7(image7, config3, idx, count3) {
var _a, _b, _c; var _a, _b, _c, _d;
if (!model10) if (!model10)
return null; return null;
if (skipped8 < (((_a = config3.face.description) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount3 === count3 && ((_b = last3[idx]) == null ? void 0 : _b.age) && ((_c = last3[idx]) == null ? void 0 : _c.age) > 0) { if (skipped8 < (((_a = config3.face.description) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.description) == null ? void 0 : _b.skipTime) || 0) <= now() - lastTime4 && config3.skipFrame && lastCount3 === count3 && ((_c = last6[idx]) == null ? void 0 : _c.age) && ((_d = last6[idx]) == null ? void 0 : _d.age) > 0) {
skipped8++; skipped8++;
return last3[idx]; return last6[idx];
} }
skipped8 = 0; skipped8 = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
var _a2, _b2; var _a2, _b2;
const enhanced = enhance(image7);
let resT;
const obj = { const obj = {
age: 0, age: 0,
gender: "unknown", gender: "unknown",
genderScore: 0, genderScore: 0,
descriptor: [] descriptor: []
}; };
if ((_a2 = config3.face.description) == null ? void 0 : _a2.enabled) if ((_a2 = config3.face.description) == null ? void 0 : _a2.enabled) {
resT = await (model10 == null ? void 0 : model10.predict(enhanced)); const enhanced = enhance(image7);
dispose(enhanced); const resT = await (model10 == null ? void 0 : model10.predict(enhanced));
if (resT) { lastTime4 = now();
const gender = await resT.find((t) => t.shape[1] === 1).data(); dispose(enhanced);
const genderT = await resT.find((t) => t.shape[1] === 1);
const gender = await genderT.data();
const confidence = Math.trunc(200 * Math.abs(gender[0] - 0.5)) / 100; const confidence = Math.trunc(200 * Math.abs(gender[0] - 0.5)) / 100;
if (confidence > (((_b2 = config3.face.description) == null ? void 0 : _b2.minConfidence) || 0)) { if (confidence > (((_b2 = config3.face.description) == null ? void 0 : _b2.minConfidence) || 0)) {
obj.gender = gender[0] <= 0.5 ? "female" : "male"; obj.gender = gender[0] <= 0.5 ? "female" : "male";
@ -75787,14 +75807,15 @@ async function predict7(image7, config3, idx, count3) {
const argmax2 = argMax(resT.find((t) => t.shape[1] === 100), 1); const argmax2 = argMax(resT.find((t) => t.shape[1] === 100), 1);
const age = (await argmax2.data())[0]; const age = (await argmax2.data())[0];
dispose(argmax2); dispose(argmax2);
const all6 = await resT.find((t) => t.shape[1] === 100).data(); const ageT = resT.find((t) => t.shape[1] === 100);
const all6 = await ageT.data();
obj.age = Math.round(all6[age - 1] > all6[age + 1] ? 10 * age - 100 * all6[age - 1] : 10 * age + 100 * all6[age + 1]) / 10; obj.age = Math.round(all6[age - 1] > all6[age + 1] ? 10 * age - 100 * all6[age - 1] : 10 * age + 100 * all6[age + 1]) / 10;
const desc = resT.find((t) => t.shape[1] === 1024); const desc = resT.find((t) => t.shape[1] === 1024);
const descriptor = await desc.data(); const descriptor = desc ? await desc.data() : [];
obj.descriptor = [...descriptor]; obj.descriptor = Array.from(descriptor);
resT.forEach((t) => dispose(t)); resT.forEach((t) => dispose(t));
} }
last3[idx] = obj; last6[idx] = obj;
lastCount3 = count3; lastCount3 = count3;
resolve(obj); resolve(obj);
}); });
@ -78941,6 +78962,7 @@ var handBoxEnlargeFactor = 1.65;
var palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2]; var palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2];
var palmLandmarksPalmBase = 0; var palmLandmarksPalmBase = 0;
var palmLandmarksMiddleFingerBase = 2; var palmLandmarksMiddleFingerBase = 2;
var lastTime5 = 0;
var HandPipeline = class { var HandPipeline = class {
constructor(handDetector, handPoseModel2) { constructor(handDetector, handPoseModel2) {
__publicField(this, "handDetector"); __publicField(this, "handDetector");
@ -79005,7 +79027,7 @@ var HandPipeline = class {
async estimateHands(image7, config3) { async estimateHands(image7, config3) {
let useFreshBox = false; let useFreshBox = false;
let boxes; let boxes;
if (this.skipped === 0 || this.skipped > config3.hand.skipFrames || !config3.hand.landmarks || !config3.skipFrame) { if (this.skipped === 0 || this.skipped > config3.hand.skipFrames && (config3.hand.skipTime || 0) <= now() - lastTime5 || !config3.hand.landmarks || !config3.skipFrame) {
boxes = await this.handDetector.estimateHandBounds(image7, config3); boxes = await this.handDetector.estimateHandBounds(image7, config3);
this.skipped = 0; this.skipped = 0;
} }
@ -79034,6 +79056,7 @@ var HandPipeline = class {
dispose(croppedInput); dispose(croppedInput);
dispose(rotatedImage); dispose(rotatedImage);
const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage); const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage);
lastTime5 = now();
dispose(handImage); dispose(handImage);
const confidence = (await confidenceT.data())[0]; const confidence = (await confidenceT.data())[0];
dispose(confidenceT); dispose(confidenceT);
@ -79602,6 +79625,7 @@ var boxExpandFact = 1.6;
var maxDetectorResolution = 512; var maxDetectorResolution = 512;
var detectorExpandFact = 1.4; var detectorExpandFact = 1.4;
var skipped9 = 0; var skipped9 = 0;
var lastTime6 = 0;
var outputSize = [0, 0]; var outputSize = [0, 0];
var cache3 = { var cache3 = {
boxes: [], boxes: [],
@ -79741,16 +79765,17 @@ async function predict9(input2, config3) {
return []; return [];
outputSize = [input2.shape[2] || 0, input2.shape[1] || 0]; outputSize = [input2.shape[2] || 0, input2.shape[1] || 0];
skipped9++; skipped9++;
if (config3.skipFrame && skipped9 <= (config3.hand.skipFrames || 0)) { if (config3.skipFrame && skipped9 <= (config3.hand.skipFrames || 0) && (config3.hand.skipTime || 0) <= now() - lastTime6) {
return cache3.hands; return cache3.hands;
} }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
if (config3.skipFrame && cache3.hands.length === config3.hand.maxDetected) { if (config3.skipFrame && cache3.hands.length === config3.hand.maxDetected) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input2, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input2, handBox, config3)));
} else if (config3.skipFrame && skipped9 < 3 * (config3.hand.skipFrames || 0) && cache3.hands.length > 0) { } else if (config3.skipFrame && skipped9 < 3 * (config3.hand.skipFrames || 0) && (config3.hand.skipTime || 0) <= 3 * (now() - lastTime6) && cache3.hands.length > 0) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input2, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input2, handBox, config3)));
} else { } else {
cache3.boxes = await detectHands(input2, config3); cache3.boxes = await detectHands(input2, config3);
lastTime6 = now();
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input2, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input2, handBox, config3)));
skipped9 = 0; skipped9 = 0;
} }
@ -79937,7 +79962,8 @@ var inputSize7 = 0;
var skipped10 = Number.MAX_SAFE_INTEGER; var skipped10 = Number.MAX_SAFE_INTEGER;
var cache5 = { var cache5 = {
boxes: [], boxes: [],
bodies: [] bodies: [],
last: 0
}; };
async function load11(config3) { async function load11(config3) {
if (env2.initial) if (env2.initial)
@ -80047,7 +80073,7 @@ async function predict10(input2, config3) {
if (!config3.skipFrame) if (!config3.skipFrame)
cache5.boxes.length = 0; cache5.boxes.length = 0;
skipped10++; skipped10++;
if (config3.skipFrame && skipped10 <= (config3.body.skipFrames || 0)) { if (config3.skipFrame && (skipped10 <= (config3.body.skipFrames || 0) && (config3.body.skipTime || 0) <= now() - cache5.last)) {
return cache5.bodies; return cache5.bodies;
} }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
@ -80055,6 +80081,7 @@ async function predict10(input2, config3) {
skipped10 = 0; skipped10 = 0;
t.input = padInput(input2, inputSize7); t.input = padInput(input2, inputSize7);
t.res = await (model11 == null ? void 0 : model11.predict(t.input)); t.res = await (model11 == null ? void 0 : model11.predict(t.input));
cache5.last = now();
const res = await t.res.array(); const res = await t.res.array();
cache5.bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input2, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input2, [0, 0, 1, 1]); cache5.bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input2, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input2, [0, 0, 1, 1]);
for (const body4 of cache5.bodies) { for (const body4 of cache5.bodies) {
@ -80068,7 +80095,8 @@ async function predict10(input2, config3) {
// src/object/nanodet.ts // src/object/nanodet.ts
var model12; var model12;
var last4 = []; var last7 = [];
var lastTime7 = 0;
var skipped11 = Number.MAX_SAFE_INTEGER; var skipped11 = Number.MAX_SAFE_INTEGER;
var scaleBox = 2.5; var scaleBox = 2.5;
async function load12(config3) { async function load12(config3) {
@ -80148,13 +80176,13 @@ async function process4(res, inputSize8, outputShape, config3) {
return results; return results;
} }
async function predict11(image7, config3) { async function predict11(image7, config3) {
if (skipped11 < (config3.object.skipFrames || 0) && config3.skipFrame && last4.length > 0) { if (skipped11 < (config3.object.skipFrames || 0) && (config3.object.skipTime || 0) <= now() - lastTime7 && config3.skipFrame && last7.length > 0) {
skipped11++; skipped11++;
return last4; return last7;
} }
skipped11 = 0; skipped11 = 0;
if (!env2.kernels.includes("mod") || !env2.kernels.includes("sparsetodense")) if (!env2.kernels.includes("mod") || !env2.kernels.includes("sparsetodense"))
return last4; return last7;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const outputSize2 = [image7.shape[2], image7.shape[1]]; const outputSize2 = [image7.shape[2], image7.shape[1]];
const resize = image.resizeBilinear(image7, [model12.inputSize, model12.inputSize], false); const resize = image.resizeBilinear(image7, [model12.inputSize, model12.inputSize], false);
@ -80165,9 +80193,10 @@ async function predict11(image7, config3) {
let objectT; let objectT;
if (config3.object.enabled) if (config3.object.enabled)
objectT = await model12.predict(transpose6); objectT = await model12.predict(transpose6);
lastTime7 = now();
dispose(transpose6); dispose(transpose6);
const obj = await process4(objectT, model12.inputSize, outputSize2, config3); const obj = await process4(objectT, model12.inputSize, outputSize2, config3);
last4 = obj; last7 = obj;
resolve(obj); resolve(obj);
}); });
} }

File diff suppressed because one or more lines are too long

33
dist/human.d.ts vendored
View File

@ -1,33 +0,0 @@
// @ts-nocheck
declare module '@vladmandic/human/dist/tfjs.esm' {
export * from '@vladmandic/human/types/dist/tfjs.esm';
}
declare module '@vladmandic/human/dist/human' {
export * from '@vladmandic/human/types/src/human';
}
declare module '@vladmandic/human/dist/human.esm' {
export * from '@vladmandic/human/types/src/human';
}
declare module '@vladmandic/human/dist/human.esm-nobundle' {
export * from '@vladmandic/human/types/src/human';
}
declare module '@vladmandic/human/dist/human.custom.esm' {
export * from '@vladmandic/human/types/src/human';
}
declare module '@vladmandic/human/dist/human.node' {
export * from '@vladmandic/human/types/src/human';
}
declare module '@vladmandic/human/dist/human.node-gpu' {
export * from '@vladmandic/human/types/src/human';
}
declare module '@vladmandic/human/dist/human.node-wasm' {
export * from '@vladmandic/human/types/src/human';
}

View File

@ -147,6 +147,7 @@ var config = {
rotation: true, rotation: true,
maxDetected: 1, maxDetected: 1,
skipFrames: 11, skipFrames: 11,
skipTime: 2e3,
minConfidence: 0.2, minConfidence: 0.2,
iouThreshold: 0.1, iouThreshold: 0.1,
return: false return: false
@ -163,17 +164,20 @@ var config = {
enabled: true, enabled: true,
minConfidence: 0.1, minConfidence: 0.1,
skipFrames: 12, skipFrames: 12,
skipTime: 2e3,
modelPath: "emotion.json" modelPath: "emotion.json"
}, },
description: { description: {
enabled: true, enabled: true,
modelPath: "faceres.json", modelPath: "faceres.json",
skipFrames: 13, skipFrames: 13,
skipTime: 2e3,
minConfidence: 0.1 minConfidence: 0.1
}, },
antispoof: { antispoof: {
enabled: false, enabled: false,
skipFrames: 14, skipFrames: 14,
skipTime: 2e3,
modelPath: "antispoof.json" modelPath: "antispoof.json"
} }
}, },
@ -185,12 +189,14 @@ var config = {
}, },
maxDetected: -1, maxDetected: -1,
minConfidence: 0.3, minConfidence: 0.3,
skipFrames: 1 skipFrames: 1,
skipTime: 2e3
}, },
hand: { hand: {
enabled: true, enabled: true,
rotation: true, rotation: true,
skipFrames: 2, skipFrames: 2,
skipTime: 2e3,
minConfidence: 0.5, minConfidence: 0.5,
iouThreshold: 0.2, iouThreshold: 0.2,
maxDetected: -1, maxDetected: -1,
@ -208,7 +214,8 @@ var config = {
minConfidence: 0.2, minConfidence: 0.2,
iouThreshold: 0.4, iouThreshold: 0.4,
maxDetected: 10, maxDetected: 10,
skipFrames: 15 skipFrames: 15,
skipTime: 2e3
}, },
segmentation: { segmentation: {
enabled: false, enabled: false,
@ -221,7 +228,6 @@ var config = {
var tfjs_esm_exports = {}; var tfjs_esm_exports = {};
__export(tfjs_esm_exports, { __export(tfjs_esm_exports, {
GraphModel: () => GraphModel, GraphModel: () => GraphModel,
OptimizerConstructors: () => OptimizerConstructors,
Tensor: () => Tensor, Tensor: () => Tensor,
version: () => version9 version: () => version9
}); });
@ -251,7 +257,6 @@ var version9 = {
"tfjs-backend-webgl": version7, "tfjs-backend-webgl": version7,
"tfjs-backend-wasm": version8 "tfjs-backend-wasm": version8
}; };
var OptimizerConstructors = {};
// src/image/imagefxshaders.ts // src/image/imagefxshaders.ts
var vertexIdentity = ` var vertexIdentity = `
@ -1299,6 +1304,7 @@ var model2;
var cached = []; var cached = [];
var skipped2 = Number.MAX_SAFE_INTEGER; var skipped2 = Number.MAX_SAFE_INTEGER;
var lastCount = 0; var lastCount = 0;
var last = 0;
async function load2(config3) { async function load2(config3) {
var _a, _b; var _a, _b;
if (env.initial) if (env.initial)
@ -1314,10 +1320,10 @@ async function load2(config3) {
return model2; return model2;
} }
async function predict(image25, config3, idx, count2) { async function predict(image25, config3, idx, count2) {
var _a; var _a, _b;
if (!model2) if (!model2)
return null; return null;
if (skipped2 < (((_a = config3.face.antispoof) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount === count2 && cached[idx]) { if (skipped2 < (((_a = config3.face.antispoof) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.antispoof) == null ? void 0 : _b.skipTime) || 0) <= now() - last && config3.skipFrame && lastCount === count2 && cached[idx]) {
skipped2++; skipped2++;
return cached[idx]; return cached[idx];
} }
@ -1328,6 +1334,7 @@ async function predict(image25, config3, idx, count2) {
const num = (await res.data())[0]; const num = (await res.data())[0];
cached[idx] = Math.round(100 * num) / 100; cached[idx] = Math.round(100 * num) / 100;
lastCount = count2; lastCount = count2;
last = now();
tfjs_esm_exports.dispose([resize, res]); tfjs_esm_exports.dispose([resize, res]);
resolve(cached[idx]); resolve(cached[idx]);
}); });
@ -4903,6 +4910,7 @@ var skipped3 = Number.MAX_SAFE_INTEGER;
var outputNodes; var outputNodes;
var cache = null; var cache = null;
var padding = [[0, 0], [0, 0], [0, 0], [0, 0]]; var padding = [[0, 0], [0, 0], [0, 0], [0, 0]];
var last2 = 0;
async function loadDetect(config3) { async function loadDetect(config3) {
var _a, _b, _c; var _a, _b, _c;
if (env3.initial) if (env3.initial)
@ -5019,10 +5027,11 @@ async function detectParts(input, config3, outputSize2) {
} }
async function predict2(input, config3) { async function predict2(input, config3) {
const outputSize2 = [input.shape[2] || 0, input.shape[1] || 0]; const outputSize2 = [input.shape[2] || 0, input.shape[1] || 0];
if (skipped3 < (config3.body.skipFrames || 0) && config3.skipFrame && cache !== null) { if (skipped3 < (config3.body.skipFrames || 0) && (config3.body.skipTime || 0) <= now() - last2 && config3.skipFrame && cache !== null) {
skipped3++; skipped3++;
} else { } else {
cache = await detectParts(input, config3, outputSize2); cache = await detectParts(input, config3, outputSize2);
last2 = now();
skipped3 = 0; skipped3 = 0;
} }
if (cache) if (cache)
@ -5117,7 +5126,8 @@ var labels = [
// src/object/centernet.ts // src/object/centernet.ts
var model4; var model4;
var inputSize3 = 0; var inputSize3 = 0;
var last = []; var last3 = [];
var lastTime = 0;
var skipped4 = Number.MAX_SAFE_INTEGER; var skipped4 = Number.MAX_SAFE_INTEGER;
async function load4(config3) { async function load4(config3) {
if (env.initial) if (env.initial)
@ -5182,20 +5192,21 @@ async function process3(res, outputShape, config3) {
return results; return results;
} }
async function predict3(input, config3) { async function predict3(input, config3) {
if (skipped4 < (config3.object.skipFrames || 0) && config3.skipFrame && last.length > 0) { if (skipped4 < (config3.object.skipFrames || 0) && (config3.object.skipTime || 0) <= now() - lastTime && config3.skipFrame && last3.length > 0) {
skipped4++; skipped4++;
return last; return last3;
} }
skipped4 = 0; skipped4 = 0;
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense")) if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
return last; return last3;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const outputSize2 = [input.shape[2], input.shape[1]]; const outputSize2 = [input.shape[2], input.shape[1]];
const resize = tfjs_esm_exports.image.resizeBilinear(input, [inputSize3, inputSize3]); const resize = tfjs_esm_exports.image.resizeBilinear(input, [inputSize3, inputSize3]);
const objectT = config3.object.enabled ? model4 == null ? void 0 : model4.execute(resize, ["tower_0/detections"]) : null; const objectT = config3.object.enabled ? model4 == null ? void 0 : model4.execute(resize, ["tower_0/detections"]) : null;
lastTime = now();
tfjs_esm_exports.dispose(resize); tfjs_esm_exports.dispose(resize);
const obj = await process3(objectT, outputSize2, config3); const obj = await process3(objectT, outputSize2, config3);
last = obj; last3 = obj;
resolve(obj); resolve(obj);
}); });
} }
@ -5235,6 +5246,7 @@ var connected2 = {
// src/body/efficientpose.ts // src/body/efficientpose.ts
var model5; var model5;
var last4 = 0;
var cache2 = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} }; var cache2 = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} };
var skipped5 = Number.MAX_SAFE_INTEGER; var skipped5 = Number.MAX_SAFE_INTEGER;
async function load5(config3) { async function load5(config3) {
@ -5267,7 +5279,7 @@ function max2d(inputs, minScore) {
} }
async function predict4(image25, config3) { async function predict4(image25, config3) {
var _a; var _a;
if (skipped5 < (((_a = config3.body) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && Object.keys(cache2.keypoints).length > 0) { if (skipped5 < (((_a = config3.body) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && Object.keys(cache2.keypoints).length > 0 && (config3.body.skipTime || 0) <= now() - last4) {
skipped5++; skipped5++;
return [cache2]; return [cache2];
} }
@ -5285,6 +5297,7 @@ async function predict4(image25, config3) {
let resT; let resT;
if (config3.body.enabled) if (config3.body.enabled)
resT = await (model5 == null ? void 0 : model5.predict(tensor3)); resT = await (model5 == null ? void 0 : model5.predict(tensor3));
last4 = now();
tfjs_esm_exports.dispose(tensor3); tfjs_esm_exports.dispose(tensor3);
if (resT) { if (resT) {
cache2.keypoints.length = 0; cache2.keypoints.length = 0;
@ -5345,8 +5358,9 @@ async function predict4(image25, config3) {
// src/gear/emotion.ts // src/gear/emotion.ts
var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"]; var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"];
var model6; var model6;
var last2 = []; var last5 = [];
var lastCount2 = 0; var lastCount2 = 0;
var lastTime2 = 0;
var skipped6 = Number.MAX_SAFE_INTEGER; var skipped6 = Number.MAX_SAFE_INTEGER;
var rgb = [0.2989, 0.587, 0.114]; var rgb = [0.2989, 0.587, 0.114];
async function load6(config3) { async function load6(config3) {
@ -5364,44 +5378,45 @@ async function load6(config3) {
return model6; return model6;
} }
async function predict5(image25, config3, idx, count2) { async function predict5(image25, config3, idx, count2) {
var _a; var _a, _b;
if (!model6) if (!model6)
return null; return null;
if (skipped6 < (((_a = config3.face.emotion) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount2 === count2 && last2[idx] && last2[idx].length > 0) { if (skipped6 < (((_a = config3.face.emotion) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.emotion) == null ? void 0 : _b.skipTime) || 0) <= now() - lastTime2 && config3.skipFrame && lastCount2 === count2 && last5[idx] && last5[idx].length > 0) {
skipped6++; skipped6++;
return last2[idx]; return last5[idx];
} }
skipped6 = 0; skipped6 = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
var _a2, _b; var _a2, _b2;
const resize = tfjs_esm_exports.image.resizeBilinear(image25, [(model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[2] : 0, (model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[1] : 0], false);
const [red, green, blue] = tfjs_esm_exports.split(resize, 3, 3);
tfjs_esm_exports.dispose(resize);
const redNorm = tfjs_esm_exports.mul(red, rgb[0]);
const greenNorm = tfjs_esm_exports.mul(green, rgb[1]);
const blueNorm = tfjs_esm_exports.mul(blue, rgb[2]);
tfjs_esm_exports.dispose(red);
tfjs_esm_exports.dispose(green);
tfjs_esm_exports.dispose(blue);
const grayscale = tfjs_esm_exports.addN([redNorm, greenNorm, blueNorm]);
tfjs_esm_exports.dispose(redNorm);
tfjs_esm_exports.dispose(greenNorm);
tfjs_esm_exports.dispose(blueNorm);
const normalize = tfjs_esm_exports.tidy(() => tfjs_esm_exports.mul(tfjs_esm_exports.sub(grayscale, 0.5), 2));
tfjs_esm_exports.dispose(grayscale);
const obj = []; const obj = [];
if ((_a2 = config3.face.emotion) == null ? void 0 : _a2.enabled) { if ((_a2 = config3.face.emotion) == null ? void 0 : _a2.enabled) {
const resize = tfjs_esm_exports.image.resizeBilinear(image25, [(model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[2] : 0, (model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[1] : 0], false);
const [red, green, blue] = tfjs_esm_exports.split(resize, 3, 3);
tfjs_esm_exports.dispose(resize);
const redNorm = tfjs_esm_exports.mul(red, rgb[0]);
const greenNorm = tfjs_esm_exports.mul(green, rgb[1]);
const blueNorm = tfjs_esm_exports.mul(blue, rgb[2]);
tfjs_esm_exports.dispose(red);
tfjs_esm_exports.dispose(green);
tfjs_esm_exports.dispose(blue);
const grayscale = tfjs_esm_exports.addN([redNorm, greenNorm, blueNorm]);
tfjs_esm_exports.dispose(redNorm);
tfjs_esm_exports.dispose(greenNorm);
tfjs_esm_exports.dispose(blueNorm);
const normalize = tfjs_esm_exports.tidy(() => tfjs_esm_exports.mul(tfjs_esm_exports.sub(grayscale, 0.5), 2));
tfjs_esm_exports.dispose(grayscale);
const emotionT = await (model6 == null ? void 0 : model6.predict(normalize)); const emotionT = await (model6 == null ? void 0 : model6.predict(normalize));
lastTime2 = now();
const data = await emotionT.data(); const data = await emotionT.data();
tfjs_esm_exports.dispose(emotionT); tfjs_esm_exports.dispose(emotionT);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (data[i] > (((_b = config3.face.emotion) == null ? void 0 : _b.minConfidence) || 0)) if (data[i] > (((_b2 = config3.face.emotion) == null ? void 0 : _b2.minConfidence) || 0))
obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] }); obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] });
} }
obj.sort((a, b) => b.score - a.score); obj.sort((a, b) => b.score - a.score);
tfjs_esm_exports.dispose(normalize);
} }
tfjs_esm_exports.dispose(normalize); last5[idx] = obj;
last2[idx] = obj;
lastCount2 = count2; lastCount2 = count2;
resolve(obj); resolve(obj);
}); });
@ -5544,11 +5559,13 @@ var boxCache = [];
var model8 = null; var model8 = null;
var inputSize5 = 0; var inputSize5 = 0;
var skipped7 = Number.MAX_SAFE_INTEGER; var skipped7 = Number.MAX_SAFE_INTEGER;
var lastTime3 = 0;
var detectedFaces = 0; var detectedFaces = 0;
async function predict6(input, config3) { async function predict6(input, config3) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
if (!config3.skipFrame || (detectedFaces !== ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || !((_b = config3.face.mesh) == null ? void 0 : _b.enabled)) && skipped7 > (((_c = config3.face.detector) == null ? void 0 : _c.skipFrames) || 0)) { if (!config3.skipFrame || (detectedFaces !== ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || !((_b = config3.face.mesh) == null ? void 0 : _b.enabled)) && (skipped7 > (((_c = config3.face.detector) == null ? void 0 : _c.skipFrames) || 0) && (((_d = config3.face.description) == null ? void 0 : _d.skipTime) || 0) <= now() - lastTime3)) {
const newBoxes2 = await getBoxes(input, config3); const newBoxes2 = await getBoxes(input, config3);
lastTime3 = now();
boxCache = []; boxCache = [];
for (const possible of newBoxes2.boxes) { for (const possible of newBoxes2.boxes) {
const startPoint = await possible.box.startPoint.data(); const startPoint = await possible.box.startPoint.data();
@ -5584,16 +5601,16 @@ async function predict6(input, config3) {
faceScore: 0, faceScore: 0,
annotations: {} annotations: {}
}; };
if (((_d = config3.face.detector) == null ? void 0 : _d.rotation) && ((_e = config3.face.mesh) == null ? void 0 : _e.enabled) && env.kernels.includes("rotatewithoffset")) { if (((_e = config3.face.detector) == null ? void 0 : _e.rotation) && ((_f = config3.face.mesh) == null ? void 0 : _f.enabled) && env.kernels.includes("rotatewithoffset")) {
[angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5); [angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5);
} else { } else {
rotationMatrix = IDENTITY_MATRIX; rotationMatrix = IDENTITY_MATRIX;
const cut = cutBoxFromImageAndResize({ startPoint: box4.startPoint, endPoint: box4.endPoint }, input, ((_f = config3.face.mesh) == null ? void 0 : _f.enabled) ? [inputSize5, inputSize5] : [size(), size()]); const cut = cutBoxFromImageAndResize({ startPoint: box4.startPoint, endPoint: box4.endPoint }, input, ((_g = config3.face.mesh) == null ? void 0 : _g.enabled) ? [inputSize5, inputSize5] : [size(), size()]);
face5.tensor = tfjs_esm_exports.div(cut, 255); face5.tensor = tfjs_esm_exports.div(cut, 255);
tfjs_esm_exports.dispose(cut); tfjs_esm_exports.dispose(cut);
} }
face5.boxScore = Math.round(100 * box4.confidence) / 100; face5.boxScore = Math.round(100 * box4.confidence) / 100;
if (!((_g = config3.face.mesh) == null ? void 0 : _g.enabled)) { if (!((_h = config3.face.mesh) == null ? void 0 : _h.enabled)) {
face5.box = getClampedBox(box4, input); face5.box = getClampedBox(box4, input);
face5.boxRaw = getRawBox(box4, input); face5.boxRaw = getRawBox(box4, input);
face5.score = Math.round(100 * box4.confidence || 0) / 100; face5.score = Math.round(100 * box4.confidence || 0) / 100;
@ -5616,17 +5633,17 @@ async function predict6(input, config3) {
let rawCoords = await coordsReshaped.array(); let rawCoords = await coordsReshaped.array();
tfjs_esm_exports.dispose(contourCoords); tfjs_esm_exports.dispose(contourCoords);
tfjs_esm_exports.dispose(coordsReshaped); tfjs_esm_exports.dispose(coordsReshaped);
if (faceConfidence < (((_h = config3.face.detector) == null ? void 0 : _h.minConfidence) || 1)) { if (faceConfidence < (((_i = config3.face.detector) == null ? void 0 : _i.minConfidence) || 1)) {
box4.confidence = faceConfidence; box4.confidence = faceConfidence;
} else { } else {
if ((_i = config3.face.iris) == null ? void 0 : _i.enabled) if ((_j = config3.face.iris) == null ? void 0 : _j.enabled)
rawCoords = await augmentIris(rawCoords, face5.tensor, config3, inputSize5); rawCoords = await augmentIris(rawCoords, face5.tensor, config3, inputSize5);
face5.mesh = transformRawCoords(rawCoords, box4, angle, rotationMatrix, inputSize5); face5.mesh = transformRawCoords(rawCoords, box4, angle, rotationMatrix, inputSize5);
face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input.shape[2] || 0), pt[1] / (input.shape[1] || 0), (pt[2] || 0) / inputSize5]); face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input.shape[2] || 0), pt[1] / (input.shape[1] || 0), (pt[2] || 0) / inputSize5]);
box4 = { ...enlargeBox(calculateLandmarksBoundingBox(face5.mesh), 1.5), confidence: box4.confidence }; box4 = { ...enlargeBox(calculateLandmarksBoundingBox(face5.mesh), 1.5), confidence: box4.confidence };
for (const key of Object.keys(meshAnnotations)) for (const key of Object.keys(meshAnnotations))
face5.annotations[key] = meshAnnotations[key].map((index) => face5.mesh[index]); face5.annotations[key] = meshAnnotations[key].map((index) => face5.mesh[index]);
if (((_j = config3.face.detector) == null ? void 0 : _j.rotation) && config3.face.mesh.enabled && ((_k = config3.face.description) == null ? void 0 : _k.enabled) && env.kernels.includes("rotatewithoffset")) { if (((_k = config3.face.detector) == null ? void 0 : _k.rotation) && config3.face.mesh.enabled && ((_l = config3.face.description) == null ? void 0 : _l.enabled) && env.kernels.includes("rotatewithoffset")) {
tfjs_esm_exports.dispose(face5.tensor); tfjs_esm_exports.dispose(face5.tensor);
[angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5); [angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5);
} }
@ -5640,7 +5657,7 @@ async function predict6(input, config3) {
faces.push(face5); faces.push(face5);
newBoxes.push(box4); newBoxes.push(box4);
} }
if ((_l = config3.face.mesh) == null ? void 0 : _l.enabled) if ((_m = config3.face.mesh) == null ? void 0 : _m.enabled)
boxCache = newBoxes.filter((a) => { boxCache = newBoxes.filter((a) => {
var _a2; var _a2;
return a.confidence > (((_a2 = config3.face.detector) == null ? void 0 : _a2.minConfidence) || 0); return a.confidence > (((_a2 = config3.face.detector) == null ? void 0 : _a2.minConfidence) || 0);
@ -5670,7 +5687,8 @@ var uvmap = UV468;
// src/face/faceres.ts // src/face/faceres.ts
var model9; var model9;
var last3 = []; var last6 = [];
var lastTime4 = 0;
var lastCount3 = 0; var lastCount3 = 0;
var skipped8 = Number.MAX_SAFE_INTEGER; var skipped8 = Number.MAX_SAFE_INTEGER;
async function load9(config3) { async function load9(config3) {
@ -5703,29 +5721,29 @@ function enhance(input) {
return image25; return image25;
} }
async function predict7(image25, config3, idx, count2) { async function predict7(image25, config3, idx, count2) {
var _a, _b, _c; var _a, _b, _c, _d;
if (!model9) if (!model9)
return null; return null;
if (skipped8 < (((_a = config3.face.description) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount3 === count2 && ((_b = last3[idx]) == null ? void 0 : _b.age) && ((_c = last3[idx]) == null ? void 0 : _c.age) > 0) { if (skipped8 < (((_a = config3.face.description) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.description) == null ? void 0 : _b.skipTime) || 0) <= now() - lastTime4 && config3.skipFrame && lastCount3 === count2 && ((_c = last6[idx]) == null ? void 0 : _c.age) && ((_d = last6[idx]) == null ? void 0 : _d.age) > 0) {
skipped8++; skipped8++;
return last3[idx]; return last6[idx];
} }
skipped8 = 0; skipped8 = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
var _a2, _b2; var _a2, _b2;
const enhanced = enhance(image25);
let resT;
const obj = { const obj = {
age: 0, age: 0,
gender: "unknown", gender: "unknown",
genderScore: 0, genderScore: 0,
descriptor: [] descriptor: []
}; };
if ((_a2 = config3.face.description) == null ? void 0 : _a2.enabled) if ((_a2 = config3.face.description) == null ? void 0 : _a2.enabled) {
resT = await (model9 == null ? void 0 : model9.predict(enhanced)); const enhanced = enhance(image25);
tfjs_esm_exports.dispose(enhanced); const resT = await (model9 == null ? void 0 : model9.predict(enhanced));
if (resT) { lastTime4 = now();
const gender = await resT.find((t) => t.shape[1] === 1).data(); tfjs_esm_exports.dispose(enhanced);
const genderT = await resT.find((t) => t.shape[1] === 1);
const gender = await genderT.data();
const confidence = Math.trunc(200 * Math.abs(gender[0] - 0.5)) / 100; const confidence = Math.trunc(200 * Math.abs(gender[0] - 0.5)) / 100;
if (confidence > (((_b2 = config3.face.description) == null ? void 0 : _b2.minConfidence) || 0)) { if (confidence > (((_b2 = config3.face.description) == null ? void 0 : _b2.minConfidence) || 0)) {
obj.gender = gender[0] <= 0.5 ? "female" : "male"; obj.gender = gender[0] <= 0.5 ? "female" : "male";
@ -5734,14 +5752,15 @@ async function predict7(image25, config3, idx, count2) {
const argmax = tfjs_esm_exports.argMax(resT.find((t) => t.shape[1] === 100), 1); const argmax = tfjs_esm_exports.argMax(resT.find((t) => t.shape[1] === 100), 1);
const age = (await argmax.data())[0]; const age = (await argmax.data())[0];
tfjs_esm_exports.dispose(argmax); tfjs_esm_exports.dispose(argmax);
const all2 = await resT.find((t) => t.shape[1] === 100).data(); const ageT = resT.find((t) => t.shape[1] === 100);
const all2 = await ageT.data();
obj.age = Math.round(all2[age - 1] > all2[age + 1] ? 10 * age - 100 * all2[age - 1] : 10 * age + 100 * all2[age + 1]) / 10; obj.age = Math.round(all2[age - 1] > all2[age + 1] ? 10 * age - 100 * all2[age - 1] : 10 * age + 100 * all2[age + 1]) / 10;
const desc = resT.find((t) => t.shape[1] === 1024); const desc = resT.find((t) => t.shape[1] === 1024);
const descriptor = await desc.data(); const descriptor = desc ? await desc.data() : [];
obj.descriptor = [...descriptor]; obj.descriptor = Array.from(descriptor);
resT.forEach((t) => tfjs_esm_exports.dispose(t)); resT.forEach((t) => tfjs_esm_exports.dispose(t));
} }
last3[idx] = obj; last6[idx] = obj;
lastCount3 = count2; lastCount3 = count2;
resolve(obj); resolve(obj);
}); });
@ -8888,6 +8907,7 @@ var handBoxEnlargeFactor = 1.65;
var palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2]; var palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2];
var palmLandmarksPalmBase = 0; var palmLandmarksPalmBase = 0;
var palmLandmarksMiddleFingerBase = 2; var palmLandmarksMiddleFingerBase = 2;
var lastTime5 = 0;
var HandPipeline = class { var HandPipeline = class {
constructor(handDetector, handPoseModel2) { constructor(handDetector, handPoseModel2) {
__publicField(this, "handDetector"); __publicField(this, "handDetector");
@ -8952,7 +8972,7 @@ var HandPipeline = class {
async estimateHands(image25, config3) { async estimateHands(image25, config3) {
let useFreshBox = false; let useFreshBox = false;
let boxes; let boxes;
if (this.skipped === 0 || this.skipped > config3.hand.skipFrames || !config3.hand.landmarks || !config3.skipFrame) { if (this.skipped === 0 || this.skipped > config3.hand.skipFrames && (config3.hand.skipTime || 0) <= now() - lastTime5 || !config3.hand.landmarks || !config3.skipFrame) {
boxes = await this.handDetector.estimateHandBounds(image25, config3); boxes = await this.handDetector.estimateHandBounds(image25, config3);
this.skipped = 0; this.skipped = 0;
} }
@ -8981,6 +9001,7 @@ var HandPipeline = class {
tfjs_esm_exports.dispose(croppedInput); tfjs_esm_exports.dispose(croppedInput);
tfjs_esm_exports.dispose(rotatedImage); tfjs_esm_exports.dispose(rotatedImage);
const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage); const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage);
lastTime5 = now();
tfjs_esm_exports.dispose(handImage); tfjs_esm_exports.dispose(handImage);
const confidence = (await confidenceT.data())[0]; const confidence = (await confidenceT.data())[0];
tfjs_esm_exports.dispose(confidenceT); tfjs_esm_exports.dispose(confidenceT);
@ -9549,6 +9570,7 @@ var boxExpandFact = 1.6;
var maxDetectorResolution = 512; var maxDetectorResolution = 512;
var detectorExpandFact = 1.4; var detectorExpandFact = 1.4;
var skipped9 = 0; var skipped9 = 0;
var lastTime6 = 0;
var outputSize = [0, 0]; var outputSize = [0, 0];
var cache3 = { var cache3 = {
boxes: [], boxes: [],
@ -9688,16 +9710,17 @@ async function predict9(input, config3) {
return []; return [];
outputSize = [input.shape[2] || 0, input.shape[1] || 0]; outputSize = [input.shape[2] || 0, input.shape[1] || 0];
skipped9++; skipped9++;
if (config3.skipFrame && skipped9 <= (config3.hand.skipFrames || 0)) { if (config3.skipFrame && skipped9 <= (config3.hand.skipFrames || 0) && (config3.hand.skipTime || 0) <= now() - lastTime6) {
return cache3.hands; return cache3.hands;
} }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
if (config3.skipFrame && cache3.hands.length === config3.hand.maxDetected) { if (config3.skipFrame && cache3.hands.length === config3.hand.maxDetected) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
} else if (config3.skipFrame && skipped9 < 3 * (config3.hand.skipFrames || 0) && cache3.hands.length > 0) { } else if (config3.skipFrame && skipped9 < 3 * (config3.hand.skipFrames || 0) && (config3.hand.skipTime || 0) <= 3 * (now() - lastTime6) && cache3.hands.length > 0) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
} else { } else {
cache3.boxes = await detectHands(input, config3); cache3.boxes = await detectHands(input, config3);
lastTime6 = now();
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
skipped9 = 0; skipped9 = 0;
} }
@ -9884,7 +9907,8 @@ var inputSize7 = 0;
var skipped10 = Number.MAX_SAFE_INTEGER; var skipped10 = Number.MAX_SAFE_INTEGER;
var cache5 = { var cache5 = {
boxes: [], boxes: [],
bodies: [] bodies: [],
last: 0
}; };
async function load11(config3) { async function load11(config3) {
if (env.initial) if (env.initial)
@ -9994,7 +10018,7 @@ async function predict10(input, config3) {
if (!config3.skipFrame) if (!config3.skipFrame)
cache5.boxes.length = 0; cache5.boxes.length = 0;
skipped10++; skipped10++;
if (config3.skipFrame && skipped10 <= (config3.body.skipFrames || 0)) { if (config3.skipFrame && (skipped10 <= (config3.body.skipFrames || 0) && (config3.body.skipTime || 0) <= now() - cache5.last)) {
return cache5.bodies; return cache5.bodies;
} }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
@ -10002,6 +10026,7 @@ async function predict10(input, config3) {
skipped10 = 0; skipped10 = 0;
t.input = padInput(input, inputSize7); t.input = padInput(input, inputSize7);
t.res = await (model10 == null ? void 0 : model10.predict(t.input)); t.res = await (model10 == null ? void 0 : model10.predict(t.input));
cache5.last = now();
const res = await t.res.array(); const res = await t.res.array();
cache5.bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]); cache5.bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]);
for (const body4 of cache5.bodies) { for (const body4 of cache5.bodies) {
@ -10015,7 +10040,8 @@ async function predict10(input, config3) {
// src/object/nanodet.ts // src/object/nanodet.ts
var model11; var model11;
var last4 = []; var last7 = [];
var lastTime7 = 0;
var skipped11 = Number.MAX_SAFE_INTEGER; var skipped11 = Number.MAX_SAFE_INTEGER;
var scaleBox = 2.5; var scaleBox = 2.5;
async function load12(config3) { async function load12(config3) {
@ -10095,13 +10121,13 @@ async function process4(res, inputSize8, outputShape, config3) {
return results; return results;
} }
async function predict11(image25, config3) { async function predict11(image25, config3) {
if (skipped11 < (config3.object.skipFrames || 0) && config3.skipFrame && last4.length > 0) { if (skipped11 < (config3.object.skipFrames || 0) && (config3.object.skipTime || 0) <= now() - lastTime7 && config3.skipFrame && last7.length > 0) {
skipped11++; skipped11++;
return last4; return last7;
} }
skipped11 = 0; skipped11 = 0;
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense")) if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
return last4; return last7;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const outputSize2 = [image25.shape[2], image25.shape[1]]; const outputSize2 = [image25.shape[2], image25.shape[1]];
const resize = tfjs_esm_exports.image.resizeBilinear(image25, [model11.inputSize, model11.inputSize], false); const resize = tfjs_esm_exports.image.resizeBilinear(image25, [model11.inputSize, model11.inputSize], false);
@ -10112,9 +10138,10 @@ async function predict11(image25, config3) {
let objectT; let objectT;
if (config3.object.enabled) if (config3.object.enabled)
objectT = await model11.predict(transpose); objectT = await model11.predict(transpose);
lastTime7 = now();
tfjs_esm_exports.dispose(transpose); tfjs_esm_exports.dispose(transpose);
const obj = await process4(objectT, model11.inputSize, outputSize2, config3); const obj = await process4(objectT, model11.inputSize, outputSize2, config3);
last4 = obj; last7 = obj;
resolve(obj); resolve(obj);
}); });
} }

File diff suppressed because one or more lines are too long

80905
dist/human.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1920
dist/human.js vendored

File diff suppressed because one or more lines are too long

165
dist/human.node-gpu.js vendored
View File

@ -184,6 +184,7 @@ var config = {
rotation: true, rotation: true,
maxDetected: 1, maxDetected: 1,
skipFrames: 11, skipFrames: 11,
skipTime: 2e3,
minConfidence: 0.2, minConfidence: 0.2,
iouThreshold: 0.1, iouThreshold: 0.1,
return: false return: false
@ -200,17 +201,20 @@ var config = {
enabled: true, enabled: true,
minConfidence: 0.1, minConfidence: 0.1,
skipFrames: 12, skipFrames: 12,
skipTime: 2e3,
modelPath: "emotion.json" modelPath: "emotion.json"
}, },
description: { description: {
enabled: true, enabled: true,
modelPath: "faceres.json", modelPath: "faceres.json",
skipFrames: 13, skipFrames: 13,
skipTime: 2e3,
minConfidence: 0.1 minConfidence: 0.1
}, },
antispoof: { antispoof: {
enabled: false, enabled: false,
skipFrames: 14, skipFrames: 14,
skipTime: 2e3,
modelPath: "antispoof.json" modelPath: "antispoof.json"
} }
}, },
@ -222,12 +226,14 @@ var config = {
}, },
maxDetected: -1, maxDetected: -1,
minConfidence: 0.3, minConfidence: 0.3,
skipFrames: 1 skipFrames: 1,
skipTime: 2e3
}, },
hand: { hand: {
enabled: true, enabled: true,
rotation: true, rotation: true,
skipFrames: 2, skipFrames: 2,
skipTime: 2e3,
minConfidence: 0.5, minConfidence: 0.5,
iouThreshold: 0.2, iouThreshold: 0.2,
maxDetected: -1, maxDetected: -1,
@ -245,7 +251,8 @@ var config = {
minConfidence: 0.2, minConfidence: 0.2,
iouThreshold: 0.4, iouThreshold: 0.4,
maxDetected: 10, maxDetected: 10,
skipFrames: 15 skipFrames: 15,
skipTime: 2e3
}, },
segmentation: { segmentation: {
enabled: false, enabled: false,
@ -1314,6 +1321,7 @@ var model2;
var cached = []; var cached = [];
var skipped2 = Number.MAX_SAFE_INTEGER; var skipped2 = Number.MAX_SAFE_INTEGER;
var lastCount = 0; var lastCount = 0;
var last = 0;
async function load2(config3) { async function load2(config3) {
var _a, _b; var _a, _b;
if (env.initial) if (env.initial)
@ -1329,10 +1337,10 @@ async function load2(config3) {
return model2; return model2;
} }
async function predict(image25, config3, idx, count2) { async function predict(image25, config3, idx, count2) {
var _a; var _a, _b;
if (!model2) if (!model2)
return null; return null;
if (skipped2 < (((_a = config3.face.antispoof) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount === count2 && cached[idx]) { if (skipped2 < (((_a = config3.face.antispoof) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.antispoof) == null ? void 0 : _b.skipTime) || 0) <= now() - last && config3.skipFrame && lastCount === count2 && cached[idx]) {
skipped2++; skipped2++;
return cached[idx]; return cached[idx];
} }
@ -1343,6 +1351,7 @@ async function predict(image25, config3, idx, count2) {
const num = (await res.data())[0]; const num = (await res.data())[0];
cached[idx] = Math.round(100 * num) / 100; cached[idx] = Math.round(100 * num) / 100;
lastCount = count2; lastCount = count2;
last = now();
tf4.dispose([resize, res]); tf4.dispose([resize, res]);
resolve(cached[idx]); resolve(cached[idx]);
}); });
@ -4927,6 +4936,7 @@ var skipped3 = Number.MAX_SAFE_INTEGER;
var outputNodes; var outputNodes;
var cache = null; var cache = null;
var padding = [[0, 0], [0, 0], [0, 0], [0, 0]]; var padding = [[0, 0], [0, 0], [0, 0], [0, 0]];
var last2 = 0;
async function loadDetect(config3) { async function loadDetect(config3) {
var _a, _b, _c; var _a, _b, _c;
if (env3.initial) if (env3.initial)
@ -5043,10 +5053,11 @@ async function detectParts(input, config3, outputSize2) {
} }
async function predict2(input, config3) { async function predict2(input, config3) {
const outputSize2 = [input.shape[2] || 0, input.shape[1] || 0]; const outputSize2 = [input.shape[2] || 0, input.shape[1] || 0];
if (skipped3 < (config3.body.skipFrames || 0) && config3.skipFrame && cache !== null) { if (skipped3 < (config3.body.skipFrames || 0) && (config3.body.skipTime || 0) <= now() - last2 && config3.skipFrame && cache !== null) {
skipped3++; skipped3++;
} else { } else {
cache = await detectParts(input, config3, outputSize2); cache = await detectParts(input, config3, outputSize2);
last2 = now();
skipped3 = 0; skipped3 = 0;
} }
if (cache) if (cache)
@ -5144,7 +5155,8 @@ var labels = [
// src/object/centernet.ts // src/object/centernet.ts
var model4; var model4;
var inputSize3 = 0; var inputSize3 = 0;
var last = []; var last3 = [];
var lastTime = 0;
var skipped4 = Number.MAX_SAFE_INTEGER; var skipped4 = Number.MAX_SAFE_INTEGER;
async function load4(config3) { async function load4(config3) {
if (env.initial) if (env.initial)
@ -5209,20 +5221,21 @@ async function process3(res, outputShape, config3) {
return results; return results;
} }
async function predict3(input, config3) { async function predict3(input, config3) {
if (skipped4 < (config3.object.skipFrames || 0) && config3.skipFrame && last.length > 0) { if (skipped4 < (config3.object.skipFrames || 0) && (config3.object.skipTime || 0) <= now() - lastTime && config3.skipFrame && last3.length > 0) {
skipped4++; skipped4++;
return last; return last3;
} }
skipped4 = 0; skipped4 = 0;
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense")) if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
return last; return last3;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const outputSize2 = [input.shape[2], input.shape[1]]; const outputSize2 = [input.shape[2], input.shape[1]];
const resize = tf8.image.resizeBilinear(input, [inputSize3, inputSize3]); const resize = tf8.image.resizeBilinear(input, [inputSize3, inputSize3]);
const objectT = config3.object.enabled ? model4 == null ? void 0 : model4.execute(resize, ["tower_0/detections"]) : null; const objectT = config3.object.enabled ? model4 == null ? void 0 : model4.execute(resize, ["tower_0/detections"]) : null;
lastTime = now();
tf8.dispose(resize); tf8.dispose(resize);
const obj = await process3(objectT, outputSize2, config3); const obj = await process3(objectT, outputSize2, config3);
last = obj; last3 = obj;
resolve(obj); resolve(obj);
}); });
} }
@ -5265,6 +5278,7 @@ var connected2 = {
// src/body/efficientpose.ts // src/body/efficientpose.ts
var model5; var model5;
var last4 = 0;
var cache2 = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} }; var cache2 = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} };
var skipped5 = Number.MAX_SAFE_INTEGER; var skipped5 = Number.MAX_SAFE_INTEGER;
async function load5(config3) { async function load5(config3) {
@ -5297,7 +5311,7 @@ function max2d(inputs, minScore) {
} }
async function predict4(image25, config3) { async function predict4(image25, config3) {
var _a; var _a;
if (skipped5 < (((_a = config3.body) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && Object.keys(cache2.keypoints).length > 0) { if (skipped5 < (((_a = config3.body) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && Object.keys(cache2.keypoints).length > 0 && (config3.body.skipTime || 0) <= now() - last4) {
skipped5++; skipped5++;
return [cache2]; return [cache2];
} }
@ -5315,6 +5329,7 @@ async function predict4(image25, config3) {
let resT; let resT;
if (config3.body.enabled) if (config3.body.enabled)
resT = await (model5 == null ? void 0 : model5.predict(tensor3)); resT = await (model5 == null ? void 0 : model5.predict(tensor3));
last4 = now();
tf9.dispose(tensor3); tf9.dispose(tensor3);
if (resT) { if (resT) {
cache2.keypoints.length = 0; cache2.keypoints.length = 0;
@ -5376,8 +5391,9 @@ async function predict4(image25, config3) {
var tf10 = __toModule(require_tfjs_esm()); var tf10 = __toModule(require_tfjs_esm());
var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"]; var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"];
var model6; var model6;
var last2 = []; var last5 = [];
var lastCount2 = 0; var lastCount2 = 0;
var lastTime2 = 0;
var skipped6 = Number.MAX_SAFE_INTEGER; var skipped6 = Number.MAX_SAFE_INTEGER;
var rgb = [0.2989, 0.587, 0.114]; var rgb = [0.2989, 0.587, 0.114];
async function load6(config3) { async function load6(config3) {
@ -5395,44 +5411,45 @@ async function load6(config3) {
return model6; return model6;
} }
async function predict5(image25, config3, idx, count2) { async function predict5(image25, config3, idx, count2) {
var _a; var _a, _b;
if (!model6) if (!model6)
return null; return null;
if (skipped6 < (((_a = config3.face.emotion) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount2 === count2 && last2[idx] && last2[idx].length > 0) { if (skipped6 < (((_a = config3.face.emotion) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.emotion) == null ? void 0 : _b.skipTime) || 0) <= now() - lastTime2 && config3.skipFrame && lastCount2 === count2 && last5[idx] && last5[idx].length > 0) {
skipped6++; skipped6++;
return last2[idx]; return last5[idx];
} }
skipped6 = 0; skipped6 = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
var _a2, _b; var _a2, _b2;
const resize = tf10.image.resizeBilinear(image25, [(model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[2] : 0, (model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[1] : 0], false);
const [red, green, blue] = tf10.split(resize, 3, 3);
tf10.dispose(resize);
const redNorm = tf10.mul(red, rgb[0]);
const greenNorm = tf10.mul(green, rgb[1]);
const blueNorm = tf10.mul(blue, rgb[2]);
tf10.dispose(red);
tf10.dispose(green);
tf10.dispose(blue);
const grayscale = tf10.addN([redNorm, greenNorm, blueNorm]);
tf10.dispose(redNorm);
tf10.dispose(greenNorm);
tf10.dispose(blueNorm);
const normalize = tf10.tidy(() => tf10.mul(tf10.sub(grayscale, 0.5), 2));
tf10.dispose(grayscale);
const obj = []; const obj = [];
if ((_a2 = config3.face.emotion) == null ? void 0 : _a2.enabled) { if ((_a2 = config3.face.emotion) == null ? void 0 : _a2.enabled) {
const resize = tf10.image.resizeBilinear(image25, [(model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[2] : 0, (model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[1] : 0], false);
const [red, green, blue] = tf10.split(resize, 3, 3);
tf10.dispose(resize);
const redNorm = tf10.mul(red, rgb[0]);
const greenNorm = tf10.mul(green, rgb[1]);
const blueNorm = tf10.mul(blue, rgb[2]);
tf10.dispose(red);
tf10.dispose(green);
tf10.dispose(blue);
const grayscale = tf10.addN([redNorm, greenNorm, blueNorm]);
tf10.dispose(redNorm);
tf10.dispose(greenNorm);
tf10.dispose(blueNorm);
const normalize = tf10.tidy(() => tf10.mul(tf10.sub(grayscale, 0.5), 2));
tf10.dispose(grayscale);
const emotionT = await (model6 == null ? void 0 : model6.predict(normalize)); const emotionT = await (model6 == null ? void 0 : model6.predict(normalize));
lastTime2 = now();
const data = await emotionT.data(); const data = await emotionT.data();
tf10.dispose(emotionT); tf10.dispose(emotionT);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (data[i] > (((_b = config3.face.emotion) == null ? void 0 : _b.minConfidence) || 0)) if (data[i] > (((_b2 = config3.face.emotion) == null ? void 0 : _b2.minConfidence) || 0))
obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] }); obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] });
} }
obj.sort((a, b) => b.score - a.score); obj.sort((a, b) => b.score - a.score);
tf10.dispose(normalize);
} }
tf10.dispose(normalize); last5[idx] = obj;
last2[idx] = obj;
lastCount2 = count2; lastCount2 = count2;
resolve(obj); resolve(obj);
}); });
@ -5579,11 +5596,13 @@ var boxCache = [];
var model8 = null; var model8 = null;
var inputSize5 = 0; var inputSize5 = 0;
var skipped7 = Number.MAX_SAFE_INTEGER; var skipped7 = Number.MAX_SAFE_INTEGER;
var lastTime3 = 0;
var detectedFaces = 0; var detectedFaces = 0;
async function predict6(input, config3) { async function predict6(input, config3) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
if (!config3.skipFrame || (detectedFaces !== ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || !((_b = config3.face.mesh) == null ? void 0 : _b.enabled)) && skipped7 > (((_c = config3.face.detector) == null ? void 0 : _c.skipFrames) || 0)) { if (!config3.skipFrame || (detectedFaces !== ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || !((_b = config3.face.mesh) == null ? void 0 : _b.enabled)) && (skipped7 > (((_c = config3.face.detector) == null ? void 0 : _c.skipFrames) || 0) && (((_d = config3.face.description) == null ? void 0 : _d.skipTime) || 0) <= now() - lastTime3)) {
const newBoxes2 = await getBoxes(input, config3); const newBoxes2 = await getBoxes(input, config3);
lastTime3 = now();
boxCache = []; boxCache = [];
for (const possible of newBoxes2.boxes) { for (const possible of newBoxes2.boxes) {
const startPoint = await possible.box.startPoint.data(); const startPoint = await possible.box.startPoint.data();
@ -5619,16 +5638,16 @@ async function predict6(input, config3) {
faceScore: 0, faceScore: 0,
annotations: {} annotations: {}
}; };
if (((_d = config3.face.detector) == null ? void 0 : _d.rotation) && ((_e = config3.face.mesh) == null ? void 0 : _e.enabled) && env.kernels.includes("rotatewithoffset")) { if (((_e = config3.face.detector) == null ? void 0 : _e.rotation) && ((_f = config3.face.mesh) == null ? void 0 : _f.enabled) && env.kernels.includes("rotatewithoffset")) {
[angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5); [angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5);
} else { } else {
rotationMatrix = IDENTITY_MATRIX; rotationMatrix = IDENTITY_MATRIX;
const cut = cutBoxFromImageAndResize({ startPoint: box4.startPoint, endPoint: box4.endPoint }, input, ((_f = config3.face.mesh) == null ? void 0 : _f.enabled) ? [inputSize5, inputSize5] : [size(), size()]); const cut = cutBoxFromImageAndResize({ startPoint: box4.startPoint, endPoint: box4.endPoint }, input, ((_g = config3.face.mesh) == null ? void 0 : _g.enabled) ? [inputSize5, inputSize5] : [size(), size()]);
face5.tensor = tf12.div(cut, 255); face5.tensor = tf12.div(cut, 255);
tf12.dispose(cut); tf12.dispose(cut);
} }
face5.boxScore = Math.round(100 * box4.confidence) / 100; face5.boxScore = Math.round(100 * box4.confidence) / 100;
if (!((_g = config3.face.mesh) == null ? void 0 : _g.enabled)) { if (!((_h = config3.face.mesh) == null ? void 0 : _h.enabled)) {
face5.box = getClampedBox(box4, input); face5.box = getClampedBox(box4, input);
face5.boxRaw = getRawBox(box4, input); face5.boxRaw = getRawBox(box4, input);
face5.score = Math.round(100 * box4.confidence || 0) / 100; face5.score = Math.round(100 * box4.confidence || 0) / 100;
@ -5651,17 +5670,17 @@ async function predict6(input, config3) {
let rawCoords = await coordsReshaped.array(); let rawCoords = await coordsReshaped.array();
tf12.dispose(contourCoords); tf12.dispose(contourCoords);
tf12.dispose(coordsReshaped); tf12.dispose(coordsReshaped);
if (faceConfidence < (((_h = config3.face.detector) == null ? void 0 : _h.minConfidence) || 1)) { if (faceConfidence < (((_i = config3.face.detector) == null ? void 0 : _i.minConfidence) || 1)) {
box4.confidence = faceConfidence; box4.confidence = faceConfidence;
} else { } else {
if ((_i = config3.face.iris) == null ? void 0 : _i.enabled) if ((_j = config3.face.iris) == null ? void 0 : _j.enabled)
rawCoords = await augmentIris(rawCoords, face5.tensor, config3, inputSize5); rawCoords = await augmentIris(rawCoords, face5.tensor, config3, inputSize5);
face5.mesh = transformRawCoords(rawCoords, box4, angle, rotationMatrix, inputSize5); face5.mesh = transformRawCoords(rawCoords, box4, angle, rotationMatrix, inputSize5);
face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input.shape[2] || 0), pt[1] / (input.shape[1] || 0), (pt[2] || 0) / inputSize5]); face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input.shape[2] || 0), pt[1] / (input.shape[1] || 0), (pt[2] || 0) / inputSize5]);
box4 = { ...enlargeBox(calculateLandmarksBoundingBox(face5.mesh), 1.5), confidence: box4.confidence }; box4 = { ...enlargeBox(calculateLandmarksBoundingBox(face5.mesh), 1.5), confidence: box4.confidence };
for (const key of Object.keys(meshAnnotations)) for (const key of Object.keys(meshAnnotations))
face5.annotations[key] = meshAnnotations[key].map((index) => face5.mesh[index]); face5.annotations[key] = meshAnnotations[key].map((index) => face5.mesh[index]);
if (((_j = config3.face.detector) == null ? void 0 : _j.rotation) && config3.face.mesh.enabled && ((_k = config3.face.description) == null ? void 0 : _k.enabled) && env.kernels.includes("rotatewithoffset")) { if (((_k = config3.face.detector) == null ? void 0 : _k.rotation) && config3.face.mesh.enabled && ((_l = config3.face.description) == null ? void 0 : _l.enabled) && env.kernels.includes("rotatewithoffset")) {
tf12.dispose(face5.tensor); tf12.dispose(face5.tensor);
[angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5); [angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5);
} }
@ -5675,7 +5694,7 @@ async function predict6(input, config3) {
faces.push(face5); faces.push(face5);
newBoxes.push(box4); newBoxes.push(box4);
} }
if ((_l = config3.face.mesh) == null ? void 0 : _l.enabled) if ((_m = config3.face.mesh) == null ? void 0 : _m.enabled)
boxCache = newBoxes.filter((a) => { boxCache = newBoxes.filter((a) => {
var _a2; var _a2;
return a.confidence > (((_a2 = config3.face.detector) == null ? void 0 : _a2.minConfidence) || 0); return a.confidence > (((_a2 = config3.face.detector) == null ? void 0 : _a2.minConfidence) || 0);
@ -5706,7 +5725,8 @@ var uvmap = UV468;
// src/face/faceres.ts // src/face/faceres.ts
var tf13 = __toModule(require_tfjs_esm()); var tf13 = __toModule(require_tfjs_esm());
var model9; var model9;
var last3 = []; var last6 = [];
var lastTime4 = 0;
var lastCount3 = 0; var lastCount3 = 0;
var skipped8 = Number.MAX_SAFE_INTEGER; var skipped8 = Number.MAX_SAFE_INTEGER;
async function load9(config3) { async function load9(config3) {
@ -5739,29 +5759,29 @@ function enhance(input) {
return image25; return image25;
} }
async function predict7(image25, config3, idx, count2) { async function predict7(image25, config3, idx, count2) {
var _a, _b, _c; var _a, _b, _c, _d;
if (!model9) if (!model9)
return null; return null;
if (skipped8 < (((_a = config3.face.description) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount3 === count2 && ((_b = last3[idx]) == null ? void 0 : _b.age) && ((_c = last3[idx]) == null ? void 0 : _c.age) > 0) { if (skipped8 < (((_a = config3.face.description) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.description) == null ? void 0 : _b.skipTime) || 0) <= now() - lastTime4 && config3.skipFrame && lastCount3 === count2 && ((_c = last6[idx]) == null ? void 0 : _c.age) && ((_d = last6[idx]) == null ? void 0 : _d.age) > 0) {
skipped8++; skipped8++;
return last3[idx]; return last6[idx];
} }
skipped8 = 0; skipped8 = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
var _a2, _b2; var _a2, _b2;
const enhanced = enhance(image25);
let resT;
const obj = { const obj = {
age: 0, age: 0,
gender: "unknown", gender: "unknown",
genderScore: 0, genderScore: 0,
descriptor: [] descriptor: []
}; };
if ((_a2 = config3.face.description) == null ? void 0 : _a2.enabled) if ((_a2 = config3.face.description) == null ? void 0 : _a2.enabled) {
resT = await (model9 == null ? void 0 : model9.predict(enhanced)); const enhanced = enhance(image25);
tf13.dispose(enhanced); const resT = await (model9 == null ? void 0 : model9.predict(enhanced));
if (resT) { lastTime4 = now();
const gender = await resT.find((t) => t.shape[1] === 1).data(); tf13.dispose(enhanced);
const genderT = await resT.find((t) => t.shape[1] === 1);
const gender = await genderT.data();
const confidence = Math.trunc(200 * Math.abs(gender[0] - 0.5)) / 100; const confidence = Math.trunc(200 * Math.abs(gender[0] - 0.5)) / 100;
if (confidence > (((_b2 = config3.face.description) == null ? void 0 : _b2.minConfidence) || 0)) { if (confidence > (((_b2 = config3.face.description) == null ? void 0 : _b2.minConfidence) || 0)) {
obj.gender = gender[0] <= 0.5 ? "female" : "male"; obj.gender = gender[0] <= 0.5 ? "female" : "male";
@ -5770,14 +5790,15 @@ async function predict7(image25, config3, idx, count2) {
const argmax = tf13.argMax(resT.find((t) => t.shape[1] === 100), 1); const argmax = tf13.argMax(resT.find((t) => t.shape[1] === 100), 1);
const age = (await argmax.data())[0]; const age = (await argmax.data())[0];
tf13.dispose(argmax); tf13.dispose(argmax);
const all2 = await resT.find((t) => t.shape[1] === 100).data(); const ageT = resT.find((t) => t.shape[1] === 100);
const all2 = await ageT.data();
obj.age = Math.round(all2[age - 1] > all2[age + 1] ? 10 * age - 100 * all2[age - 1] : 10 * age + 100 * all2[age + 1]) / 10; obj.age = Math.round(all2[age - 1] > all2[age + 1] ? 10 * age - 100 * all2[age - 1] : 10 * age + 100 * all2[age + 1]) / 10;
const desc = resT.find((t) => t.shape[1] === 1024); const desc = resT.find((t) => t.shape[1] === 1024);
const descriptor = await desc.data(); const descriptor = desc ? await desc.data() : [];
obj.descriptor = [...descriptor]; obj.descriptor = Array.from(descriptor);
resT.forEach((t) => tf13.dispose(t)); resT.forEach((t) => tf13.dispose(t));
} }
last3[idx] = obj; last6[idx] = obj;
lastCount3 = count2; lastCount3 = count2;
resolve(obj); resolve(obj);
}); });
@ -8932,6 +8953,7 @@ var handBoxEnlargeFactor = 1.65;
var palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2]; var palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2];
var palmLandmarksPalmBase = 0; var palmLandmarksPalmBase = 0;
var palmLandmarksMiddleFingerBase = 2; var palmLandmarksMiddleFingerBase = 2;
var lastTime5 = 0;
var HandPipeline = class { var HandPipeline = class {
constructor(handDetector, handPoseModel2) { constructor(handDetector, handPoseModel2) {
__publicField(this, "handDetector"); __publicField(this, "handDetector");
@ -8996,7 +9018,7 @@ var HandPipeline = class {
async estimateHands(image25, config3) { async estimateHands(image25, config3) {
let useFreshBox = false; let useFreshBox = false;
let boxes; let boxes;
if (this.skipped === 0 || this.skipped > config3.hand.skipFrames || !config3.hand.landmarks || !config3.skipFrame) { if (this.skipped === 0 || this.skipped > config3.hand.skipFrames && (config3.hand.skipTime || 0) <= now() - lastTime5 || !config3.hand.landmarks || !config3.skipFrame) {
boxes = await this.handDetector.estimateHandBounds(image25, config3); boxes = await this.handDetector.estimateHandBounds(image25, config3);
this.skipped = 0; this.skipped = 0;
} }
@ -9025,6 +9047,7 @@ var HandPipeline = class {
tf16.dispose(croppedInput); tf16.dispose(croppedInput);
tf16.dispose(rotatedImage); tf16.dispose(rotatedImage);
const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage); const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage);
lastTime5 = now();
tf16.dispose(handImage); tf16.dispose(handImage);
const confidence = (await confidenceT.data())[0]; const confidence = (await confidenceT.data())[0];
tf16.dispose(confidenceT); tf16.dispose(confidenceT);
@ -9594,6 +9617,7 @@ var boxExpandFact = 1.6;
var maxDetectorResolution = 512; var maxDetectorResolution = 512;
var detectorExpandFact = 1.4; var detectorExpandFact = 1.4;
var skipped9 = 0; var skipped9 = 0;
var lastTime6 = 0;
var outputSize = [0, 0]; var outputSize = [0, 0];
var cache3 = { var cache3 = {
boxes: [], boxes: [],
@ -9733,16 +9757,17 @@ async function predict9(input, config3) {
return []; return [];
outputSize = [input.shape[2] || 0, input.shape[1] || 0]; outputSize = [input.shape[2] || 0, input.shape[1] || 0];
skipped9++; skipped9++;
if (config3.skipFrame && skipped9 <= (config3.hand.skipFrames || 0)) { if (config3.skipFrame && skipped9 <= (config3.hand.skipFrames || 0) && (config3.hand.skipTime || 0) <= now() - lastTime6) {
return cache3.hands; return cache3.hands;
} }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
if (config3.skipFrame && cache3.hands.length === config3.hand.maxDetected) { if (config3.skipFrame && cache3.hands.length === config3.hand.maxDetected) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
} else if (config3.skipFrame && skipped9 < 3 * (config3.hand.skipFrames || 0) && cache3.hands.length > 0) { } else if (config3.skipFrame && skipped9 < 3 * (config3.hand.skipFrames || 0) && (config3.hand.skipTime || 0) <= 3 * (now() - lastTime6) && cache3.hands.length > 0) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
} else { } else {
cache3.boxes = await detectHands(input, config3); cache3.boxes = await detectHands(input, config3);
lastTime6 = now();
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
skipped9 = 0; skipped9 = 0;
} }
@ -9933,7 +9958,8 @@ var inputSize7 = 0;
var skipped10 = Number.MAX_SAFE_INTEGER; var skipped10 = Number.MAX_SAFE_INTEGER;
var cache5 = { var cache5 = {
boxes: [], boxes: [],
bodies: [] bodies: [],
last: 0
}; };
async function load11(config3) { async function load11(config3) {
if (env.initial) if (env.initial)
@ -10043,7 +10069,7 @@ async function predict10(input, config3) {
if (!config3.skipFrame) if (!config3.skipFrame)
cache5.boxes.length = 0; cache5.boxes.length = 0;
skipped10++; skipped10++;
if (config3.skipFrame && skipped10 <= (config3.body.skipFrames || 0)) { if (config3.skipFrame && (skipped10 <= (config3.body.skipFrames || 0) && (config3.body.skipTime || 0) <= now() - cache5.last)) {
return cache5.bodies; return cache5.bodies;
} }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
@ -10051,6 +10077,7 @@ async function predict10(input, config3) {
skipped10 = 0; skipped10 = 0;
t.input = padInput(input, inputSize7); t.input = padInput(input, inputSize7);
t.res = await (model10 == null ? void 0 : model10.predict(t.input)); t.res = await (model10 == null ? void 0 : model10.predict(t.input));
cache5.last = now();
const res = await t.res.array(); const res = await t.res.array();
cache5.bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]); cache5.bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]);
for (const body4 of cache5.bodies) { for (const body4 of cache5.bodies) {
@ -10065,7 +10092,8 @@ async function predict10(input, config3) {
// src/object/nanodet.ts // src/object/nanodet.ts
var tf21 = __toModule(require_tfjs_esm()); var tf21 = __toModule(require_tfjs_esm());
var model11; var model11;
var last4 = []; var last7 = [];
var lastTime7 = 0;
var skipped11 = Number.MAX_SAFE_INTEGER; var skipped11 = Number.MAX_SAFE_INTEGER;
var scaleBox = 2.5; var scaleBox = 2.5;
async function load12(config3) { async function load12(config3) {
@ -10145,13 +10173,13 @@ async function process4(res, inputSize8, outputShape, config3) {
return results; return results;
} }
async function predict11(image25, config3) { async function predict11(image25, config3) {
if (skipped11 < (config3.object.skipFrames || 0) && config3.skipFrame && last4.length > 0) { if (skipped11 < (config3.object.skipFrames || 0) && (config3.object.skipTime || 0) <= now() - lastTime7 && config3.skipFrame && last7.length > 0) {
skipped11++; skipped11++;
return last4; return last7;
} }
skipped11 = 0; skipped11 = 0;
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense")) if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
return last4; return last7;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const outputSize2 = [image25.shape[2], image25.shape[1]]; const outputSize2 = [image25.shape[2], image25.shape[1]];
const resize = tf21.image.resizeBilinear(image25, [model11.inputSize, model11.inputSize], false); const resize = tf21.image.resizeBilinear(image25, [model11.inputSize, model11.inputSize], false);
@ -10162,9 +10190,10 @@ async function predict11(image25, config3) {
let objectT; let objectT;
if (config3.object.enabled) if (config3.object.enabled)
objectT = await model11.predict(transpose); objectT = await model11.predict(transpose);
lastTime7 = now();
tf21.dispose(transpose); tf21.dispose(transpose);
const obj = await process4(objectT, model11.inputSize, outputSize2, config3); const obj = await process4(objectT, model11.inputSize, outputSize2, config3);
last4 = obj; last7 = obj;
resolve(obj); resolve(obj);
}); });
} }

View File

@ -185,6 +185,7 @@ var config = {
rotation: true, rotation: true,
maxDetected: 1, maxDetected: 1,
skipFrames: 11, skipFrames: 11,
skipTime: 2e3,
minConfidence: 0.2, minConfidence: 0.2,
iouThreshold: 0.1, iouThreshold: 0.1,
return: false return: false
@ -201,17 +202,20 @@ var config = {
enabled: true, enabled: true,
minConfidence: 0.1, minConfidence: 0.1,
skipFrames: 12, skipFrames: 12,
skipTime: 2e3,
modelPath: "emotion.json" modelPath: "emotion.json"
}, },
description: { description: {
enabled: true, enabled: true,
modelPath: "faceres.json", modelPath: "faceres.json",
skipFrames: 13, skipFrames: 13,
skipTime: 2e3,
minConfidence: 0.1 minConfidence: 0.1
}, },
antispoof: { antispoof: {
enabled: false, enabled: false,
skipFrames: 14, skipFrames: 14,
skipTime: 2e3,
modelPath: "antispoof.json" modelPath: "antispoof.json"
} }
}, },
@ -223,12 +227,14 @@ var config = {
}, },
maxDetected: -1, maxDetected: -1,
minConfidence: 0.3, minConfidence: 0.3,
skipFrames: 1 skipFrames: 1,
skipTime: 2e3
}, },
hand: { hand: {
enabled: true, enabled: true,
rotation: true, rotation: true,
skipFrames: 2, skipFrames: 2,
skipTime: 2e3,
minConfidence: 0.5, minConfidence: 0.5,
iouThreshold: 0.2, iouThreshold: 0.2,
maxDetected: -1, maxDetected: -1,
@ -246,7 +252,8 @@ var config = {
minConfidence: 0.2, minConfidence: 0.2,
iouThreshold: 0.4, iouThreshold: 0.4,
maxDetected: 10, maxDetected: 10,
skipFrames: 15 skipFrames: 15,
skipTime: 2e3
}, },
segmentation: { segmentation: {
enabled: false, enabled: false,
@ -1315,6 +1322,7 @@ var model2;
var cached = []; var cached = [];
var skipped2 = Number.MAX_SAFE_INTEGER; var skipped2 = Number.MAX_SAFE_INTEGER;
var lastCount = 0; var lastCount = 0;
var last = 0;
async function load2(config3) { async function load2(config3) {
var _a, _b; var _a, _b;
if (env.initial) if (env.initial)
@ -1330,10 +1338,10 @@ async function load2(config3) {
return model2; return model2;
} }
async function predict(image25, config3, idx, count2) { async function predict(image25, config3, idx, count2) {
var _a; var _a, _b;
if (!model2) if (!model2)
return null; return null;
if (skipped2 < (((_a = config3.face.antispoof) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount === count2 && cached[idx]) { if (skipped2 < (((_a = config3.face.antispoof) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.antispoof) == null ? void 0 : _b.skipTime) || 0) <= now() - last && config3.skipFrame && lastCount === count2 && cached[idx]) {
skipped2++; skipped2++;
return cached[idx]; return cached[idx];
} }
@ -1344,6 +1352,7 @@ async function predict(image25, config3, idx, count2) {
const num = (await res.data())[0]; const num = (await res.data())[0];
cached[idx] = Math.round(100 * num) / 100; cached[idx] = Math.round(100 * num) / 100;
lastCount = count2; lastCount = count2;
last = now();
tf4.dispose([resize, res]); tf4.dispose([resize, res]);
resolve(cached[idx]); resolve(cached[idx]);
}); });
@ -4928,6 +4937,7 @@ var skipped3 = Number.MAX_SAFE_INTEGER;
var outputNodes; var outputNodes;
var cache = null; var cache = null;
var padding = [[0, 0], [0, 0], [0, 0], [0, 0]]; var padding = [[0, 0], [0, 0], [0, 0], [0, 0]];
var last2 = 0;
async function loadDetect(config3) { async function loadDetect(config3) {
var _a, _b, _c; var _a, _b, _c;
if (env3.initial) if (env3.initial)
@ -5044,10 +5054,11 @@ async function detectParts(input, config3, outputSize2) {
} }
async function predict2(input, config3) { async function predict2(input, config3) {
const outputSize2 = [input.shape[2] || 0, input.shape[1] || 0]; const outputSize2 = [input.shape[2] || 0, input.shape[1] || 0];
if (skipped3 < (config3.body.skipFrames || 0) && config3.skipFrame && cache !== null) { if (skipped3 < (config3.body.skipFrames || 0) && (config3.body.skipTime || 0) <= now() - last2 && config3.skipFrame && cache !== null) {
skipped3++; skipped3++;
} else { } else {
cache = await detectParts(input, config3, outputSize2); cache = await detectParts(input, config3, outputSize2);
last2 = now();
skipped3 = 0; skipped3 = 0;
} }
if (cache) if (cache)
@ -5145,7 +5156,8 @@ var labels = [
// src/object/centernet.ts // src/object/centernet.ts
var model4; var model4;
var inputSize3 = 0; var inputSize3 = 0;
var last = []; var last3 = [];
var lastTime = 0;
var skipped4 = Number.MAX_SAFE_INTEGER; var skipped4 = Number.MAX_SAFE_INTEGER;
async function load4(config3) { async function load4(config3) {
if (env.initial) if (env.initial)
@ -5210,20 +5222,21 @@ async function process3(res, outputShape, config3) {
return results; return results;
} }
async function predict3(input, config3) { async function predict3(input, config3) {
if (skipped4 < (config3.object.skipFrames || 0) && config3.skipFrame && last.length > 0) { if (skipped4 < (config3.object.skipFrames || 0) && (config3.object.skipTime || 0) <= now() - lastTime && config3.skipFrame && last3.length > 0) {
skipped4++; skipped4++;
return last; return last3;
} }
skipped4 = 0; skipped4 = 0;
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense")) if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
return last; return last3;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const outputSize2 = [input.shape[2], input.shape[1]]; const outputSize2 = [input.shape[2], input.shape[1]];
const resize = tf8.image.resizeBilinear(input, [inputSize3, inputSize3]); const resize = tf8.image.resizeBilinear(input, [inputSize3, inputSize3]);
const objectT = config3.object.enabled ? model4 == null ? void 0 : model4.execute(resize, ["tower_0/detections"]) : null; const objectT = config3.object.enabled ? model4 == null ? void 0 : model4.execute(resize, ["tower_0/detections"]) : null;
lastTime = now();
tf8.dispose(resize); tf8.dispose(resize);
const obj = await process3(objectT, outputSize2, config3); const obj = await process3(objectT, outputSize2, config3);
last = obj; last3 = obj;
resolve(obj); resolve(obj);
}); });
} }
@ -5266,6 +5279,7 @@ var connected2 = {
// src/body/efficientpose.ts // src/body/efficientpose.ts
var model5; var model5;
var last4 = 0;
var cache2 = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} }; var cache2 = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} };
var skipped5 = Number.MAX_SAFE_INTEGER; var skipped5 = Number.MAX_SAFE_INTEGER;
async function load5(config3) { async function load5(config3) {
@ -5298,7 +5312,7 @@ function max2d(inputs, minScore) {
} }
async function predict4(image25, config3) { async function predict4(image25, config3) {
var _a; var _a;
if (skipped5 < (((_a = config3.body) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && Object.keys(cache2.keypoints).length > 0) { if (skipped5 < (((_a = config3.body) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && Object.keys(cache2.keypoints).length > 0 && (config3.body.skipTime || 0) <= now() - last4) {
skipped5++; skipped5++;
return [cache2]; return [cache2];
} }
@ -5316,6 +5330,7 @@ async function predict4(image25, config3) {
let resT; let resT;
if (config3.body.enabled) if (config3.body.enabled)
resT = await (model5 == null ? void 0 : model5.predict(tensor3)); resT = await (model5 == null ? void 0 : model5.predict(tensor3));
last4 = now();
tf9.dispose(tensor3); tf9.dispose(tensor3);
if (resT) { if (resT) {
cache2.keypoints.length = 0; cache2.keypoints.length = 0;
@ -5377,8 +5392,9 @@ async function predict4(image25, config3) {
var tf10 = __toModule(require_tfjs_esm()); var tf10 = __toModule(require_tfjs_esm());
var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"]; var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"];
var model6; var model6;
var last2 = []; var last5 = [];
var lastCount2 = 0; var lastCount2 = 0;
var lastTime2 = 0;
var skipped6 = Number.MAX_SAFE_INTEGER; var skipped6 = Number.MAX_SAFE_INTEGER;
var rgb = [0.2989, 0.587, 0.114]; var rgb = [0.2989, 0.587, 0.114];
async function load6(config3) { async function load6(config3) {
@ -5396,44 +5412,45 @@ async function load6(config3) {
return model6; return model6;
} }
async function predict5(image25, config3, idx, count2) { async function predict5(image25, config3, idx, count2) {
var _a; var _a, _b;
if (!model6) if (!model6)
return null; return null;
if (skipped6 < (((_a = config3.face.emotion) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount2 === count2 && last2[idx] && last2[idx].length > 0) { if (skipped6 < (((_a = config3.face.emotion) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.emotion) == null ? void 0 : _b.skipTime) || 0) <= now() - lastTime2 && config3.skipFrame && lastCount2 === count2 && last5[idx] && last5[idx].length > 0) {
skipped6++; skipped6++;
return last2[idx]; return last5[idx];
} }
skipped6 = 0; skipped6 = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
var _a2, _b; var _a2, _b2;
const resize = tf10.image.resizeBilinear(image25, [(model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[2] : 0, (model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[1] : 0], false);
const [red, green, blue] = tf10.split(resize, 3, 3);
tf10.dispose(resize);
const redNorm = tf10.mul(red, rgb[0]);
const greenNorm = tf10.mul(green, rgb[1]);
const blueNorm = tf10.mul(blue, rgb[2]);
tf10.dispose(red);
tf10.dispose(green);
tf10.dispose(blue);
const grayscale = tf10.addN([redNorm, greenNorm, blueNorm]);
tf10.dispose(redNorm);
tf10.dispose(greenNorm);
tf10.dispose(blueNorm);
const normalize = tf10.tidy(() => tf10.mul(tf10.sub(grayscale, 0.5), 2));
tf10.dispose(grayscale);
const obj = []; const obj = [];
if ((_a2 = config3.face.emotion) == null ? void 0 : _a2.enabled) { if ((_a2 = config3.face.emotion) == null ? void 0 : _a2.enabled) {
const resize = tf10.image.resizeBilinear(image25, [(model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[2] : 0, (model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[1] : 0], false);
const [red, green, blue] = tf10.split(resize, 3, 3);
tf10.dispose(resize);
const redNorm = tf10.mul(red, rgb[0]);
const greenNorm = tf10.mul(green, rgb[1]);
const blueNorm = tf10.mul(blue, rgb[2]);
tf10.dispose(red);
tf10.dispose(green);
tf10.dispose(blue);
const grayscale = tf10.addN([redNorm, greenNorm, blueNorm]);
tf10.dispose(redNorm);
tf10.dispose(greenNorm);
tf10.dispose(blueNorm);
const normalize = tf10.tidy(() => tf10.mul(tf10.sub(grayscale, 0.5), 2));
tf10.dispose(grayscale);
const emotionT = await (model6 == null ? void 0 : model6.predict(normalize)); const emotionT = await (model6 == null ? void 0 : model6.predict(normalize));
lastTime2 = now();
const data = await emotionT.data(); const data = await emotionT.data();
tf10.dispose(emotionT); tf10.dispose(emotionT);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (data[i] > (((_b = config3.face.emotion) == null ? void 0 : _b.minConfidence) || 0)) if (data[i] > (((_b2 = config3.face.emotion) == null ? void 0 : _b2.minConfidence) || 0))
obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] }); obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] });
} }
obj.sort((a, b) => b.score - a.score); obj.sort((a, b) => b.score - a.score);
tf10.dispose(normalize);
} }
tf10.dispose(normalize); last5[idx] = obj;
last2[idx] = obj;
lastCount2 = count2; lastCount2 = count2;
resolve(obj); resolve(obj);
}); });
@ -5580,11 +5597,13 @@ var boxCache = [];
var model8 = null; var model8 = null;
var inputSize5 = 0; var inputSize5 = 0;
var skipped7 = Number.MAX_SAFE_INTEGER; var skipped7 = Number.MAX_SAFE_INTEGER;
var lastTime3 = 0;
var detectedFaces = 0; var detectedFaces = 0;
async function predict6(input, config3) { async function predict6(input, config3) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
if (!config3.skipFrame || (detectedFaces !== ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || !((_b = config3.face.mesh) == null ? void 0 : _b.enabled)) && skipped7 > (((_c = config3.face.detector) == null ? void 0 : _c.skipFrames) || 0)) { if (!config3.skipFrame || (detectedFaces !== ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || !((_b = config3.face.mesh) == null ? void 0 : _b.enabled)) && (skipped7 > (((_c = config3.face.detector) == null ? void 0 : _c.skipFrames) || 0) && (((_d = config3.face.description) == null ? void 0 : _d.skipTime) || 0) <= now() - lastTime3)) {
const newBoxes2 = await getBoxes(input, config3); const newBoxes2 = await getBoxes(input, config3);
lastTime3 = now();
boxCache = []; boxCache = [];
for (const possible of newBoxes2.boxes) { for (const possible of newBoxes2.boxes) {
const startPoint = await possible.box.startPoint.data(); const startPoint = await possible.box.startPoint.data();
@ -5620,16 +5639,16 @@ async function predict6(input, config3) {
faceScore: 0, faceScore: 0,
annotations: {} annotations: {}
}; };
if (((_d = config3.face.detector) == null ? void 0 : _d.rotation) && ((_e = config3.face.mesh) == null ? void 0 : _e.enabled) && env.kernels.includes("rotatewithoffset")) { if (((_e = config3.face.detector) == null ? void 0 : _e.rotation) && ((_f = config3.face.mesh) == null ? void 0 : _f.enabled) && env.kernels.includes("rotatewithoffset")) {
[angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5); [angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5);
} else { } else {
rotationMatrix = IDENTITY_MATRIX; rotationMatrix = IDENTITY_MATRIX;
const cut = cutBoxFromImageAndResize({ startPoint: box4.startPoint, endPoint: box4.endPoint }, input, ((_f = config3.face.mesh) == null ? void 0 : _f.enabled) ? [inputSize5, inputSize5] : [size(), size()]); const cut = cutBoxFromImageAndResize({ startPoint: box4.startPoint, endPoint: box4.endPoint }, input, ((_g = config3.face.mesh) == null ? void 0 : _g.enabled) ? [inputSize5, inputSize5] : [size(), size()]);
face5.tensor = tf12.div(cut, 255); face5.tensor = tf12.div(cut, 255);
tf12.dispose(cut); tf12.dispose(cut);
} }
face5.boxScore = Math.round(100 * box4.confidence) / 100; face5.boxScore = Math.round(100 * box4.confidence) / 100;
if (!((_g = config3.face.mesh) == null ? void 0 : _g.enabled)) { if (!((_h = config3.face.mesh) == null ? void 0 : _h.enabled)) {
face5.box = getClampedBox(box4, input); face5.box = getClampedBox(box4, input);
face5.boxRaw = getRawBox(box4, input); face5.boxRaw = getRawBox(box4, input);
face5.score = Math.round(100 * box4.confidence || 0) / 100; face5.score = Math.round(100 * box4.confidence || 0) / 100;
@ -5652,17 +5671,17 @@ async function predict6(input, config3) {
let rawCoords = await coordsReshaped.array(); let rawCoords = await coordsReshaped.array();
tf12.dispose(contourCoords); tf12.dispose(contourCoords);
tf12.dispose(coordsReshaped); tf12.dispose(coordsReshaped);
if (faceConfidence < (((_h = config3.face.detector) == null ? void 0 : _h.minConfidence) || 1)) { if (faceConfidence < (((_i = config3.face.detector) == null ? void 0 : _i.minConfidence) || 1)) {
box4.confidence = faceConfidence; box4.confidence = faceConfidence;
} else { } else {
if ((_i = config3.face.iris) == null ? void 0 : _i.enabled) if ((_j = config3.face.iris) == null ? void 0 : _j.enabled)
rawCoords = await augmentIris(rawCoords, face5.tensor, config3, inputSize5); rawCoords = await augmentIris(rawCoords, face5.tensor, config3, inputSize5);
face5.mesh = transformRawCoords(rawCoords, box4, angle, rotationMatrix, inputSize5); face5.mesh = transformRawCoords(rawCoords, box4, angle, rotationMatrix, inputSize5);
face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input.shape[2] || 0), pt[1] / (input.shape[1] || 0), (pt[2] || 0) / inputSize5]); face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input.shape[2] || 0), pt[1] / (input.shape[1] || 0), (pt[2] || 0) / inputSize5]);
box4 = { ...enlargeBox(calculateLandmarksBoundingBox(face5.mesh), 1.5), confidence: box4.confidence }; box4 = { ...enlargeBox(calculateLandmarksBoundingBox(face5.mesh), 1.5), confidence: box4.confidence };
for (const key of Object.keys(meshAnnotations)) for (const key of Object.keys(meshAnnotations))
face5.annotations[key] = meshAnnotations[key].map((index) => face5.mesh[index]); face5.annotations[key] = meshAnnotations[key].map((index) => face5.mesh[index]);
if (((_j = config3.face.detector) == null ? void 0 : _j.rotation) && config3.face.mesh.enabled && ((_k = config3.face.description) == null ? void 0 : _k.enabled) && env.kernels.includes("rotatewithoffset")) { if (((_k = config3.face.detector) == null ? void 0 : _k.rotation) && config3.face.mesh.enabled && ((_l = config3.face.description) == null ? void 0 : _l.enabled) && env.kernels.includes("rotatewithoffset")) {
tf12.dispose(face5.tensor); tf12.dispose(face5.tensor);
[angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5); [angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5);
} }
@ -5676,7 +5695,7 @@ async function predict6(input, config3) {
faces.push(face5); faces.push(face5);
newBoxes.push(box4); newBoxes.push(box4);
} }
if ((_l = config3.face.mesh) == null ? void 0 : _l.enabled) if ((_m = config3.face.mesh) == null ? void 0 : _m.enabled)
boxCache = newBoxes.filter((a) => { boxCache = newBoxes.filter((a) => {
var _a2; var _a2;
return a.confidence > (((_a2 = config3.face.detector) == null ? void 0 : _a2.minConfidence) || 0); return a.confidence > (((_a2 = config3.face.detector) == null ? void 0 : _a2.minConfidence) || 0);
@ -5707,7 +5726,8 @@ var uvmap = UV468;
// src/face/faceres.ts // src/face/faceres.ts
var tf13 = __toModule(require_tfjs_esm()); var tf13 = __toModule(require_tfjs_esm());
var model9; var model9;
var last3 = []; var last6 = [];
var lastTime4 = 0;
var lastCount3 = 0; var lastCount3 = 0;
var skipped8 = Number.MAX_SAFE_INTEGER; var skipped8 = Number.MAX_SAFE_INTEGER;
async function load9(config3) { async function load9(config3) {
@ -5740,29 +5760,29 @@ function enhance(input) {
return image25; return image25;
} }
async function predict7(image25, config3, idx, count2) { async function predict7(image25, config3, idx, count2) {
var _a, _b, _c; var _a, _b, _c, _d;
if (!model9) if (!model9)
return null; return null;
if (skipped8 < (((_a = config3.face.description) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount3 === count2 && ((_b = last3[idx]) == null ? void 0 : _b.age) && ((_c = last3[idx]) == null ? void 0 : _c.age) > 0) { if (skipped8 < (((_a = config3.face.description) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.description) == null ? void 0 : _b.skipTime) || 0) <= now() - lastTime4 && config3.skipFrame && lastCount3 === count2 && ((_c = last6[idx]) == null ? void 0 : _c.age) && ((_d = last6[idx]) == null ? void 0 : _d.age) > 0) {
skipped8++; skipped8++;
return last3[idx]; return last6[idx];
} }
skipped8 = 0; skipped8 = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
var _a2, _b2; var _a2, _b2;
const enhanced = enhance(image25);
let resT;
const obj = { const obj = {
age: 0, age: 0,
gender: "unknown", gender: "unknown",
genderScore: 0, genderScore: 0,
descriptor: [] descriptor: []
}; };
if ((_a2 = config3.face.description) == null ? void 0 : _a2.enabled) if ((_a2 = config3.face.description) == null ? void 0 : _a2.enabled) {
resT = await (model9 == null ? void 0 : model9.predict(enhanced)); const enhanced = enhance(image25);
tf13.dispose(enhanced); const resT = await (model9 == null ? void 0 : model9.predict(enhanced));
if (resT) { lastTime4 = now();
const gender = await resT.find((t) => t.shape[1] === 1).data(); tf13.dispose(enhanced);
const genderT = await resT.find((t) => t.shape[1] === 1);
const gender = await genderT.data();
const confidence = Math.trunc(200 * Math.abs(gender[0] - 0.5)) / 100; const confidence = Math.trunc(200 * Math.abs(gender[0] - 0.5)) / 100;
if (confidence > (((_b2 = config3.face.description) == null ? void 0 : _b2.minConfidence) || 0)) { if (confidence > (((_b2 = config3.face.description) == null ? void 0 : _b2.minConfidence) || 0)) {
obj.gender = gender[0] <= 0.5 ? "female" : "male"; obj.gender = gender[0] <= 0.5 ? "female" : "male";
@ -5771,14 +5791,15 @@ async function predict7(image25, config3, idx, count2) {
const argmax = tf13.argMax(resT.find((t) => t.shape[1] === 100), 1); const argmax = tf13.argMax(resT.find((t) => t.shape[1] === 100), 1);
const age = (await argmax.data())[0]; const age = (await argmax.data())[0];
tf13.dispose(argmax); tf13.dispose(argmax);
const all2 = await resT.find((t) => t.shape[1] === 100).data(); const ageT = resT.find((t) => t.shape[1] === 100);
const all2 = await ageT.data();
obj.age = Math.round(all2[age - 1] > all2[age + 1] ? 10 * age - 100 * all2[age - 1] : 10 * age + 100 * all2[age + 1]) / 10; obj.age = Math.round(all2[age - 1] > all2[age + 1] ? 10 * age - 100 * all2[age - 1] : 10 * age + 100 * all2[age + 1]) / 10;
const desc = resT.find((t) => t.shape[1] === 1024); const desc = resT.find((t) => t.shape[1] === 1024);
const descriptor = await desc.data(); const descriptor = desc ? await desc.data() : [];
obj.descriptor = [...descriptor]; obj.descriptor = Array.from(descriptor);
resT.forEach((t) => tf13.dispose(t)); resT.forEach((t) => tf13.dispose(t));
} }
last3[idx] = obj; last6[idx] = obj;
lastCount3 = count2; lastCount3 = count2;
resolve(obj); resolve(obj);
}); });
@ -8933,6 +8954,7 @@ var handBoxEnlargeFactor = 1.65;
var palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2]; var palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2];
var palmLandmarksPalmBase = 0; var palmLandmarksPalmBase = 0;
var palmLandmarksMiddleFingerBase = 2; var palmLandmarksMiddleFingerBase = 2;
var lastTime5 = 0;
var HandPipeline = class { var HandPipeline = class {
constructor(handDetector, handPoseModel2) { constructor(handDetector, handPoseModel2) {
__publicField(this, "handDetector"); __publicField(this, "handDetector");
@ -8997,7 +9019,7 @@ var HandPipeline = class {
async estimateHands(image25, config3) { async estimateHands(image25, config3) {
let useFreshBox = false; let useFreshBox = false;
let boxes; let boxes;
if (this.skipped === 0 || this.skipped > config3.hand.skipFrames || !config3.hand.landmarks || !config3.skipFrame) { if (this.skipped === 0 || this.skipped > config3.hand.skipFrames && (config3.hand.skipTime || 0) <= now() - lastTime5 || !config3.hand.landmarks || !config3.skipFrame) {
boxes = await this.handDetector.estimateHandBounds(image25, config3); boxes = await this.handDetector.estimateHandBounds(image25, config3);
this.skipped = 0; this.skipped = 0;
} }
@ -9026,6 +9048,7 @@ var HandPipeline = class {
tf16.dispose(croppedInput); tf16.dispose(croppedInput);
tf16.dispose(rotatedImage); tf16.dispose(rotatedImage);
const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage); const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage);
lastTime5 = now();
tf16.dispose(handImage); tf16.dispose(handImage);
const confidence = (await confidenceT.data())[0]; const confidence = (await confidenceT.data())[0];
tf16.dispose(confidenceT); tf16.dispose(confidenceT);
@ -9595,6 +9618,7 @@ var boxExpandFact = 1.6;
var maxDetectorResolution = 512; var maxDetectorResolution = 512;
var detectorExpandFact = 1.4; var detectorExpandFact = 1.4;
var skipped9 = 0; var skipped9 = 0;
var lastTime6 = 0;
var outputSize = [0, 0]; var outputSize = [0, 0];
var cache3 = { var cache3 = {
boxes: [], boxes: [],
@ -9734,16 +9758,17 @@ async function predict9(input, config3) {
return []; return [];
outputSize = [input.shape[2] || 0, input.shape[1] || 0]; outputSize = [input.shape[2] || 0, input.shape[1] || 0];
skipped9++; skipped9++;
if (config3.skipFrame && skipped9 <= (config3.hand.skipFrames || 0)) { if (config3.skipFrame && skipped9 <= (config3.hand.skipFrames || 0) && (config3.hand.skipTime || 0) <= now() - lastTime6) {
return cache3.hands; return cache3.hands;
} }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
if (config3.skipFrame && cache3.hands.length === config3.hand.maxDetected) { if (config3.skipFrame && cache3.hands.length === config3.hand.maxDetected) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
} else if (config3.skipFrame && skipped9 < 3 * (config3.hand.skipFrames || 0) && cache3.hands.length > 0) { } else if (config3.skipFrame && skipped9 < 3 * (config3.hand.skipFrames || 0) && (config3.hand.skipTime || 0) <= 3 * (now() - lastTime6) && cache3.hands.length > 0) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
} else { } else {
cache3.boxes = await detectHands(input, config3); cache3.boxes = await detectHands(input, config3);
lastTime6 = now();
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
skipped9 = 0; skipped9 = 0;
} }
@ -9934,7 +9959,8 @@ var inputSize7 = 0;
var skipped10 = Number.MAX_SAFE_INTEGER; var skipped10 = Number.MAX_SAFE_INTEGER;
var cache5 = { var cache5 = {
boxes: [], boxes: [],
bodies: [] bodies: [],
last: 0
}; };
async function load11(config3) { async function load11(config3) {
if (env.initial) if (env.initial)
@ -10044,7 +10070,7 @@ async function predict10(input, config3) {
if (!config3.skipFrame) if (!config3.skipFrame)
cache5.boxes.length = 0; cache5.boxes.length = 0;
skipped10++; skipped10++;
if (config3.skipFrame && skipped10 <= (config3.body.skipFrames || 0)) { if (config3.skipFrame && (skipped10 <= (config3.body.skipFrames || 0) && (config3.body.skipTime || 0) <= now() - cache5.last)) {
return cache5.bodies; return cache5.bodies;
} }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
@ -10052,6 +10078,7 @@ async function predict10(input, config3) {
skipped10 = 0; skipped10 = 0;
t.input = padInput(input, inputSize7); t.input = padInput(input, inputSize7);
t.res = await (model10 == null ? void 0 : model10.predict(t.input)); t.res = await (model10 == null ? void 0 : model10.predict(t.input));
cache5.last = now();
const res = await t.res.array(); const res = await t.res.array();
cache5.bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]); cache5.bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]);
for (const body4 of cache5.bodies) { for (const body4 of cache5.bodies) {
@ -10066,7 +10093,8 @@ async function predict10(input, config3) {
// src/object/nanodet.ts // src/object/nanodet.ts
var tf21 = __toModule(require_tfjs_esm()); var tf21 = __toModule(require_tfjs_esm());
var model11; var model11;
var last4 = []; var last7 = [];
var lastTime7 = 0;
var skipped11 = Number.MAX_SAFE_INTEGER; var skipped11 = Number.MAX_SAFE_INTEGER;
var scaleBox = 2.5; var scaleBox = 2.5;
async function load12(config3) { async function load12(config3) {
@ -10146,13 +10174,13 @@ async function process4(res, inputSize8, outputShape, config3) {
return results; return results;
} }
async function predict11(image25, config3) { async function predict11(image25, config3) {
if (skipped11 < (config3.object.skipFrames || 0) && config3.skipFrame && last4.length > 0) { if (skipped11 < (config3.object.skipFrames || 0) && (config3.object.skipTime || 0) <= now() - lastTime7 && config3.skipFrame && last7.length > 0) {
skipped11++; skipped11++;
return last4; return last7;
} }
skipped11 = 0; skipped11 = 0;
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense")) if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
return last4; return last7;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const outputSize2 = [image25.shape[2], image25.shape[1]]; const outputSize2 = [image25.shape[2], image25.shape[1]];
const resize = tf21.image.resizeBilinear(image25, [model11.inputSize, model11.inputSize], false); const resize = tf21.image.resizeBilinear(image25, [model11.inputSize, model11.inputSize], false);
@ -10163,9 +10191,10 @@ async function predict11(image25, config3) {
let objectT; let objectT;
if (config3.object.enabled) if (config3.object.enabled)
objectT = await model11.predict(transpose); objectT = await model11.predict(transpose);
lastTime7 = now();
tf21.dispose(transpose); tf21.dispose(transpose);
const obj = await process4(objectT, model11.inputSize, outputSize2, config3); const obj = await process4(objectT, model11.inputSize, outputSize2, config3);
last4 = obj; last7 = obj;
resolve(obj); resolve(obj);
}); });
} }

165
dist/human.node.js vendored
View File

@ -184,6 +184,7 @@ var config = {
rotation: true, rotation: true,
maxDetected: 1, maxDetected: 1,
skipFrames: 11, skipFrames: 11,
skipTime: 2e3,
minConfidence: 0.2, minConfidence: 0.2,
iouThreshold: 0.1, iouThreshold: 0.1,
return: false return: false
@ -200,17 +201,20 @@ var config = {
enabled: true, enabled: true,
minConfidence: 0.1, minConfidence: 0.1,
skipFrames: 12, skipFrames: 12,
skipTime: 2e3,
modelPath: "emotion.json" modelPath: "emotion.json"
}, },
description: { description: {
enabled: true, enabled: true,
modelPath: "faceres.json", modelPath: "faceres.json",
skipFrames: 13, skipFrames: 13,
skipTime: 2e3,
minConfidence: 0.1 minConfidence: 0.1
}, },
antispoof: { antispoof: {
enabled: false, enabled: false,
skipFrames: 14, skipFrames: 14,
skipTime: 2e3,
modelPath: "antispoof.json" modelPath: "antispoof.json"
} }
}, },
@ -222,12 +226,14 @@ var config = {
}, },
maxDetected: -1, maxDetected: -1,
minConfidence: 0.3, minConfidence: 0.3,
skipFrames: 1 skipFrames: 1,
skipTime: 2e3
}, },
hand: { hand: {
enabled: true, enabled: true,
rotation: true, rotation: true,
skipFrames: 2, skipFrames: 2,
skipTime: 2e3,
minConfidence: 0.5, minConfidence: 0.5,
iouThreshold: 0.2, iouThreshold: 0.2,
maxDetected: -1, maxDetected: -1,
@ -245,7 +251,8 @@ var config = {
minConfidence: 0.2, minConfidence: 0.2,
iouThreshold: 0.4, iouThreshold: 0.4,
maxDetected: 10, maxDetected: 10,
skipFrames: 15 skipFrames: 15,
skipTime: 2e3
}, },
segmentation: { segmentation: {
enabled: false, enabled: false,
@ -1314,6 +1321,7 @@ var model2;
var cached = []; var cached = [];
var skipped2 = Number.MAX_SAFE_INTEGER; var skipped2 = Number.MAX_SAFE_INTEGER;
var lastCount = 0; var lastCount = 0;
var last = 0;
async function load2(config3) { async function load2(config3) {
var _a, _b; var _a, _b;
if (env.initial) if (env.initial)
@ -1329,10 +1337,10 @@ async function load2(config3) {
return model2; return model2;
} }
async function predict(image25, config3, idx, count2) { async function predict(image25, config3, idx, count2) {
var _a; var _a, _b;
if (!model2) if (!model2)
return null; return null;
if (skipped2 < (((_a = config3.face.antispoof) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount === count2 && cached[idx]) { if (skipped2 < (((_a = config3.face.antispoof) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.antispoof) == null ? void 0 : _b.skipTime) || 0) <= now() - last && config3.skipFrame && lastCount === count2 && cached[idx]) {
skipped2++; skipped2++;
return cached[idx]; return cached[idx];
} }
@ -1343,6 +1351,7 @@ async function predict(image25, config3, idx, count2) {
const num = (await res.data())[0]; const num = (await res.data())[0];
cached[idx] = Math.round(100 * num) / 100; cached[idx] = Math.round(100 * num) / 100;
lastCount = count2; lastCount = count2;
last = now();
tf4.dispose([resize, res]); tf4.dispose([resize, res]);
resolve(cached[idx]); resolve(cached[idx]);
}); });
@ -4927,6 +4936,7 @@ var skipped3 = Number.MAX_SAFE_INTEGER;
var outputNodes; var outputNodes;
var cache = null; var cache = null;
var padding = [[0, 0], [0, 0], [0, 0], [0, 0]]; var padding = [[0, 0], [0, 0], [0, 0], [0, 0]];
var last2 = 0;
async function loadDetect(config3) { async function loadDetect(config3) {
var _a, _b, _c; var _a, _b, _c;
if (env3.initial) if (env3.initial)
@ -5043,10 +5053,11 @@ async function detectParts(input, config3, outputSize2) {
} }
async function predict2(input, config3) { async function predict2(input, config3) {
const outputSize2 = [input.shape[2] || 0, input.shape[1] || 0]; const outputSize2 = [input.shape[2] || 0, input.shape[1] || 0];
if (skipped3 < (config3.body.skipFrames || 0) && config3.skipFrame && cache !== null) { if (skipped3 < (config3.body.skipFrames || 0) && (config3.body.skipTime || 0) <= now() - last2 && config3.skipFrame && cache !== null) {
skipped3++; skipped3++;
} else { } else {
cache = await detectParts(input, config3, outputSize2); cache = await detectParts(input, config3, outputSize2);
last2 = now();
skipped3 = 0; skipped3 = 0;
} }
if (cache) if (cache)
@ -5144,7 +5155,8 @@ var labels = [
// src/object/centernet.ts // src/object/centernet.ts
var model4; var model4;
var inputSize3 = 0; var inputSize3 = 0;
var last = []; var last3 = [];
var lastTime = 0;
var skipped4 = Number.MAX_SAFE_INTEGER; var skipped4 = Number.MAX_SAFE_INTEGER;
async function load4(config3) { async function load4(config3) {
if (env.initial) if (env.initial)
@ -5209,20 +5221,21 @@ async function process3(res, outputShape, config3) {
return results; return results;
} }
async function predict3(input, config3) { async function predict3(input, config3) {
if (skipped4 < (config3.object.skipFrames || 0) && config3.skipFrame && last.length > 0) { if (skipped4 < (config3.object.skipFrames || 0) && (config3.object.skipTime || 0) <= now() - lastTime && config3.skipFrame && last3.length > 0) {
skipped4++; skipped4++;
return last; return last3;
} }
skipped4 = 0; skipped4 = 0;
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense")) if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
return last; return last3;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const outputSize2 = [input.shape[2], input.shape[1]]; const outputSize2 = [input.shape[2], input.shape[1]];
const resize = tf8.image.resizeBilinear(input, [inputSize3, inputSize3]); const resize = tf8.image.resizeBilinear(input, [inputSize3, inputSize3]);
const objectT = config3.object.enabled ? model4 == null ? void 0 : model4.execute(resize, ["tower_0/detections"]) : null; const objectT = config3.object.enabled ? model4 == null ? void 0 : model4.execute(resize, ["tower_0/detections"]) : null;
lastTime = now();
tf8.dispose(resize); tf8.dispose(resize);
const obj = await process3(objectT, outputSize2, config3); const obj = await process3(objectT, outputSize2, config3);
last = obj; last3 = obj;
resolve(obj); resolve(obj);
}); });
} }
@ -5265,6 +5278,7 @@ var connected2 = {
// src/body/efficientpose.ts // src/body/efficientpose.ts
var model5; var model5;
var last4 = 0;
var cache2 = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} }; var cache2 = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} };
var skipped5 = Number.MAX_SAFE_INTEGER; var skipped5 = Number.MAX_SAFE_INTEGER;
async function load5(config3) { async function load5(config3) {
@ -5297,7 +5311,7 @@ function max2d(inputs, minScore) {
} }
async function predict4(image25, config3) { async function predict4(image25, config3) {
var _a; var _a;
if (skipped5 < (((_a = config3.body) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && Object.keys(cache2.keypoints).length > 0) { if (skipped5 < (((_a = config3.body) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && Object.keys(cache2.keypoints).length > 0 && (config3.body.skipTime || 0) <= now() - last4) {
skipped5++; skipped5++;
return [cache2]; return [cache2];
} }
@ -5315,6 +5329,7 @@ async function predict4(image25, config3) {
let resT; let resT;
if (config3.body.enabled) if (config3.body.enabled)
resT = await (model5 == null ? void 0 : model5.predict(tensor3)); resT = await (model5 == null ? void 0 : model5.predict(tensor3));
last4 = now();
tf9.dispose(tensor3); tf9.dispose(tensor3);
if (resT) { if (resT) {
cache2.keypoints.length = 0; cache2.keypoints.length = 0;
@ -5376,8 +5391,9 @@ async function predict4(image25, config3) {
var tf10 = __toModule(require_tfjs_esm()); var tf10 = __toModule(require_tfjs_esm());
var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"]; var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"];
var model6; var model6;
var last2 = []; var last5 = [];
var lastCount2 = 0; var lastCount2 = 0;
var lastTime2 = 0;
var skipped6 = Number.MAX_SAFE_INTEGER; var skipped6 = Number.MAX_SAFE_INTEGER;
var rgb = [0.2989, 0.587, 0.114]; var rgb = [0.2989, 0.587, 0.114];
async function load6(config3) { async function load6(config3) {
@ -5395,44 +5411,45 @@ async function load6(config3) {
return model6; return model6;
} }
async function predict5(image25, config3, idx, count2) { async function predict5(image25, config3, idx, count2) {
var _a; var _a, _b;
if (!model6) if (!model6)
return null; return null;
if (skipped6 < (((_a = config3.face.emotion) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount2 === count2 && last2[idx] && last2[idx].length > 0) { if (skipped6 < (((_a = config3.face.emotion) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.emotion) == null ? void 0 : _b.skipTime) || 0) <= now() - lastTime2 && config3.skipFrame && lastCount2 === count2 && last5[idx] && last5[idx].length > 0) {
skipped6++; skipped6++;
return last2[idx]; return last5[idx];
} }
skipped6 = 0; skipped6 = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
var _a2, _b; var _a2, _b2;
const resize = tf10.image.resizeBilinear(image25, [(model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[2] : 0, (model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[1] : 0], false);
const [red, green, blue] = tf10.split(resize, 3, 3);
tf10.dispose(resize);
const redNorm = tf10.mul(red, rgb[0]);
const greenNorm = tf10.mul(green, rgb[1]);
const blueNorm = tf10.mul(blue, rgb[2]);
tf10.dispose(red);
tf10.dispose(green);
tf10.dispose(blue);
const grayscale = tf10.addN([redNorm, greenNorm, blueNorm]);
tf10.dispose(redNorm);
tf10.dispose(greenNorm);
tf10.dispose(blueNorm);
const normalize = tf10.tidy(() => tf10.mul(tf10.sub(grayscale, 0.5), 2));
tf10.dispose(grayscale);
const obj = []; const obj = [];
if ((_a2 = config3.face.emotion) == null ? void 0 : _a2.enabled) { if ((_a2 = config3.face.emotion) == null ? void 0 : _a2.enabled) {
const resize = tf10.image.resizeBilinear(image25, [(model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[2] : 0, (model6 == null ? void 0 : model6.inputs[0].shape) ? model6.inputs[0].shape[1] : 0], false);
const [red, green, blue] = tf10.split(resize, 3, 3);
tf10.dispose(resize);
const redNorm = tf10.mul(red, rgb[0]);
const greenNorm = tf10.mul(green, rgb[1]);
const blueNorm = tf10.mul(blue, rgb[2]);
tf10.dispose(red);
tf10.dispose(green);
tf10.dispose(blue);
const grayscale = tf10.addN([redNorm, greenNorm, blueNorm]);
tf10.dispose(redNorm);
tf10.dispose(greenNorm);
tf10.dispose(blueNorm);
const normalize = tf10.tidy(() => tf10.mul(tf10.sub(grayscale, 0.5), 2));
tf10.dispose(grayscale);
const emotionT = await (model6 == null ? void 0 : model6.predict(normalize)); const emotionT = await (model6 == null ? void 0 : model6.predict(normalize));
lastTime2 = now();
const data = await emotionT.data(); const data = await emotionT.data();
tf10.dispose(emotionT); tf10.dispose(emotionT);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (data[i] > (((_b = config3.face.emotion) == null ? void 0 : _b.minConfidence) || 0)) if (data[i] > (((_b2 = config3.face.emotion) == null ? void 0 : _b2.minConfidence) || 0))
obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] }); obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] });
} }
obj.sort((a, b) => b.score - a.score); obj.sort((a, b) => b.score - a.score);
tf10.dispose(normalize);
} }
tf10.dispose(normalize); last5[idx] = obj;
last2[idx] = obj;
lastCount2 = count2; lastCount2 = count2;
resolve(obj); resolve(obj);
}); });
@ -5579,11 +5596,13 @@ var boxCache = [];
var model8 = null; var model8 = null;
var inputSize5 = 0; var inputSize5 = 0;
var skipped7 = Number.MAX_SAFE_INTEGER; var skipped7 = Number.MAX_SAFE_INTEGER;
var lastTime3 = 0;
var detectedFaces = 0; var detectedFaces = 0;
async function predict6(input, config3) { async function predict6(input, config3) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
if (!config3.skipFrame || (detectedFaces !== ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || !((_b = config3.face.mesh) == null ? void 0 : _b.enabled)) && skipped7 > (((_c = config3.face.detector) == null ? void 0 : _c.skipFrames) || 0)) { if (!config3.skipFrame || (detectedFaces !== ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || !((_b = config3.face.mesh) == null ? void 0 : _b.enabled)) && (skipped7 > (((_c = config3.face.detector) == null ? void 0 : _c.skipFrames) || 0) && (((_d = config3.face.description) == null ? void 0 : _d.skipTime) || 0) <= now() - lastTime3)) {
const newBoxes2 = await getBoxes(input, config3); const newBoxes2 = await getBoxes(input, config3);
lastTime3 = now();
boxCache = []; boxCache = [];
for (const possible of newBoxes2.boxes) { for (const possible of newBoxes2.boxes) {
const startPoint = await possible.box.startPoint.data(); const startPoint = await possible.box.startPoint.data();
@ -5619,16 +5638,16 @@ async function predict6(input, config3) {
faceScore: 0, faceScore: 0,
annotations: {} annotations: {}
}; };
if (((_d = config3.face.detector) == null ? void 0 : _d.rotation) && ((_e = config3.face.mesh) == null ? void 0 : _e.enabled) && env.kernels.includes("rotatewithoffset")) { if (((_e = config3.face.detector) == null ? void 0 : _e.rotation) && ((_f = config3.face.mesh) == null ? void 0 : _f.enabled) && env.kernels.includes("rotatewithoffset")) {
[angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5); [angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5);
} else { } else {
rotationMatrix = IDENTITY_MATRIX; rotationMatrix = IDENTITY_MATRIX;
const cut = cutBoxFromImageAndResize({ startPoint: box4.startPoint, endPoint: box4.endPoint }, input, ((_f = config3.face.mesh) == null ? void 0 : _f.enabled) ? [inputSize5, inputSize5] : [size(), size()]); const cut = cutBoxFromImageAndResize({ startPoint: box4.startPoint, endPoint: box4.endPoint }, input, ((_g = config3.face.mesh) == null ? void 0 : _g.enabled) ? [inputSize5, inputSize5] : [size(), size()]);
face5.tensor = tf12.div(cut, 255); face5.tensor = tf12.div(cut, 255);
tf12.dispose(cut); tf12.dispose(cut);
} }
face5.boxScore = Math.round(100 * box4.confidence) / 100; face5.boxScore = Math.round(100 * box4.confidence) / 100;
if (!((_g = config3.face.mesh) == null ? void 0 : _g.enabled)) { if (!((_h = config3.face.mesh) == null ? void 0 : _h.enabled)) {
face5.box = getClampedBox(box4, input); face5.box = getClampedBox(box4, input);
face5.boxRaw = getRawBox(box4, input); face5.boxRaw = getRawBox(box4, input);
face5.score = Math.round(100 * box4.confidence || 0) / 100; face5.score = Math.round(100 * box4.confidence || 0) / 100;
@ -5651,17 +5670,17 @@ async function predict6(input, config3) {
let rawCoords = await coordsReshaped.array(); let rawCoords = await coordsReshaped.array();
tf12.dispose(contourCoords); tf12.dispose(contourCoords);
tf12.dispose(coordsReshaped); tf12.dispose(coordsReshaped);
if (faceConfidence < (((_h = config3.face.detector) == null ? void 0 : _h.minConfidence) || 1)) { if (faceConfidence < (((_i = config3.face.detector) == null ? void 0 : _i.minConfidence) || 1)) {
box4.confidence = faceConfidence; box4.confidence = faceConfidence;
} else { } else {
if ((_i = config3.face.iris) == null ? void 0 : _i.enabled) if ((_j = config3.face.iris) == null ? void 0 : _j.enabled)
rawCoords = await augmentIris(rawCoords, face5.tensor, config3, inputSize5); rawCoords = await augmentIris(rawCoords, face5.tensor, config3, inputSize5);
face5.mesh = transformRawCoords(rawCoords, box4, angle, rotationMatrix, inputSize5); face5.mesh = transformRawCoords(rawCoords, box4, angle, rotationMatrix, inputSize5);
face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input.shape[2] || 0), pt[1] / (input.shape[1] || 0), (pt[2] || 0) / inputSize5]); face5.meshRaw = face5.mesh.map((pt) => [pt[0] / (input.shape[2] || 0), pt[1] / (input.shape[1] || 0), (pt[2] || 0) / inputSize5]);
box4 = { ...enlargeBox(calculateLandmarksBoundingBox(face5.mesh), 1.5), confidence: box4.confidence }; box4 = { ...enlargeBox(calculateLandmarksBoundingBox(face5.mesh), 1.5), confidence: box4.confidence };
for (const key of Object.keys(meshAnnotations)) for (const key of Object.keys(meshAnnotations))
face5.annotations[key] = meshAnnotations[key].map((index) => face5.mesh[index]); face5.annotations[key] = meshAnnotations[key].map((index) => face5.mesh[index]);
if (((_j = config3.face.detector) == null ? void 0 : _j.rotation) && config3.face.mesh.enabled && ((_k = config3.face.description) == null ? void 0 : _k.enabled) && env.kernels.includes("rotatewithoffset")) { if (((_k = config3.face.detector) == null ? void 0 : _k.rotation) && config3.face.mesh.enabled && ((_l = config3.face.description) == null ? void 0 : _l.enabled) && env.kernels.includes("rotatewithoffset")) {
tf12.dispose(face5.tensor); tf12.dispose(face5.tensor);
[angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5); [angle, rotationMatrix, face5.tensor] = correctFaceRotation(box4, input, inputSize5);
} }
@ -5675,7 +5694,7 @@ async function predict6(input, config3) {
faces.push(face5); faces.push(face5);
newBoxes.push(box4); newBoxes.push(box4);
} }
if ((_l = config3.face.mesh) == null ? void 0 : _l.enabled) if ((_m = config3.face.mesh) == null ? void 0 : _m.enabled)
boxCache = newBoxes.filter((a) => { boxCache = newBoxes.filter((a) => {
var _a2; var _a2;
return a.confidence > (((_a2 = config3.face.detector) == null ? void 0 : _a2.minConfidence) || 0); return a.confidence > (((_a2 = config3.face.detector) == null ? void 0 : _a2.minConfidence) || 0);
@ -5706,7 +5725,8 @@ var uvmap = UV468;
// src/face/faceres.ts // src/face/faceres.ts
var tf13 = __toModule(require_tfjs_esm()); var tf13 = __toModule(require_tfjs_esm());
var model9; var model9;
var last3 = []; var last6 = [];
var lastTime4 = 0;
var lastCount3 = 0; var lastCount3 = 0;
var skipped8 = Number.MAX_SAFE_INTEGER; var skipped8 = Number.MAX_SAFE_INTEGER;
async function load9(config3) { async function load9(config3) {
@ -5739,29 +5759,29 @@ function enhance(input) {
return image25; return image25;
} }
async function predict7(image25, config3, idx, count2) { async function predict7(image25, config3, idx, count2) {
var _a, _b, _c; var _a, _b, _c, _d;
if (!model9) if (!model9)
return null; return null;
if (skipped8 < (((_a = config3.face.description) == null ? void 0 : _a.skipFrames) || 0) && config3.skipFrame && lastCount3 === count2 && ((_b = last3[idx]) == null ? void 0 : _b.age) && ((_c = last3[idx]) == null ? void 0 : _c.age) > 0) { if (skipped8 < (((_a = config3.face.description) == null ? void 0 : _a.skipFrames) || 0) && (((_b = config3.face.description) == null ? void 0 : _b.skipTime) || 0) <= now() - lastTime4 && config3.skipFrame && lastCount3 === count2 && ((_c = last6[idx]) == null ? void 0 : _c.age) && ((_d = last6[idx]) == null ? void 0 : _d.age) > 0) {
skipped8++; skipped8++;
return last3[idx]; return last6[idx];
} }
skipped8 = 0; skipped8 = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
var _a2, _b2; var _a2, _b2;
const enhanced = enhance(image25);
let resT;
const obj = { const obj = {
age: 0, age: 0,
gender: "unknown", gender: "unknown",
genderScore: 0, genderScore: 0,
descriptor: [] descriptor: []
}; };
if ((_a2 = config3.face.description) == null ? void 0 : _a2.enabled) if ((_a2 = config3.face.description) == null ? void 0 : _a2.enabled) {
resT = await (model9 == null ? void 0 : model9.predict(enhanced)); const enhanced = enhance(image25);
tf13.dispose(enhanced); const resT = await (model9 == null ? void 0 : model9.predict(enhanced));
if (resT) { lastTime4 = now();
const gender = await resT.find((t) => t.shape[1] === 1).data(); tf13.dispose(enhanced);
const genderT = await resT.find((t) => t.shape[1] === 1);
const gender = await genderT.data();
const confidence = Math.trunc(200 * Math.abs(gender[0] - 0.5)) / 100; const confidence = Math.trunc(200 * Math.abs(gender[0] - 0.5)) / 100;
if (confidence > (((_b2 = config3.face.description) == null ? void 0 : _b2.minConfidence) || 0)) { if (confidence > (((_b2 = config3.face.description) == null ? void 0 : _b2.minConfidence) || 0)) {
obj.gender = gender[0] <= 0.5 ? "female" : "male"; obj.gender = gender[0] <= 0.5 ? "female" : "male";
@ -5770,14 +5790,15 @@ async function predict7(image25, config3, idx, count2) {
const argmax = tf13.argMax(resT.find((t) => t.shape[1] === 100), 1); const argmax = tf13.argMax(resT.find((t) => t.shape[1] === 100), 1);
const age = (await argmax.data())[0]; const age = (await argmax.data())[0];
tf13.dispose(argmax); tf13.dispose(argmax);
const all2 = await resT.find((t) => t.shape[1] === 100).data(); const ageT = resT.find((t) => t.shape[1] === 100);
const all2 = await ageT.data();
obj.age = Math.round(all2[age - 1] > all2[age + 1] ? 10 * age - 100 * all2[age - 1] : 10 * age + 100 * all2[age + 1]) / 10; obj.age = Math.round(all2[age - 1] > all2[age + 1] ? 10 * age - 100 * all2[age - 1] : 10 * age + 100 * all2[age + 1]) / 10;
const desc = resT.find((t) => t.shape[1] === 1024); const desc = resT.find((t) => t.shape[1] === 1024);
const descriptor = await desc.data(); const descriptor = desc ? await desc.data() : [];
obj.descriptor = [...descriptor]; obj.descriptor = Array.from(descriptor);
resT.forEach((t) => tf13.dispose(t)); resT.forEach((t) => tf13.dispose(t));
} }
last3[idx] = obj; last6[idx] = obj;
lastCount3 = count2; lastCount3 = count2;
resolve(obj); resolve(obj);
}); });
@ -8932,6 +8953,7 @@ var handBoxEnlargeFactor = 1.65;
var palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2]; var palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2];
var palmLandmarksPalmBase = 0; var palmLandmarksPalmBase = 0;
var palmLandmarksMiddleFingerBase = 2; var palmLandmarksMiddleFingerBase = 2;
var lastTime5 = 0;
var HandPipeline = class { var HandPipeline = class {
constructor(handDetector, handPoseModel2) { constructor(handDetector, handPoseModel2) {
__publicField(this, "handDetector"); __publicField(this, "handDetector");
@ -8996,7 +9018,7 @@ var HandPipeline = class {
async estimateHands(image25, config3) { async estimateHands(image25, config3) {
let useFreshBox = false; let useFreshBox = false;
let boxes; let boxes;
if (this.skipped === 0 || this.skipped > config3.hand.skipFrames || !config3.hand.landmarks || !config3.skipFrame) { if (this.skipped === 0 || this.skipped > config3.hand.skipFrames && (config3.hand.skipTime || 0) <= now() - lastTime5 || !config3.hand.landmarks || !config3.skipFrame) {
boxes = await this.handDetector.estimateHandBounds(image25, config3); boxes = await this.handDetector.estimateHandBounds(image25, config3);
this.skipped = 0; this.skipped = 0;
} }
@ -9025,6 +9047,7 @@ var HandPipeline = class {
tf16.dispose(croppedInput); tf16.dispose(croppedInput);
tf16.dispose(rotatedImage); tf16.dispose(rotatedImage);
const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage); const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage);
lastTime5 = now();
tf16.dispose(handImage); tf16.dispose(handImage);
const confidence = (await confidenceT.data())[0]; const confidence = (await confidenceT.data())[0];
tf16.dispose(confidenceT); tf16.dispose(confidenceT);
@ -9594,6 +9617,7 @@ var boxExpandFact = 1.6;
var maxDetectorResolution = 512; var maxDetectorResolution = 512;
var detectorExpandFact = 1.4; var detectorExpandFact = 1.4;
var skipped9 = 0; var skipped9 = 0;
var lastTime6 = 0;
var outputSize = [0, 0]; var outputSize = [0, 0];
var cache3 = { var cache3 = {
boxes: [], boxes: [],
@ -9733,16 +9757,17 @@ async function predict9(input, config3) {
return []; return [];
outputSize = [input.shape[2] || 0, input.shape[1] || 0]; outputSize = [input.shape[2] || 0, input.shape[1] || 0];
skipped9++; skipped9++;
if (config3.skipFrame && skipped9 <= (config3.hand.skipFrames || 0)) { if (config3.skipFrame && skipped9 <= (config3.hand.skipFrames || 0) && (config3.hand.skipTime || 0) <= now() - lastTime6) {
return cache3.hands; return cache3.hands;
} }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
if (config3.skipFrame && cache3.hands.length === config3.hand.maxDetected) { if (config3.skipFrame && cache3.hands.length === config3.hand.maxDetected) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
} else if (config3.skipFrame && skipped9 < 3 * (config3.hand.skipFrames || 0) && cache3.hands.length > 0) { } else if (config3.skipFrame && skipped9 < 3 * (config3.hand.skipFrames || 0) && (config3.hand.skipTime || 0) <= 3 * (now() - lastTime6) && cache3.hands.length > 0) {
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
} else { } else {
cache3.boxes = await detectHands(input, config3); cache3.boxes = await detectHands(input, config3);
lastTime6 = now();
cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3))); cache3.hands = await Promise.all(cache3.boxes.map((handBox) => detectFingers(input, handBox, config3)));
skipped9 = 0; skipped9 = 0;
} }
@ -9933,7 +9958,8 @@ var inputSize7 = 0;
var skipped10 = Number.MAX_SAFE_INTEGER; var skipped10 = Number.MAX_SAFE_INTEGER;
var cache5 = { var cache5 = {
boxes: [], boxes: [],
bodies: [] bodies: [],
last: 0
}; };
async function load11(config3) { async function load11(config3) {
if (env.initial) if (env.initial)
@ -10043,7 +10069,7 @@ async function predict10(input, config3) {
if (!config3.skipFrame) if (!config3.skipFrame)
cache5.boxes.length = 0; cache5.boxes.length = 0;
skipped10++; skipped10++;
if (config3.skipFrame && skipped10 <= (config3.body.skipFrames || 0)) { if (config3.skipFrame && (skipped10 <= (config3.body.skipFrames || 0) && (config3.body.skipTime || 0) <= now() - cache5.last)) {
return cache5.bodies; return cache5.bodies;
} }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
@ -10051,6 +10077,7 @@ async function predict10(input, config3) {
skipped10 = 0; skipped10 = 0;
t.input = padInput(input, inputSize7); t.input = padInput(input, inputSize7);
t.res = await (model10 == null ? void 0 : model10.predict(t.input)); t.res = await (model10 == null ? void 0 : model10.predict(t.input));
cache5.last = now();
const res = await t.res.array(); const res = await t.res.array();
cache5.bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]); cache5.bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]);
for (const body4 of cache5.bodies) { for (const body4 of cache5.bodies) {
@ -10065,7 +10092,8 @@ async function predict10(input, config3) {
// src/object/nanodet.ts // src/object/nanodet.ts
var tf21 = __toModule(require_tfjs_esm()); var tf21 = __toModule(require_tfjs_esm());
var model11; var model11;
var last4 = []; var last7 = [];
var lastTime7 = 0;
var skipped11 = Number.MAX_SAFE_INTEGER; var skipped11 = Number.MAX_SAFE_INTEGER;
var scaleBox = 2.5; var scaleBox = 2.5;
async function load12(config3) { async function load12(config3) {
@ -10145,13 +10173,13 @@ async function process4(res, inputSize8, outputShape, config3) {
return results; return results;
} }
async function predict11(image25, config3) { async function predict11(image25, config3) {
if (skipped11 < (config3.object.skipFrames || 0) && config3.skipFrame && last4.length > 0) { if (skipped11 < (config3.object.skipFrames || 0) && (config3.object.skipTime || 0) <= now() - lastTime7 && config3.skipFrame && last7.length > 0) {
skipped11++; skipped11++;
return last4; return last7;
} }
skipped11 = 0; skipped11 = 0;
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense")) if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
return last4; return last7;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const outputSize2 = [image25.shape[2], image25.shape[1]]; const outputSize2 = [image25.shape[2], image25.shape[1]];
const resize = tf21.image.resizeBilinear(image25, [model11.inputSize, model11.inputSize], false); const resize = tf21.image.resizeBilinear(image25, [model11.inputSize, model11.inputSize], false);
@ -10162,9 +10190,10 @@ async function predict11(image25, config3) {
let objectT; let objectT;
if (config3.object.enabled) if (config3.object.enabled)
objectT = await model11.predict(transpose); objectT = await model11.predict(transpose);
lastTime7 = now();
tf21.dispose(transpose); tf21.dispose(transpose);
const obj = await process4(objectT, model11.inputSize, outputSize2, config3); const obj = await process4(objectT, model11.inputSize, outputSize2, config3);
last4 = obj; last7 = obj;
resolve(obj); resolve(obj);
}); });
} }

64326
dist/tfjs.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
*/ */
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import type { BodyKeypoint, BodyResult, Box, Point } from '../result'; import type { BodyKeypoint, BodyResult, Box, Point } from '../result';
import type { GraphModel, Tensor } from '../tfjs/types'; import type { GraphModel, Tensor } from '../tfjs/types';
import type { Config } from '../config'; import type { Config } from '../config';
@ -16,6 +16,7 @@ let skipped = Number.MAX_SAFE_INTEGER;
let outputNodes: string[]; // different for lite/full/heavy let outputNodes: string[]; // different for lite/full/heavy
let cache: BodyResult | null = null; let cache: BodyResult | null = null;
let padding: [number, number][] = [[0, 0], [0, 0], [0, 0], [0, 0]]; let padding: [number, number][] = [[0, 0], [0, 0], [0, 0], [0, 0]];
let last = 0;
export async function loadDetect(config: Config): Promise<GraphModel> { export async function loadDetect(config: Config): Promise<GraphModel> {
if (env.initial) models[0] = null; if (env.initial) models[0] = null;
@ -135,10 +136,11 @@ async function detectParts(input: Tensor, config: Config, outputSize: [number, n
export async function predict(input: Tensor, config: Config): Promise<BodyResult[]> { export async function predict(input: Tensor, config: Config): Promise<BodyResult[]> {
const outputSize: [number, number] = [input.shape[2] || 0, input.shape[1] || 0]; const outputSize: [number, number] = [input.shape[2] || 0, input.shape[1] || 0];
if ((skipped < (config.body.skipFrames || 0)) && config.skipFrame && cache !== null) { if ((skipped < (config.body.skipFrames || 0)) && ((config.body.skipTime || 0) <= (now() - last)) && config.skipFrame && cache !== null) {
skipped++; skipped++;
} else { } else {
cache = await detectParts(input, config, outputSize); cache = await detectParts(input, config, outputSize);
last = now();
skipped = 0; skipped = 0;
} }
if (cache) return [cache]; if (cache) return [cache];

View File

@ -4,7 +4,7 @@
* Based on: [**EfficientPose**](https://github.com/daniegr/EfficientPose) * Based on: [**EfficientPose**](https://github.com/daniegr/EfficientPose)
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
import * as coords from './efficientposecoords'; import * as coords from './efficientposecoords';
import type { BodyResult, Point } from '../result'; import type { BodyResult, Point } from '../result';
@ -13,7 +13,7 @@ import type { Config } from '../config';
import { env } from '../util/env'; import { env } from '../util/env';
let model: GraphModel | null; let model: GraphModel | null;
let last = 0;
const cache: BodyResult = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} }; const cache: BodyResult = { id: 0, keypoints: [], box: [0, 0, 0, 0], boxRaw: [0, 0, 0, 0], score: 0, annotations: {} };
// const keypoints: Array<BodyKeypoint> = []; // const keypoints: Array<BodyKeypoint> = [];
@ -50,12 +50,7 @@ function max2d(inputs, minScore) {
} }
export async function predict(image: Tensor, config: Config): Promise<BodyResult[]> { export async function predict(image: Tensor, config: Config): Promise<BodyResult[]> {
/** blazepose caching if ((skipped < (config.body?.skipFrames || 0)) && config.skipFrame && Object.keys(cache.keypoints).length > 0 && ((config.body.skipTime || 0) <= (now() - last))) {
* not fully implemented
* 1. if skipFrame returned cached
* 2. run detection based on squared full frame
*/
if ((skipped < (config.body?.skipFrames || 0)) && config.skipFrame && Object.keys(cache.keypoints).length > 0) {
skipped++; skipped++;
return [cache]; return [cache];
} }
@ -71,6 +66,7 @@ export async function predict(image: Tensor, config: Config): Promise<BodyResult
let resT; let resT;
if (config.body.enabled) resT = await model?.predict(tensor); if (config.body.enabled) resT = await model?.predict(tensor);
last = now();
tf.dispose(tensor); tf.dispose(tensor);
if (resT) { if (resT) {

View File

@ -4,7 +4,7 @@
* Based on: [**MoveNet**](https://blog.tensorflow.org/2021/05/next-generation-pose-detection-with-movenet-and-tensorflowjs.html) * Based on: [**MoveNet**](https://blog.tensorflow.org/2021/05/next-generation-pose-detection-with-movenet-and-tensorflowjs.html)
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import * as box from '../util/box'; import * as box from '../util/box';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
import * as coords from './movenetcoords'; import * as coords from './movenetcoords';
@ -23,9 +23,11 @@ let skipped = Number.MAX_SAFE_INTEGER;
const cache: { const cache: {
boxes: Array<Box>, // unused boxes: Array<Box>, // unused
bodies: Array<BodyResult>; bodies: Array<BodyResult>;
last: number,
} = { } = {
boxes: [], boxes: [],
bodies: [], bodies: [],
last: 0,
}; };
export async function load(config: Config): Promise<GraphModel> { export async function load(config: Config): Promise<GraphModel> {
@ -129,17 +131,10 @@ async function parseMultiPose(res, config, image, inputBox) {
} }
export async function predict(input: Tensor, config: Config): Promise<BodyResult[]> { export async function predict(input: Tensor, config: Config): Promise<BodyResult[]> {
/** movenet caching
* 1. if skipFrame returned cached
* 2. if enough cached boxes run using cached boxes
* 3. if not enough detected bodies rerun using full frame
* 4. regenerate cached boxes based on current keypoints
*/
if (!model || !model?.inputs[0].shape) return []; // something is wrong with the model if (!model || !model?.inputs[0].shape) return []; // something is wrong with the model
if (!config.skipFrame) cache.boxes.length = 0; // allowed to use cache or not if (!config.skipFrame) cache.boxes.length = 0; // allowed to use cache or not
skipped++; // increment skip frames skipped++; // increment skip frames
if (config.skipFrame && (skipped <= (config.body.skipFrames || 0))) { if (config.skipFrame && (skipped <= (config.body.skipFrames || 0) && ((config.body.skipTime || 0) <= (now() - cache.last)))) {
return cache.bodies; // return cached results without running anything return cache.bodies; // return cached results without running anything
} }
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
@ -181,6 +176,7 @@ export async function predict(input: Tensor, config: Config): Promise<BodyResult
// run detection on squared input and no cached boxes // run detection on squared input and no cached boxes
t.input = fix.padInput(input, inputSize); t.input = fix.padInput(input, inputSize);
t.res = await model?.predict(t.input) as Tensor; t.res = await model?.predict(t.input) as Tensor;
cache.last = now();
const res = await t.res.array(); const res = await t.res.array();
cache.bodies = (t.res.shape[2] === 17) cache.bodies = (t.res.shape[2] === 17)
? await parseSinglePose(res, config, input, [0, 0, 1, 1]) ? await parseSinglePose(res, config, input, [0, 0, 1, 1])

View File

@ -1,53 +1,42 @@
/* eslint-disable indent */ /* eslint-disable indent */
/* eslint-disable no-multi-spaces */ /* eslint-disable no-multi-spaces */
/** Dectector part of face configuration */ export interface GenericConfig {
export interface FaceDetectorConfig { enabled: boolean,
modelPath: string, modelPath: string,
skipFrames: number,
skipTime: number,
}
/** Dectector part of face configuration */
export interface FaceDetectorConfig extends GenericConfig {
rotation: boolean, rotation: boolean,
maxDetected: number, maxDetected: number,
skipFrames: number,
minConfidence: number, minConfidence: number,
iouThreshold: number, iouThreshold: number,
return: boolean, return: boolean,
} }
/** Mesh part of face configuration */ /** Mesh part of face configuration */
export interface FaceMeshConfig { export type FaceMeshConfig = GenericConfig
enabled: boolean,
modelPath: string,
}
/** Iris part of face configuration */ /** Iris part of face configuration */
export interface FaceIrisConfig { export type FaceIrisConfig = GenericConfig
enabled: boolean,
modelPath: string,
}
/** Description or face embedding part of face configuration /** Description or face embedding part of face configuration
* - also used by age and gender detection * - also used by age and gender detection
*/ */
export interface FaceDescriptionConfig { export interface FaceDescriptionConfig extends GenericConfig {
enabled: boolean,
modelPath: string,
skipFrames: number,
minConfidence: number, minConfidence: number,
} }
/** Emotion part of face configuration */ /** Emotion part of face configuration */
export interface FaceEmotionConfig { export interface FaceEmotionConfig extends GenericConfig {
enabled: boolean,
minConfidence: number, minConfidence: number,
skipFrames: number,
modelPath: string,
} }
/** Emotion part of face configuration */ /** Emotion part of face configuration */
export interface FaceAntiSpoofConfig { export type FaceAntiSpoofConfig = GenericConfig
enabled: boolean,
skipFrames: number,
modelPath: string,
}
/** Controlls and configures all face-specific options: /** Controlls and configures all face-specific options:
* - face detection, face mesh detection, age, gender, emotion detection and face description * - face detection, face mesh detection, age, gender, emotion detection and face description
@ -86,18 +75,15 @@ export interface FaceConfig {
* Changing `modelPath` will change module responsible for hand detection and tracking * Changing `modelPath` will change module responsible for hand detection and tracking
* Allowed values are `posenet.json`, `blazepose.json`, `efficientpose.json`, `movenet-lightning.json`, `movenet-thunder.json`, `movenet-multipose.json` * Allowed values are `posenet.json`, `blazepose.json`, `efficientpose.json`, `movenet-lightning.json`, `movenet-thunder.json`, `movenet-multipose.json`
*/ */
export interface BodyConfig { export interface BodyConfig extends GenericConfig {
enabled: boolean,
modelPath: string,
maxDetected: number, maxDetected: number,
minConfidence: number, minConfidence: number,
skipFrames: number,
detector?: { detector?: {
modelPath: string modelPath: string
}, },
} }
/** Controlls and configures all hand detection specific options /** Controls and configures all hand detection specific options
* *
* Parameters: * Parameters:
* - enabled: true/false * - enabled: true/false
@ -113,10 +99,8 @@ export interface BodyConfig {
* Changing `detector.modelPath` will change module responsible for hand detection and tracking * Changing `detector.modelPath` will change module responsible for hand detection and tracking
* Allowed values are `handdetect.json` and `handtrack.json` * Allowed values are `handdetect.json` and `handtrack.json`
*/ */
export interface HandConfig { export interface HandConfig extends GenericConfig {
enabled: boolean,
rotation: boolean, rotation: boolean,
skipFrames: number,
minConfidence: number, minConfidence: number,
iouThreshold: number, iouThreshold: number,
maxDetected: number, maxDetected: number,
@ -139,13 +123,10 @@ export interface HandConfig {
* Changing `modelPath` will change module responsible for hand detection and tracking * Changing `modelPath` will change module responsible for hand detection and tracking
* Allowed values are `mb3-centernet.json` and `nanodet.json` * Allowed values are `mb3-centernet.json` and `nanodet.json`
*/ */
export interface ObjectConfig { export interface ObjectConfig extends GenericConfig {
enabled: boolean,
modelPath: string,
minConfidence: number, minConfidence: number,
iouThreshold: number, iouThreshold: number,
maxDetected: number, maxDetected: number,
skipFrames: number,
} }
/** Controlls and configures all body segmentation module /** Controlls and configures all body segmentation module
@ -368,9 +349,8 @@ const config: Config = {
// should be set to the minimum number for performance // should be set to the minimum number for performance
skipFrames: 11, // how many max frames to go without re-running the face bounding box detector skipFrames: 11, // how many max frames to go without re-running the face bounding box detector
// only used when cacheSensitivity is not zero // only used when cacheSensitivity is not zero
// e.g., if model is running st 25 FPS, we can re-use existing bounding skipTime: 2000, // how many ms to go without re-running the face bounding box detector
// box for updated face analysis as the head does not move fast // only used when cacheSensitivity is not zero
// in short time (10 * 1/25 = 0.25 sec)
minConfidence: 0.2, // threshold for discarding a prediction minConfidence: 0.2, // threshold for discarding a prediction
iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed
return: false, // return extracted face as tensor return: false, // return extracted face as tensor
@ -393,6 +373,8 @@ const config: Config = {
minConfidence: 0.1, // threshold for discarding a prediction minConfidence: 0.1, // threshold for discarding a prediction
skipFrames: 12, // how max many frames to go without re-running the detector skipFrames: 12, // how max many frames to go without re-running the detector
// only used when cacheSensitivity is not zero // only used when cacheSensitivity is not zero
skipTime: 2000, // how many ms to go without re-running the face bounding box detector
// only used when cacheSensitivity is not zero
modelPath: 'emotion.json', // face emotion model, can be absolute path or relative to modelBasePath modelPath: 'emotion.json', // face emotion model, can be absolute path or relative to modelBasePath
}, },
@ -403,6 +385,8 @@ const config: Config = {
// can be either absolute path or relative to modelBasePath // can be either absolute path or relative to modelBasePath
skipFrames: 13, // how many max frames to go without re-running the detector skipFrames: 13, // how many max frames to go without re-running the detector
// only used when cacheSensitivity is not zero // only used when cacheSensitivity is not zero
skipTime: 2000, // how many ms to go without re-running the face bounding box detector
// only used when cacheSensitivity is not zero
minConfidence: 0.1, // threshold for discarding a prediction minConfidence: 0.1, // threshold for discarding a prediction
}, },
@ -410,6 +394,8 @@ const config: Config = {
enabled: false, enabled: false,
skipFrames: 14, // how max many frames to go without re-running the detector skipFrames: 14, // how max many frames to go without re-running the detector
// only used when cacheSensitivity is not zero // only used when cacheSensitivity is not zero
skipTime: 2000, // how many ms to go without re-running the face bounding box detector
// only used when cacheSensitivity is not zero
modelPath: 'antispoof.json', // face description model modelPath: 'antispoof.json', // face description model
// can be either absolute path or relative to modelBasePath // can be either absolute path or relative to modelBasePath
}, },
@ -429,6 +415,8 @@ const config: Config = {
minConfidence: 0.3, // threshold for discarding a prediction minConfidence: 0.3, // threshold for discarding a prediction
skipFrames: 1, // how many max frames to go without re-running the detector skipFrames: 1, // how many max frames to go without re-running the detector
// only used when cacheSensitivity is not zero // only used when cacheSensitivity is not zero
skipTime: 2000, // how many ms to go without re-running the face bounding box detector
// only used when cacheSensitivity is not zero
}, },
hand: { hand: {
@ -438,9 +426,8 @@ const config: Config = {
// only valid for `handdetect` variation // only valid for `handdetect` variation
skipFrames: 2, // how many max frames to go without re-running the hand bounding box detector skipFrames: 2, // how many max frames to go without re-running the hand bounding box detector
// only used when cacheSensitivity is not zero // only used when cacheSensitivity is not zero
// e.g., if model is running st 25 FPS, we can re-use existing bounding skipTime: 2000, // how many ms to go without re-running the face bounding box detector
// box for updated hand skeleton analysis as the hand // only used when cacheSensitivity is not zero
// hasn't moved much in short time (10 * 1/25 = 0.25 sec)
minConfidence: 0.50, // threshold for discarding a prediction minConfidence: 0.50, // threshold for discarding a prediction
iouThreshold: 0.2, // ammount of overlap between two detected objects before one object is removed iouThreshold: 0.2, // ammount of overlap between two detected objects before one object is removed
maxDetected: -1, // maximum number of hands detected in the input maxDetected: -1, // maximum number of hands detected in the input
@ -465,6 +452,8 @@ const config: Config = {
maxDetected: 10, // maximum number of objects detected in the input maxDetected: 10, // maximum number of objects detected in the input
skipFrames: 15, // how many max frames to go without re-running the detector skipFrames: 15, // how many max frames to go without re-running the detector
// only used when cacheSensitivity is not zero // only used when cacheSensitivity is not zero
skipTime: 2000, // how many ms to go without re-running the face bounding box detector
// only used when cacheSensitivity is not zero
}, },
segmentation: { segmentation: {

View File

@ -2,7 +2,7 @@
* Anti-spoofing model implementation * Anti-spoofing model implementation
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import type { Config } from '../config'; import type { Config } from '../config';
import type { GraphModel, Tensor } from '../tfjs/types'; import type { GraphModel, Tensor } from '../tfjs/types';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
@ -12,6 +12,7 @@ let model: GraphModel | null;
const cached: Array<number> = []; const cached: Array<number> = [];
let skipped = Number.MAX_SAFE_INTEGER; let skipped = Number.MAX_SAFE_INTEGER;
let lastCount = 0; let lastCount = 0;
let last = 0;
export async function load(config: Config): Promise<GraphModel> { export async function load(config: Config): Promise<GraphModel> {
if (env.initial) model = null; if (env.initial) model = null;
@ -25,7 +26,7 @@ export async function load(config: Config): Promise<GraphModel> {
export async function predict(image: Tensor, config: Config, idx, count) { export async function predict(image: Tensor, config: Config, idx, count) {
if (!model) return null; if (!model) return null;
if ((skipped < (config.face.antispoof?.skipFrames || 0)) && config.skipFrame && (lastCount === count) && cached[idx]) { if ((skipped < (config.face.antispoof?.skipFrames || 0)) && ((config.face.antispoof?.skipTime || 0) <= (now() - last)) && config.skipFrame && (lastCount === count) && cached[idx]) {
skipped++; skipped++;
return cached[idx]; return cached[idx];
} }
@ -36,6 +37,7 @@ export async function predict(image: Tensor, config: Config, idx, count) {
const num = (await res.data())[0]; const num = (await res.data())[0];
cached[idx] = Math.round(100 * num) / 100; cached[idx] = Math.round(100 * num) / 100;
lastCount = count; lastCount = count;
last = now();
tf.dispose([resize, res]); tf.dispose([resize, res]);
resolve(cached[idx]); resolve(cached[idx]);
}); });

View File

@ -112,19 +112,3 @@ export async function predict(input, config): Promise<number[]> {
resolve(data); resolve(data);
}); });
} }
/*
git clone https://github.com/becauseofAI/MobileFace
cd MobileFace/MobileFace_Identification
mmconvert --srcFramework mxnet --inputWeight MobileFace_Identification_V3-0000.params --inputNetwork MobileFace_Identification_V3-symbol.json --inputShape 3,112,112 --dstFramework tensorflow --outputModel saved
saved_model_cli show --dir saved/
tensorflowjs_converter --input_format tf_saved_model --output_format tfjs_graph_model --saved_model_tags train saved/ graph/
~/dev/detector/signature.js graph/
2021-03-12 08:25:12 DATA: created on: 2021-03-12T13:17:11.960Z
2021-03-12 08:25:12 INFO: graph model: /home/vlado/dev/face/MobileFace/MobileFace_Identification/graph/model.json
2021-03-12 08:25:12 INFO: size: { unreliable: true, numTensors: 75, numDataBuffers: 75, numBytes: 2183192 }
2021-03-12 08:25:12 INFO: model inputs based on signature
2021-03-12 08:25:12 INFO: model outputs based on signature
2021-03-12 08:25:12 DATA: inputs: [ { name: 'data:0', dtype: 'DT_FLOAT', shape: [ -1, 112, 112, 3, [length]: 4 ] }, [length]: 1 ]
2021-03-12 08:25:12 DATA: outputs: [ { id: 0, name: 'batchnorm0/add_1:0', dytpe: 'DT_FLOAT', shape: [ -1, 256, [length]: 2 ] }, [length]: 1 ]
*/

View File

@ -7,7 +7,7 @@
* - Eye Iris Details: [**MediaPipe Iris**](https://drive.google.com/file/d/1bsWbokp9AklH2ANjCfmjqEzzxO1CNbMu/view) * - Eye Iris Details: [**MediaPipe Iris**](https://drive.google.com/file/d/1bsWbokp9AklH2ANjCfmjqEzzxO1CNbMu/view)
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
import * as blazeface from './blazeface'; import * as blazeface from './blazeface';
import * as util from './facemeshutil'; import * as util from './facemeshutil';
@ -23,11 +23,14 @@ let boxCache: Array<BoxCache> = [];
let model: GraphModel | null = null; let model: GraphModel | null = null;
let inputSize = 0; let inputSize = 0;
let skipped = Number.MAX_SAFE_INTEGER; let skipped = Number.MAX_SAFE_INTEGER;
let lastTime = 0;
let detectedFaces = 0; let detectedFaces = 0;
export async function predict(input: Tensor, config: Config): Promise<FaceResult[]> { export async function predict(input: Tensor, config: Config): Promise<FaceResult[]> {
if (!config.skipFrame || (((detectedFaces !== config.face.detector?.maxDetected) || !config.face.mesh?.enabled)) && (skipped > (config.face.detector?.skipFrames || 0))) { // reset cached boxes // reset cached boxes
if (!config.skipFrame || (((detectedFaces !== config.face.detector?.maxDetected) || !config.face.mesh?.enabled)) && (skipped > (config.face.detector?.skipFrames || 0) && ((config.face.description?.skipTime || 0) <= (now() - lastTime)))) {
const newBoxes = await blazeface.getBoxes(input, config); // get results from blazeface detector const newBoxes = await blazeface.getBoxes(input, config); // get results from blazeface detector
lastTime = now();
boxCache = []; // empty cache boxCache = []; // empty cache
for (const possible of newBoxes.boxes) { // extract data from detector for (const possible of newBoxes.boxes) { // extract data from detector
const startPoint = await possible.box.startPoint.data() as unknown as Point; const startPoint = await possible.box.startPoint.data() as unknown as Point;

View File

@ -7,7 +7,7 @@
* Based on: [**HSE-FaceRes**](https://github.com/HSE-asavchenko/HSE_FaceRec_tf) * Based on: [**HSE-FaceRes**](https://github.com/HSE-asavchenko/HSE_FaceRec_tf)
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
import type { Tensor, GraphModel } from '../tfjs/types'; import type { Tensor, GraphModel } from '../tfjs/types';
import type { Config } from '../config'; import type { Config } from '../config';
@ -21,6 +21,7 @@ const last: Array<{
descriptor: number[], descriptor: number[],
}> = []; }> = [];
let lastTime = 0;
let lastCount = 0; let lastCount = 0;
let skipped = Number.MAX_SAFE_INTEGER; let skipped = Number.MAX_SAFE_INTEGER;
@ -90,15 +91,12 @@ export function enhance(input): Tensor {
export async function predict(image: Tensor, config: Config, idx, count) { export async function predict(image: Tensor, config: Config, idx, count) {
if (!model) return null; if (!model) return null;
if ((skipped < (config.face.description?.skipFrames || 0)) && config.skipFrame && (lastCount === count) && last[idx]?.age && (last[idx]?.age > 0)) { if ((skipped < (config.face.description?.skipFrames || 0)) && ((config.face.description?.skipTime || 0) <= (now() - lastTime)) && config.skipFrame && (lastCount === count) && last[idx]?.age && (last[idx]?.age > 0)) {
skipped++; skipped++;
return last[idx]; return last[idx];
} }
skipped = 0; skipped = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const enhanced = enhance(image);
let resT;
const obj = { const obj = {
age: <number>0, age: <number>0,
gender: <string>'unknown', gender: <string>'unknown',
@ -106,11 +104,13 @@ export async function predict(image: Tensor, config: Config, idx, count) {
descriptor: <number[]>[], descriptor: <number[]>[],
}; };
if (config.face.description?.enabled) resT = await model?.predict(enhanced); if (config.face.description?.enabled) {
tf.dispose(enhanced); const enhanced = enhance(image);
const resT = await model?.predict(enhanced) as Tensor[];
if (resT) { lastTime = now();
const gender = await resT.find((t) => t.shape[1] === 1).data(); tf.dispose(enhanced);
const genderT = await resT.find((t) => t.shape[1] === 1) as Tensor;
const gender = await genderT.data();
const confidence = Math.trunc(200 * Math.abs((gender[0] - 0.5))) / 100; const confidence = Math.trunc(200 * Math.abs((gender[0] - 0.5))) / 100;
if (confidence > (config.face.description?.minConfidence || 0)) { if (confidence > (config.face.description?.minConfidence || 0)) {
obj.gender = gender[0] <= 0.5 ? 'female' : 'male'; obj.gender = gender[0] <= 0.5 ? 'female' : 'male';
@ -119,15 +119,16 @@ export async function predict(image: Tensor, config: Config, idx, count) {
const argmax = tf.argMax(resT.find((t) => t.shape[1] === 100), 1); const argmax = tf.argMax(resT.find((t) => t.shape[1] === 100), 1);
const age = (await argmax.data())[0]; const age = (await argmax.data())[0];
tf.dispose(argmax); tf.dispose(argmax);
const all = await resT.find((t) => t.shape[1] === 100).data(); const ageT = resT.find((t) => t.shape[1] === 100) as Tensor;
const all = await ageT.data();
obj.age = Math.round(all[age - 1] > all[age + 1] ? 10 * age - 100 * all[age - 1] : 10 * age + 100 * all[age + 1]) / 10; obj.age = Math.round(all[age - 1] > all[age + 1] ? 10 * age - 100 * all[age - 1] : 10 * age + 100 * all[age + 1]) / 10;
const desc = resT.find((t) => t.shape[1] === 1024); const desc = resT.find((t) => t.shape[1] === 1024);
// const reshape = desc.reshape([128, 8]); // reshape large 1024-element descriptor to 128 x 8 // const reshape = desc.reshape([128, 8]); // reshape large 1024-element descriptor to 128 x 8
// const reduce = reshape.logSumExp(1); // reduce 2nd dimension by calculating logSumExp on it which leaves us with 128-element descriptor // const reduce = reshape.logSumExp(1); // reduce 2nd dimension by calculating logSumExp on it which leaves us with 128-element descriptor
const descriptor = desc ? await desc.data() : <number[]>[];
const descriptor = await desc.data(); // obj.descriptor = [...descriptor];
obj.descriptor = [...descriptor]; obj.descriptor = Array.from(descriptor);
resT.forEach((t) => tf.dispose(t)); resT.forEach((t) => tf.dispose(t));
} }
last[idx] = obj; last[idx] = obj;

View File

@ -4,7 +4,7 @@
* [**Oarriaga**](https://github.com/oarriaga/face_classification) * [**Oarriaga**](https://github.com/oarriaga/face_classification)
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import type { Config } from '../config'; import type { Config } from '../config';
import type { GraphModel, Tensor } from '../tfjs/types'; import type { GraphModel, Tensor } from '../tfjs/types';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
@ -15,6 +15,7 @@ let model: GraphModel | null;
// let last: Array<{ score: number, emotion: string }> = []; // let last: Array<{ score: number, emotion: string }> = [];
const last: Array<Array<{ score: number, emotion: string }>> = []; const last: Array<Array<{ score: number, emotion: string }>> = [];
let lastCount = 0; let lastCount = 0;
let lastTime = 0;
let skipped = Number.MAX_SAFE_INTEGER; let skipped = Number.MAX_SAFE_INTEGER;
// tuning values // tuning values
@ -32,39 +33,40 @@ export async function load(config: Config): Promise<GraphModel> {
export async function predict(image: Tensor, config: Config, idx, count) { export async function predict(image: Tensor, config: Config, idx, count) {
if (!model) return null; if (!model) return null;
if ((skipped < (config.face.emotion?.skipFrames || 0)) && config.skipFrame && (lastCount === count) && last[idx] && (last[idx].length > 0)) { if ((skipped < (config.face.emotion?.skipFrames || 0)) && ((config.face.emotion?.skipTime || 0) <= (now() - lastTime)) && config.skipFrame && (lastCount === count) && last[idx] && (last[idx].length > 0)) {
skipped++; skipped++;
return last[idx]; return last[idx];
} }
skipped = 0; skipped = 0;
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const resize = tf.image.resizeBilinear(image, [model?.inputs[0].shape ? model.inputs[0].shape[2] : 0, model?.inputs[0].shape ? model.inputs[0].shape[1] : 0], false);
const [red, green, blue] = tf.split(resize, 3, 3);
tf.dispose(resize);
// weighted rgb to grayscale: https://www.mathworks.com/help/matlab/ref/rgb2gray.html
const redNorm = tf.mul(red, rgb[0]);
const greenNorm = tf.mul(green, rgb[1]);
const blueNorm = tf.mul(blue, rgb[2]);
tf.dispose(red);
tf.dispose(green);
tf.dispose(blue);
const grayscale = tf.addN([redNorm, greenNorm, blueNorm]);
tf.dispose(redNorm);
tf.dispose(greenNorm);
tf.dispose(blueNorm);
const normalize = tf.tidy(() => tf.mul(tf.sub(grayscale, 0.5), 2));
tf.dispose(grayscale);
const obj: Array<{ score: number, emotion: string }> = []; const obj: Array<{ score: number, emotion: string }> = [];
if (config.face.emotion?.enabled) { if (config.face.emotion?.enabled) {
const resize = tf.image.resizeBilinear(image, [model?.inputs[0].shape ? model.inputs[0].shape[2] : 0, model?.inputs[0].shape ? model.inputs[0].shape[1] : 0], false);
const [red, green, blue] = tf.split(resize, 3, 3);
tf.dispose(resize);
// weighted rgb to grayscale: https://www.mathworks.com/help/matlab/ref/rgb2gray.html
const redNorm = tf.mul(red, rgb[0]);
const greenNorm = tf.mul(green, rgb[1]);
const blueNorm = tf.mul(blue, rgb[2]);
tf.dispose(red);
tf.dispose(green);
tf.dispose(blue);
const grayscale = tf.addN([redNorm, greenNorm, blueNorm]);
tf.dispose(redNorm);
tf.dispose(greenNorm);
tf.dispose(blueNorm);
const normalize = tf.tidy(() => tf.mul(tf.sub(grayscale, 0.5), 2));
tf.dispose(grayscale);
const emotionT = await model?.predict(normalize) as Tensor; // result is already in range 0..1, no need for additional activation const emotionT = await model?.predict(normalize) as Tensor; // result is already in range 0..1, no need for additional activation
lastTime = now();
const data = await emotionT.data(); const data = await emotionT.data();
tf.dispose(emotionT); tf.dispose(emotionT);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (data[i] > (config.face.emotion?.minConfidence || 0)) obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] }); if (data[i] > (config.face.emotion?.minConfidence || 0)) obj.push({ score: Math.min(0.99, Math.trunc(100 * data[i]) / 100), emotion: annotations[i] });
} }
obj.sort((a, b) => b.score - a.score); obj.sort((a, b) => b.score - a.score);
tf.dispose(normalize);
} }
tf.dispose(normalize);
last[idx] = obj; last[idx] = obj;
lastCount = count; lastCount = count;
resolve(obj); resolve(obj);

View File

@ -7,7 +7,7 @@
* Config placeholder: agegenderrace: { enabled: true, modelPath: 'gear.json' }, * Config placeholder: agegenderrace: { enabled: true, modelPath: 'gear.json' },
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
import type { Config } from '../config'; import type { Config } from '../config';
import type { GraphModel, Tensor } from '../tfjs/types'; import type { GraphModel, Tensor } from '../tfjs/types';
@ -16,6 +16,7 @@ import { env } from '../util/env';
let model: GraphModel | null; let model: GraphModel | null;
let last = { age: 0 }; let last = { age: 0 };
let lastTime = 0;
let skipped = Number.MAX_SAFE_INTEGER; let skipped = Number.MAX_SAFE_INTEGER;
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
@ -33,7 +34,7 @@ export async function load(config: Config | any) {
export async function predict(image: Tensor, config: Config) { export async function predict(image: Tensor, config: Config) {
if (!model) return null; if (!model) return null;
// @ts-ignore config disabled // @ts-ignore config disabled
if ((skipped < config.face.agegenderrace.skipFrames) && config.skipFrame && last.age && (last.age > 0)) { if ((skipped < config.face.agegenderrace?.skipFrames) && ((config.face.agegenderrace?.skipTime || 0) <= (now() - lastTime)) && config.skipFrame && last.age && (last.age > 0)) {
skipped++; skipped++;
return last; return last;
} }
@ -50,6 +51,7 @@ export async function predict(image: Tensor, config: Config) {
// @ts-ignore array definition unavailable at compile time // @ts-ignore array definition unavailable at compile time
if (config.face.agegenderrace.enabled) [ageT, genderT, raceT] = await model.execute(resize, ['age_output', 'gender_output', 'race_output']); if (config.face.agegenderrace.enabled) [ageT, genderT, raceT] = await model.execute(resize, ['age_output', 'gender_output', 'race_output']);
lastTime = now();
tf.dispose(resize); tf.dispose(resize);
// tf.dispose(enhance); // tf.dispose(enhance);

View File

@ -6,15 +6,15 @@
* Obsolete and replaced by `faceres` that performs age/gender/descriptor analysis * Obsolete and replaced by `faceres` that performs age/gender/descriptor analysis
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
import type { Config } from '../config'; import type { Config } from '../config';
import type { GraphModel, Tensor } from '../tfjs/types'; import type { GraphModel, Tensor } from '../tfjs/types';
import { env } from '../util/env'; import { env } from '../util/env';
let model: GraphModel | null; let model: GraphModel | null;
let last = { age: 0 }; let last = { age: 0 };
let lastTime = 0;
let skipped = Number.MAX_SAFE_INTEGER; let skipped = Number.MAX_SAFE_INTEGER;
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
@ -33,7 +33,7 @@ export async function load(config: Config | any) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
export async function predict(image: Tensor, config: Config | any) { export async function predict(image: Tensor, config: Config | any) {
if (!model) return null; if (!model) return null;
if ((skipped < config.face.age.skipFrames) && config.skipFrame && last.age && (last.age > 0)) { if ((skipped < config.face.age.skipFrames) && ((config.face.age.skipTime || 0) <= (now() - lastTime)) && config.skipFrame && last.age && (last.age > 0)) {
skipped++; skipped++;
return last; return last;
} }
@ -48,6 +48,7 @@ export async function predict(image: Tensor, config: Config | any) {
const obj = { age: 0 }; const obj = { age: 0 };
if (config.face.age.enabled) ageT = await model.predict(enhance); if (config.face.age.enabled) ageT = await model.predict(enhance);
lastTime = now();
tf.dispose(enhance); tf.dispose(enhance);
if (ageT) { if (ageT) {

View File

@ -6,7 +6,7 @@
* Obsolete and replaced by `faceres` that performs age/gender/descriptor analysis * Obsolete and replaced by `faceres` that performs age/gender/descriptor analysis
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
import type { Config } from '../config'; import type { Config } from '../config';
import type { GraphModel, Tensor } from '../tfjs/types'; import type { GraphModel, Tensor } from '../tfjs/types';
@ -14,6 +14,7 @@ import { env } from '../util/env';
let model: GraphModel | null; let model: GraphModel | null;
let last = { gender: '' }; let last = { gender: '' };
let lastTime = 0;
let skipped = Number.MAX_SAFE_INTEGER; let skipped = Number.MAX_SAFE_INTEGER;
let alternative = false; let alternative = false;
@ -35,7 +36,7 @@ export async function load(config: Config | any) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
export async function predict(image: Tensor, config: Config | any) { export async function predict(image: Tensor, config: Config | any) {
if (!model) return null; if (!model) return null;
if ((skipped < config.face.gender.skipFrames) && config.skipFrame && last.gender !== '') { if ((skipped < config.face.gender.skipFrames) && ((config.face.gender.skipTime || 0) <= (now() - lastTime)) && config.skipFrame && last.gender !== '') {
skipped++; skipped++;
return last; return last;
} }
@ -63,6 +64,7 @@ export async function predict(image: Tensor, config: Config | any) {
const obj = { gender: '', confidence: 0 }; const obj = { gender: '', confidence: 0 };
if (config.face.gender.enabled) genderT = await model.predict(enhance); if (config.face.gender.enabled) genderT = await model.predict(enhance);
lastTime = now();
tf.dispose(enhance); tf.dispose(enhance);
if (genderT) { if (genderT) {

View File

@ -8,12 +8,14 @@ import * as util from './handposeutil';
import type * as detector from './handposedetector'; import type * as detector from './handposedetector';
import type { Tensor, GraphModel } from '../tfjs/types'; import type { Tensor, GraphModel } from '../tfjs/types';
import { env } from '../util/env'; import { env } from '../util/env';
import { now } from '../util/util';
const palmBoxEnlargeFactor = 5; // default 3 const palmBoxEnlargeFactor = 5; // default 3
const handBoxEnlargeFactor = 1.65; // default 1.65 const handBoxEnlargeFactor = 1.65; // default 1.65
const palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2]; const palmLandmarkIds = [0, 5, 9, 13, 17, 1, 2];
const palmLandmarksPalmBase = 0; const palmLandmarksPalmBase = 0;
const palmLandmarksMiddleFingerBase = 2; const palmLandmarksMiddleFingerBase = 2;
let lastTime = 0;
export class HandPipeline { export class HandPipeline {
handDetector: detector.HandDetector; handDetector: detector.HandDetector;
@ -90,7 +92,7 @@ export class HandPipeline {
let boxes; let boxes;
// console.log('handpipeline:estimateHands:skip criteria', this.skipped, config.hand.skipFrames, !config.hand.landmarks, !config.skipFrame); // should skip hand detector? // console.log('handpipeline:estimateHands:skip criteria', this.skipped, config.hand.skipFrames, !config.hand.landmarks, !config.skipFrame); // should skip hand detector?
if ((this.skipped === 0) || (this.skipped > config.hand.skipFrames) || !config.hand.landmarks || !config.skipFrame) { if ((this.skipped === 0) || ((this.skipped > config.hand.skipFrames) && ((config.hand.skipTime || 0) <= (now() - lastTime))) || !config.hand.landmarks || !config.skipFrame) {
boxes = await this.handDetector.estimateHandBounds(image, config); boxes = await this.handDetector.estimateHandBounds(image, config);
this.skipped = 0; this.skipped = 0;
} }
@ -121,6 +123,7 @@ export class HandPipeline {
tf.dispose(croppedInput); tf.dispose(croppedInput);
tf.dispose(rotatedImage); tf.dispose(rotatedImage);
const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage) as Array<Tensor>; const [confidenceT, keypoints] = await this.handPoseModel.predict(handImage) as Array<Tensor>;
lastTime = now();
tf.dispose(handImage); tf.dispose(handImage);
const confidence = (await confidenceT.data())[0]; const confidence = (await confidenceT.data())[0];
tf.dispose(confidenceT); tf.dispose(confidenceT);

View File

@ -6,7 +6,7 @@
* - Hand Tracking: [**HandTracking**](https://github.com/victordibia/handtracking) * - Hand Tracking: [**HandTracking**](https://github.com/victordibia/handtracking)
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import * as box from '../util/box'; import * as box from '../util/box';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
import type { HandResult, Box, Point } from '../result'; import type { HandResult, Box, Point } from '../result';
@ -29,6 +29,7 @@ const maxDetectorResolution = 512;
const detectorExpandFact = 1.4; const detectorExpandFact = 1.4;
let skipped = 0; let skipped = 0;
let lastTime = 0;
let outputSize: [number, number] = [0, 0]; let outputSize: [number, number] = [0, 0];
type HandDetectResult = { type HandDetectResult = {
@ -184,7 +185,7 @@ async function detectFingers(input: Tensor, h: HandDetectResult, config: Config)
export async function predict(input: Tensor, config: Config): Promise<HandResult[]> { export async function predict(input: Tensor, config: Config): Promise<HandResult[]> {
/** handtrack caching /** handtrack caching
* 1. if skipFrame returned cached * 1. if skipFrame returned cached
* 2. if any cached results but although not sure if its enough we continute anyhow for 5x skipframes * 2. if any cached results but although not sure if its enough we continute anyhow for 3x skipframes
* 3. if not skipframe or eventually rerun detector to generated new cached boxes and reset skipped * 3. if not skipframe or eventually rerun detector to generated new cached boxes and reset skipped
* 4. generate cached boxes based on detected keypoints * 4. generate cached boxes based on detected keypoints
*/ */
@ -192,16 +193,17 @@ export async function predict(input: Tensor, config: Config): Promise<HandResult
outputSize = [input.shape[2] || 0, input.shape[1] || 0]; outputSize = [input.shape[2] || 0, input.shape[1] || 0];
skipped++; // increment skip frames skipped++; // increment skip frames
if (config.skipFrame && (skipped <= (config.hand.skipFrames || 0))) { if (config.skipFrame && (skipped <= (config.hand.skipFrames || 0)) && ((config.hand.skipTime || 0) <= (now() - lastTime))) {
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 && cache.hands.length === config.hand.maxDetected) { // we have all detected hands 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 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 } else if (config.skipFrame && skipped < 3 * (config.hand.skipFrames || 0) && ((config.hand.skipTime || 0) <= 3 * (now() - lastTime)) && cache.hands.length > 0) { // we have some cached results: maybe not enough but anyhow continue for bit longer
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 { // finally rerun detector } else { // finally rerun detector
cache.boxes = await detectHands(input, config); cache.boxes = await detectHands(input, config);
lastTime = now();
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;
} }

View File

@ -4,7 +4,7 @@
* Based on: [**NanoDet**](https://github.com/RangiLyu/nanodet) * Based on: [**NanoDet**](https://github.com/RangiLyu/nanodet)
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
import { labels } from './labels'; import { labels } from './labels';
import type { ObjectResult, Box } from '../result'; import type { ObjectResult, Box } from '../result';
@ -16,6 +16,7 @@ import { fakeOps } from '../tfjs/backend';
let model: GraphModel | null; let model: GraphModel | null;
let inputSize = 0; let inputSize = 0;
let last: ObjectResult[] = []; let last: ObjectResult[] = [];
let lastTime = 0;
let skipped = Number.MAX_SAFE_INTEGER; let skipped = Number.MAX_SAFE_INTEGER;
export async function load(config: Config): Promise<GraphModel> { export async function load(config: Config): Promise<GraphModel> {
@ -78,7 +79,7 @@ async function process(res: Tensor | null, outputShape, config: Config) {
} }
export async function predict(input: Tensor, config: Config): Promise<ObjectResult[]> { export async function predict(input: Tensor, config: Config): Promise<ObjectResult[]> {
if ((skipped < (config.object.skipFrames || 0)) && config.skipFrame && (last.length > 0)) { if ((skipped < (config.object.skipFrames || 0)) && ((config.object.skipTime || 0) <= (now() - lastTime)) && config.skipFrame && (last.length > 0)) {
skipped++; skipped++;
return last; return last;
} }
@ -88,6 +89,7 @@ export async function predict(input: Tensor, config: Config): Promise<ObjectResu
const outputSize = [input.shape[2], input.shape[1]]; const outputSize = [input.shape[2], input.shape[1]];
const resize = tf.image.resizeBilinear(input, [inputSize, inputSize]); const resize = tf.image.resizeBilinear(input, [inputSize, inputSize]);
const objectT = config.object.enabled ? model?.execute(resize, ['tower_0/detections']) as Tensor : null; const objectT = config.object.enabled ? model?.execute(resize, ['tower_0/detections']) as Tensor : null;
lastTime = now();
tf.dispose(resize); tf.dispose(resize);
const obj = await process(objectT, outputSize, config); const obj = await process(objectT, outputSize, config);

View File

@ -4,7 +4,7 @@
* Based on: [**MB3-CenterNet**](https://github.com/610265158/mobilenetv3_centernet) * Based on: [**MB3-CenterNet**](https://github.com/610265158/mobilenetv3_centernet)
*/ */
import { log, join } from '../util/util'; import { log, join, now } from '../util/util';
import * as tf from '../../dist/tfjs.esm.js'; import * as tf from '../../dist/tfjs.esm.js';
import { labels } from './labels'; import { labels } from './labels';
import type { ObjectResult, Box } from '../result'; import type { ObjectResult, Box } from '../result';
@ -14,6 +14,7 @@ import { env } from '../util/env';
let model; let model;
let last: Array<ObjectResult> = []; let last: Array<ObjectResult> = [];
let lastTime = 0;
let skipped = Number.MAX_SAFE_INTEGER; let skipped = Number.MAX_SAFE_INTEGER;
const scaleBox = 2.5; // increase box size const scaleBox = 2.5; // increase box size
@ -106,7 +107,7 @@ async function process(res, inputSize, outputShape, config) {
} }
export async function predict(image: Tensor, config: Config): Promise<ObjectResult[]> { export async function predict(image: Tensor, config: Config): Promise<ObjectResult[]> {
if ((skipped < (config.object.skipFrames || 0)) && config.skipFrame && (last.length > 0)) { if ((skipped < (config.object.skipFrames || 0)) && ((config.object.skipTime || 0) <= (now() - lastTime)) && config.skipFrame && (last.length > 0)) {
skipped++; skipped++;
return last; return last;
} }
@ -122,6 +123,7 @@ export async function predict(image: Tensor, config: Config): Promise<ObjectResu
let objectT; let objectT;
if (config.object.enabled) objectT = await model.predict(transpose); if (config.object.enabled) objectT = await model.predict(transpose);
lastTime = now();
tf.dispose(transpose); tf.dispose(transpose);
const obj = await process(objectT, model.inputSize, outputSize, config); const obj = await process(objectT, model.inputSize, outputSize, config);

View File

@ -1,26 +1,26 @@
2021-10-22 13:34:33 INFO:  @vladmandic/human version 2.4.0 2021-10-22 16:05:08 INFO:  @vladmandic/human version 2.4.0
2021-10-22 13:34:33 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.10.0 2021-10-22 16:05:08 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.10.0
2021-10-22 13:34:33 INFO:  Application: {"name":"@vladmandic/human","version":"2.4.0"} 2021-10-22 16:05:08 INFO:  Application: {"name":"@vladmandic/human","version":"2.4.0"}
2021-10-22 13:34:33 INFO:  Environment: {"profile":"production","config":"build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true} 2021-10-22 16:05:08 INFO:  Environment: {"profile":"production","config":"build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2021-10-22 13:34:33 INFO:  Toolchain: {"build":"0.6.2","esbuild":"0.13.8","typescript":"4.4.4","typedoc":"0.22.6","eslint":"8.0.1"} 2021-10-22 16:05:08 INFO:  Toolchain: {"build":"0.6.2","esbuild":"0.13.8","typescript":"4.4.4","typedoc":"0.22.6","eslint":"8.0.1"}
2021-10-22 13:34:33 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]} 2021-10-22 16:05:08 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2021-10-22 13:34:33 STATE: Clean: {"locations":["dist/*","types/*","typedoc/*"]} 2021-10-22 16:05:08 STATE: Clean: {"locations":["dist/*","types/*","typedoc/*"]}
2021-10-22 13:34:33 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":1275} 2021-10-22 16:05:08 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":1275}
2021-10-22 13:34:33 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":54,"inputBytes":523578,"outputBytes":436010} 2021-10-22 16:05:08 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":54,"inputBytes":525194,"outputBytes":437512}
2021-10-22 13:34:33 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":1283} 2021-10-22 16:05:08 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":1283}
2021-10-22 13:34:33 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":54,"inputBytes":523586,"outputBytes":436014} 2021-10-22 16:05:08 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":54,"inputBytes":525202,"outputBytes":437516}
2021-10-22 13:34:33 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":1350} 2021-10-22 16:05:08 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":1350}
2021-10-22 13:34:33 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":54,"inputBytes":523653,"outputBytes":436086} 2021-10-22 16:05:08 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":54,"inputBytes":525269,"outputBytes":437588}
2021-10-22 13:34:33 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1063,"outputBytes":1652} 2021-10-22 16:05:08 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1063,"outputBytes":1652}
2021-10-22 13:34:33 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":2365,"outputBytes":1030} 2021-10-22 16:05:08 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":2323,"outputBytes":973}
2021-10-22 13:34:33 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":54,"inputBytes":523333,"outputBytes":437997} 2021-10-22 16:05:08 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":54,"inputBytes":524892,"outputBytes":439413}
2021-10-22 13:34:33 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":2572202,"outputBytes":2491625} 2021-10-22 16:05:09 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":2572202,"outputBytes":2491625}
2021-10-22 13:34:34 STATE: Compile: {"name":"human/browser/esm/custom","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.custom.esm.js","files":54,"inputBytes":3013928,"outputBytes":2933042} 2021-10-22 16:05:10 STATE: Compile: {"name":"human/browser/esm/custom","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.custom.esm.js","files":54,"inputBytes":3015544,"outputBytes":2934547}
2021-10-22 13:34:35 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":8,"inputBytes":2365,"outputBytes":2411315} 2021-10-22 16:05:10 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":8,"inputBytes":2323,"outputBytes":1155160}
2021-10-22 13:34:35 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":54,"inputBytes":2933618,"outputBytes":1431470} 2021-10-22 16:05:11 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":54,"inputBytes":1679079,"outputBytes":1430229}
2021-10-22 13:34:36 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":54,"inputBytes":2933618,"outputBytes":2674673} 2021-10-22 16:05:11 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":54,"inputBytes":1679079,"outputBytes":1878008}
2021-10-22 13:34:56 STATE: Typings: {"input":"src/human.ts","output":"types","files":16} 2021-10-22 16:05:29 STATE: Typings: {"input":"src/human.ts","output":"types","files":16}
2021-10-22 13:35:03 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":36,"generated":true} 2021-10-22 16:05:36 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":37,"generated":true}
2021-10-22 13:35:46 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":90,"errors":0,"warnings":0} 2021-10-22 16:06:18 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":90,"errors":0,"warnings":0}
2021-10-22 13:35:46 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"} 2021-10-22 16:06:19 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2021-10-22 13:35:46 INFO:  Done... 2021-10-22 16:06:19 INFO:  Done...

File diff suppressed because it is too large Load Diff

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

View File

@ -1,9 +1,9 @@
<!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Config | @vladmandic/human - v2.4.0</title><meta name="description" content="Documentation for @vladmandic/human - v2.4.0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem(&quot;tsd-theme&quot;) || &quot;os&quot;)</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vladmandic/human - v2.4.0</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human - v2.4.0</a></li><li><a href="Config.html">Config</a></li></ul><h1>Interface Config</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead"> <!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Config | @vladmandic/human - v2.4.0</title><meta name="description" content="Documentation for @vladmandic/human - v2.4.0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem(&quot;tsd-theme&quot;) || &quot;os&quot;)</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vladmandic/human - v2.4.0</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human - v2.4.0</a></li><li><a href="Config.html">Config</a></li></ul><h1>Interface Config</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
<p>Configuration interface definition for <strong>Human</strong> library</p> <p>Configuration interface definition for <strong>Human</strong> library</p>
</div><div><p>Contains all configurable parameters</p> </div><div><p>Contains all configurable parameters</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Config</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#async" class="tsd-kind-icon">async</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#backend" class="tsd-kind-icon">backend</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#body" class="tsd-kind-icon">body</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#cacheSensitivity" class="tsd-kind-icon">cache<wbr/>Sensitivity</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#debug" class="tsd-kind-icon">debug</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#face" class="tsd-kind-icon">face</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#filter" class="tsd-kind-icon">filter</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#gesture" class="tsd-kind-icon">gesture</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#hand" class="tsd-kind-icon">hand</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#modelBasePath" class="tsd-kind-icon">model<wbr/>Base<wbr/>Path</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#object" class="tsd-kind-icon">object</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#segmentation" class="tsd-kind-icon">segmentation</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#skipFrame" class="tsd-kind-icon">skip<wbr/>Frame</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#warmup" class="tsd-kind-icon">warmup</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#wasmPath" class="tsd-kind-icon">wasm<wbr/>Path</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="async" class="tsd-anchor"></a><h3>async</h3><div class="tsd-signature tsd-kind-icon">async<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L257">config.ts:257</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Config</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#async" class="tsd-kind-icon">async</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#backend" class="tsd-kind-icon">backend</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#body" class="tsd-kind-icon">body</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#cacheSensitivity" class="tsd-kind-icon">cache<wbr/>Sensitivity</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#debug" class="tsd-kind-icon">debug</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#face" class="tsd-kind-icon">face</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#filter" class="tsd-kind-icon">filter</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#gesture" class="tsd-kind-icon">gesture</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#hand" class="tsd-kind-icon">hand</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#modelBasePath" class="tsd-kind-icon">model<wbr/>Base<wbr/>Path</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#object" class="tsd-kind-icon">object</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#segmentation" class="tsd-kind-icon">segmentation</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#skipFrame" class="tsd-kind-icon">skip<wbr/>Frame</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#warmup" class="tsd-kind-icon">warmup</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#wasmPath" class="tsd-kind-icon">wasm<wbr/>Path</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="async" class="tsd-anchor"></a><h3>async</h3><div class="tsd-signature tsd-kind-icon">async<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L238">config.ts:238</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Perform model loading and inference concurrently or sequentially</p> <p>Perform model loading and inference concurrently or sequentially</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="backend" class="tsd-anchor"></a><h3>backend</h3><div class="tsd-signature tsd-kind-icon">backend<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;cpu&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;wasm&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;webgl&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;humangl&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;tensorflow&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;webgpu&quot;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L245">config.ts:245</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="backend" class="tsd-anchor"></a><h3>backend</h3><div class="tsd-signature tsd-kind-icon">backend<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;cpu&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;wasm&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;webgl&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;humangl&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;tensorflow&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;webgpu&quot;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L226">config.ts:226</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Backend used for TFJS operations <p>Backend used for TFJS operations
Valid build-in backends are:</p> Valid build-in backends are:</p>
<ul> <ul>
@ -15,45 +15,45 @@ Valid build-in backends are:</p>
<li>Browser: <code>webgpu</code> - requires custom build of <code>tfjs-backend-webgpu</code></li> <li>Browser: <code>webgpu</code> - requires custom build of <code>tfjs-backend-webgpu</code></li>
</ul> </ul>
<p>Defaults: <code>humangl</code> for browser and <code>tensorflow</code> for nodejs</p> <p>Defaults: <code>humangl</code> for browser and <code>tensorflow</code> for nodejs</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="body" class="tsd-anchor"></a><h3>body</h3><div class="tsd-signature tsd-kind-icon">body<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="BodyConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">BodyConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L293">config.ts:293</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="body" class="tsd-anchor"></a><h3>body</h3><div class="tsd-signature tsd-kind-icon">body<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="BodyConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">BodyConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L274">config.ts:274</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="BodyConfig.html">BodyConfig</a></p> <p><a href="BodyConfig.html">BodyConfig</a></p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="cacheSensitivity" class="tsd-anchor"></a><h3>cache<wbr/>Sensitivity</h3><div class="tsd-signature tsd-kind-icon">cache<wbr/>Sensitivity<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L274">config.ts:274</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="cacheSensitivity" class="tsd-anchor"></a><h3>cache<wbr/>Sensitivity</h3><div class="tsd-signature tsd-kind-icon">cache<wbr/>Sensitivity<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L255">config.ts:255</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Cache sensitivity</p> <p>Cache sensitivity</p>
<ul> <ul>
<li>values 0..1 where 0.01 means reset cache if input changed more than 1%</li> <li>values 0..1 where 0.01 means reset cache if input changed more than 1%</li>
<li>set to 0 to disable caching</li> <li>set to 0 to disable caching</li>
</ul> </ul>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="debug" class="tsd-anchor"></a><h3>debug</h3><div class="tsd-signature tsd-kind-icon">debug<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L254">config.ts:254</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="debug" class="tsd-anchor"></a><h3>debug</h3><div class="tsd-signature tsd-kind-icon">debug<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L235">config.ts:235</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Print debug statements to console</p> <p>Print debug statements to console</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="face" class="tsd-anchor"></a><h3>face</h3><div class="tsd-signature tsd-kind-icon">face<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="FaceConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">FaceConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L290">config.ts:290</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="face" class="tsd-anchor"></a><h3>face</h3><div class="tsd-signature tsd-kind-icon">face<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="FaceConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">FaceConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L271">config.ts:271</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="FaceConfig.html">FaceConfig</a></p> <p><a href="FaceConfig.html">FaceConfig</a></p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="filter" class="tsd-anchor"></a><h3>filter</h3><div class="tsd-signature tsd-kind-icon">filter<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="FilterConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">FilterConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L284">config.ts:284</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="filter" class="tsd-anchor"></a><h3>filter</h3><div class="tsd-signature tsd-kind-icon">filter<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="FilterConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">FilterConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L265">config.ts:265</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Run input through image filters before inference</p> <p>Run input through image filters before inference</p>
<ul> <ul>
<li>image filters run with near-zero latency as they are executed on the GPU</li> <li>image filters run with near-zero latency as they are executed on the GPU</li>
</ul> </ul>
</div><div><p><a href="FilterConfig.html">FilterConfig</a></p> </div><div><p><a href="FilterConfig.html">FilterConfig</a></p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="gesture" class="tsd-anchor"></a><h3>gesture</h3><div class="tsd-signature tsd-kind-icon">gesture<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="GestureConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">GestureConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L287">config.ts:287</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="gesture" class="tsd-anchor"></a><h3>gesture</h3><div class="tsd-signature tsd-kind-icon">gesture<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="GestureConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">GestureConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L268">config.ts:268</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="GestureConfig.html">GestureConfig</a></p> <p><a href="GestureConfig.html">GestureConfig</a></p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="hand" class="tsd-anchor"></a><h3>hand</h3><div class="tsd-signature tsd-kind-icon">hand<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="HandConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">HandConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L296">config.ts:296</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="hand" class="tsd-anchor"></a><h3>hand</h3><div class="tsd-signature tsd-kind-icon">hand<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="HandConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">HandConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L277">config.ts:277</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="HandConfig.html">HandConfig</a></p> <p><a href="HandConfig.html">HandConfig</a></p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="modelBasePath" class="tsd-anchor"></a><h3>model<wbr/>Base<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Base<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L268">config.ts:268</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="modelBasePath" class="tsd-anchor"></a><h3>model<wbr/>Base<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Base<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L249">config.ts:249</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Base model path (typically starting with file://, http:// or https://) for all models</p> <p>Base model path (typically starting with file://, http:// or https://) for all models</p>
<ul> <ul>
<li>individual modelPath values are relative to this path</li> <li>individual modelPath values are relative to this path</li>
</ul> </ul>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="object" class="tsd-anchor"></a><h3>object</h3><div class="tsd-signature tsd-kind-icon">object<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="ObjectConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">ObjectConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L299">config.ts:299</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="object" class="tsd-anchor"></a><h3>object</h3><div class="tsd-signature tsd-kind-icon">object<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="ObjectConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">ObjectConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L280">config.ts:280</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="ObjectConfig.html">ObjectConfig</a></p> <p><a href="ObjectConfig.html">ObjectConfig</a></p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="segmentation" class="tsd-anchor"></a><h3>segmentation</h3><div class="tsd-signature tsd-kind-icon">segmentation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="SegmentationConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">SegmentationConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L302">config.ts:302</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="segmentation" class="tsd-anchor"></a><h3>segmentation</h3><div class="tsd-signature tsd-kind-icon">segmentation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="SegmentationConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">SegmentationConfig</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L283">config.ts:283</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="SegmentationConfig.html">SegmentationConfig</a></p> <p><a href="SegmentationConfig.html">SegmentationConfig</a></p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="skipFrame" class="tsd-anchor"></a><h3>skip<wbr/>Frame</h3><div class="tsd-signature tsd-kind-icon">skip<wbr/>Frame<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L277">config.ts:277</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="skipFrame" class="tsd-anchor"></a><h3>skip<wbr/>Frame</h3><div class="tsd-signature tsd-kind-icon">skip<wbr/>Frame<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L258">config.ts:258</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Internal Variable</p> <p>Internal Variable</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="warmup" class="tsd-anchor"></a><h3>warmup</h3><div class="tsd-signature tsd-kind-icon">warmup<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;face&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;body&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;none&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;full&quot;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L262">config.ts:262</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="warmup" class="tsd-anchor"></a><h3>warmup</h3><div class="tsd-signature tsd-kind-icon">warmup<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;face&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;body&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;none&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;full&quot;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L243">config.ts:243</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>What to use for <code>human.warmup()</code></p> <p>What to use for <code>human.warmup()</code></p>
<ul> <ul>
<li>warmup pre-initializes all models for faster inference but can take significant time on startup</li> <li>warmup pre-initializes all models for faster inference but can take significant time on startup</li>
</ul> </ul>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="wasmPath" class="tsd-anchor"></a><h3>wasm<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">wasm<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L251">config.ts:251</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="wasmPath" class="tsd-anchor"></a><h3>wasm<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">wasm<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L232">config.ts:232</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Path to *.wasm files if backend is set to <code>wasm</code></p> <p>Path to *.wasm files if backend is set to <code>wasm</code></p>
<ul> <ul>
<li>if not set, auto-detects to link to CDN <code>jsdelivr</code> when running in browser</li> <li>if not set, auto-detects to link to CDN <code>jsdelivr</code> when running in browser</li>

View File

@ -1,3 +0,0 @@
<!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>FaceAntiSpoofConfig | @vladmandic/human - v2.4.0</title><meta name="description" content="Documentation for @vladmandic/human - v2.4.0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem(&quot;tsd-theme&quot;) || &quot;os&quot;)</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vladmandic/human - v2.4.0</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human - v2.4.0</a></li><li><a href="FaceAntiSpoofConfig.html">FaceAntiSpoofConfig</a></li></ul><h1>Interface FaceAntiSpoofConfig</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
<p>Emotion part of face configuration</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">FaceAntiSpoofConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceAntiSpoofConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceAntiSpoofConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceAntiSpoofConfig.html#skipFrames" class="tsd-kind-icon">skip<wbr/>Frames</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L47">config.ts:47</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="modelPath" class="tsd-anchor"></a><h3>model<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L49">config.ts:49</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="skipFrames" class="tsd-anchor"></a><h3>skip<wbr/>Frames</h3><div class="tsd-signature tsd-kind-icon">skip<wbr/>Frames<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L48">config.ts:48</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="FaceAntiSpoofConfig.html" class="tsd-kind-icon">Face<wbr/>Anti<wbr/>Spoof<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceAntiSpoofConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceAntiSpoofConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceAntiSpoofConfig.html#skipFrames" class="tsd-kind-icon">skip<wbr/>Frames</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>

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

File diff suppressed because one or more lines are too long

View File

@ -1,3 +0,0 @@
<!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>FaceIrisConfig | @vladmandic/human - v2.4.0</title><meta name="description" content="Documentation for @vladmandic/human - v2.4.0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem(&quot;tsd-theme&quot;) || &quot;os&quot;)</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vladmandic/human - v2.4.0</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human - v2.4.0</a></li><li><a href="FaceIrisConfig.html">FaceIrisConfig</a></li></ul><h1>Interface FaceIrisConfig</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
<p>Iris part of face configuration</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">FaceIrisConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceIrisConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceIrisConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L23">config.ts:23</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="modelPath" class="tsd-anchor"></a><h3>model<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L24">config.ts:24</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="FaceIrisConfig.html" class="tsd-kind-icon">Face<wbr/>Iris<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceIrisConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceIrisConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>

View File

@ -1,3 +0,0 @@
<!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>FaceMeshConfig | @vladmandic/human - v2.4.0</title><meta name="description" content="Documentation for @vladmandic/human - v2.4.0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem(&quot;tsd-theme&quot;) || &quot;os&quot;)</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vladmandic/human - v2.4.0</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human - v2.4.0</a></li><li><a href="FaceMeshConfig.html">FaceMeshConfig</a></li></ul><h1>Interface FaceMeshConfig</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
<p>Mesh part of face configuration</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">FaceMeshConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceMeshConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceMeshConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L17">config.ts:17</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="modelPath" class="tsd-anchor"></a><h3>model<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L18">config.ts:18</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="FaceMeshConfig.html" class="tsd-kind-icon">Face<wbr/>Mesh<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceMeshConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FaceMeshConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>

View File

@ -4,44 +4,44 @@
<li>available only in Browser environments</li> <li>available only in Browser environments</li>
<li>image filters run with near-zero latency as they are executed on the GPU using WebGL</li> <li>image filters run with near-zero latency as they are executed on the GPU using WebGL</li>
</ul> </ul>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">FilterConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#brightness" class="tsd-kind-icon">brightness</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#contrast" class="tsd-kind-icon">contrast</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#flip" class="tsd-kind-icon">flip</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#height" class="tsd-kind-icon">height</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#hue" class="tsd-kind-icon">hue</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#kodachrome" class="tsd-kind-icon">kodachrome</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#negative" class="tsd-kind-icon">negative</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#pixelate" class="tsd-kind-icon">pixelate</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#polaroid" class="tsd-kind-icon">polaroid</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#return" class="tsd-kind-icon">return</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#saturation" class="tsd-kind-icon">saturation</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#sepia" class="tsd-kind-icon">sepia</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#sharpness" class="tsd-kind-icon">sharpness</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#technicolor" class="tsd-kind-icon">technicolor</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#vintage" class="tsd-kind-icon">vintage</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#width" class="tsd-kind-icon">width</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="blur" class="tsd-anchor"></a><h3>blur</h3><div class="tsd-signature tsd-kind-icon">blur<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L200">config.ts:200</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">FilterConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#brightness" class="tsd-kind-icon">brightness</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#contrast" class="tsd-kind-icon">contrast</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#flip" class="tsd-kind-icon">flip</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#height" class="tsd-kind-icon">height</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#hue" class="tsd-kind-icon">hue</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#kodachrome" class="tsd-kind-icon">kodachrome</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#negative" class="tsd-kind-icon">negative</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#pixelate" class="tsd-kind-icon">pixelate</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#polaroid" class="tsd-kind-icon">polaroid</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#return" class="tsd-kind-icon">return</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#saturation" class="tsd-kind-icon">saturation</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#sepia" class="tsd-kind-icon">sepia</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#sharpness" class="tsd-kind-icon">sharpness</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#technicolor" class="tsd-kind-icon">technicolor</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#vintage" class="tsd-kind-icon">vintage</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#width" class="tsd-kind-icon">width</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="blur" class="tsd-anchor"></a><h3>blur</h3><div class="tsd-signature tsd-kind-icon">blur<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L181">config.ts:181</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Range: 0 (no blur) to N (blur radius in pixels)</p> <p>Range: 0 (no blur) to N (blur radius in pixels)</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="brightness" class="tsd-anchor"></a><h3>brightness</h3><div class="tsd-signature tsd-kind-icon">brightness<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L194">config.ts:194</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="brightness" class="tsd-anchor"></a><h3>brightness</h3><div class="tsd-signature tsd-kind-icon">brightness<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L175">config.ts:175</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Range: -1 (darken) to 1 (lighten)</p> <p>Range: -1 (darken) to 1 (lighten)</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="contrast" class="tsd-anchor"></a><h3>contrast</h3><div class="tsd-signature tsd-kind-icon">contrast<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L196">config.ts:196</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="contrast" class="tsd-anchor"></a><h3>contrast</h3><div class="tsd-signature tsd-kind-icon">contrast<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L177">config.ts:177</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Range: -1 (reduce contrast) to 1 (increase contrast)</p> <p>Range: -1 (reduce contrast) to 1 (increase contrast)</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L176">config.ts:176</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="flip" class="tsd-anchor"></a><h3>flip</h3><div class="tsd-signature tsd-kind-icon">flip<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L192">config.ts:192</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L157">config.ts:157</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="flip" class="tsd-anchor"></a><h3>flip</h3><div class="tsd-signature tsd-kind-icon">flip<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L173">config.ts:173</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Flip input as mirror image</p> <p>Flip input as mirror image</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="height" class="tsd-anchor"></a><h3>height</h3><div class="tsd-signature tsd-kind-icon">height<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L188">config.ts:188</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="height" class="tsd-anchor"></a><h3>height</h3><div class="tsd-signature tsd-kind-icon">height<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L169">config.ts:169</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Resize input height</p> <p>Resize input height</p>
<ul> <ul>
<li>if both width and height are set to 0, there is no resizing</li> <li>if both width and height are set to 0, there is no resizing</li>
<li>if just one is set, second one is scaled automatically</li> <li>if just one is set, second one is scaled automatically</li>
<li>if both are set, values are used as-is</li> <li>if both are set, values are used as-is</li>
</ul> </ul>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="hue" class="tsd-anchor"></a><h3>hue</h3><div class="tsd-signature tsd-kind-icon">hue<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L204">config.ts:204</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="hue" class="tsd-anchor"></a><h3>hue</h3><div class="tsd-signature tsd-kind-icon">hue<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L185">config.ts:185</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Range: 0 (no change) to 360 (hue rotation in degrees)</p> <p>Range: 0 (no change) to 360 (hue rotation in degrees)</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="kodachrome" class="tsd-anchor"></a><h3>kodachrome</h3><div class="tsd-signature tsd-kind-icon">kodachrome<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L212">config.ts:212</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="kodachrome" class="tsd-anchor"></a><h3>kodachrome</h3><div class="tsd-signature tsd-kind-icon">kodachrome<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L193">config.ts:193</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Image kodachrome colors</p> <p>Image kodachrome colors</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="negative" class="tsd-anchor"></a><h3>negative</h3><div class="tsd-signature tsd-kind-icon">negative<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L206">config.ts:206</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="negative" class="tsd-anchor"></a><h3>negative</h3><div class="tsd-signature tsd-kind-icon">negative<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L187">config.ts:187</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Image negative</p> <p>Image negative</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="pixelate" class="tsd-anchor"></a><h3>pixelate</h3><div class="tsd-signature tsd-kind-icon">pixelate<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L218">config.ts:218</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="pixelate" class="tsd-anchor"></a><h3>pixelate</h3><div class="tsd-signature tsd-kind-icon">pixelate<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L199">config.ts:199</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Range: 0 (no pixelate) to N (number of pixels to pixelate)</p> <p>Range: 0 (no pixelate) to N (number of pixels to pixelate)</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="polaroid" class="tsd-anchor"></a><h3>polaroid</h3><div class="tsd-signature tsd-kind-icon">polaroid<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L216">config.ts:216</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="polaroid" class="tsd-anchor"></a><h3>polaroid</h3><div class="tsd-signature tsd-kind-icon">polaroid<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L197">config.ts:197</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Image polaroid camera effect</p> <p>Image polaroid camera effect</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="return" class="tsd-anchor"></a><h3>return</h3><div class="tsd-signature tsd-kind-icon">return<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L190">config.ts:190</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="return" class="tsd-anchor"></a><h3>return</h3><div class="tsd-signature tsd-kind-icon">return<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L171">config.ts:171</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Return processed canvas imagedata in result</p> <p>Return processed canvas imagedata in result</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="saturation" class="tsd-anchor"></a><h3>saturation</h3><div class="tsd-signature tsd-kind-icon">saturation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L202">config.ts:202</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="saturation" class="tsd-anchor"></a><h3>saturation</h3><div class="tsd-signature tsd-kind-icon">saturation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L183">config.ts:183</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Range: -1 (reduce saturation) to 1 (increase saturation)</p> <p>Range: -1 (reduce saturation) to 1 (increase saturation)</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="sepia" class="tsd-anchor"></a><h3>sepia</h3><div class="tsd-signature tsd-kind-icon">sepia<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L208">config.ts:208</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="sepia" class="tsd-anchor"></a><h3>sepia</h3><div class="tsd-signature tsd-kind-icon">sepia<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L189">config.ts:189</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Image sepia colors</p> <p>Image sepia colors</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="sharpness" class="tsd-anchor"></a><h3>sharpness</h3><div class="tsd-signature tsd-kind-icon">sharpness<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L198">config.ts:198</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="sharpness" class="tsd-anchor"></a><h3>sharpness</h3><div class="tsd-signature tsd-kind-icon">sharpness<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L179">config.ts:179</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Range: 0 (no sharpening) to 1 (maximum sharpening)</p> <p>Range: 0 (no sharpening) to 1 (maximum sharpening)</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="technicolor" class="tsd-anchor"></a><h3>technicolor</h3><div class="tsd-signature tsd-kind-icon">technicolor<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L214">config.ts:214</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="technicolor" class="tsd-anchor"></a><h3>technicolor</h3><div class="tsd-signature tsd-kind-icon">technicolor<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L195">config.ts:195</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Image technicolor colors</p> <p>Image technicolor colors</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="vintage" class="tsd-anchor"></a><h3>vintage</h3><div class="tsd-signature tsd-kind-icon">vintage<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L210">config.ts:210</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="vintage" class="tsd-anchor"></a><h3>vintage</h3><div class="tsd-signature tsd-kind-icon">vintage<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L191">config.ts:191</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Image vintage colors</p> <p>Image vintage colors</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="width" class="tsd-anchor"></a><h3>width</h3><div class="tsd-signature tsd-kind-icon">width<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L182">config.ts:182</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="width" class="tsd-anchor"></a><h3>width</h3><div class="tsd-signature tsd-kind-icon">width<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L163">config.ts:163</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Resize input width</p> <p>Resize input width</p>
<ul> <ul>
<li>if both width and height are set to 0, there is no resizing</li> <li>if both width and height are set to 0, there is no resizing</li>

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
<!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>GestureConfig | @vladmandic/human - v2.4.0</title><meta name="description" content="Documentation for @vladmandic/human - v2.4.0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem(&quot;tsd-theme&quot;) || &quot;os&quot;)</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vladmandic/human - v2.4.0</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human - v2.4.0</a></li><li><a href="GestureConfig.html">GestureConfig</a></li></ul><h1>Interface GestureConfig</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead"> <!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>GestureConfig | @vladmandic/human - v2.4.0</title><meta name="description" content="Documentation for @vladmandic/human - v2.4.0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem(&quot;tsd-theme&quot;) || &quot;os&quot;)</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vladmandic/human - v2.4.0</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human - v2.4.0</a></li><li><a href="GestureConfig.html">GestureConfig</a></li></ul><h1>Interface GestureConfig</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
<p>Controlls gesture detection</p> <p>Controlls gesture detection</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">GestureConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GestureConfig.html#enabled" class="tsd-kind-icon">enabled</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L223">config.ts:223</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="GestureConfig.html" class="tsd-kind-icon">Gesture<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GestureConfig.html#enabled" class="tsd-kind-icon">enabled</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html> </div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">GestureConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GestureConfig.html#enabled" class="tsd-kind-icon">enabled</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L204">config.ts:204</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="GestureConfig.html" class="tsd-kind-icon">Gesture<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GestureConfig.html#enabled" class="tsd-kind-icon">enabled</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -11,4 +11,4 @@ remove background or replace it with user-provided background</p>
</ul> </ul>
<p>Changing <code>modelPath</code> will change module responsible for hand detection and tracking <p>Changing <code>modelPath</code> will change module responsible for hand detection and tracking
Allowed values are <code>selfie.json</code> and <code>meet.json</code></p> Allowed values are <code>selfie.json</code> and <code>meet.json</code></p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">SegmentationConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="blur" class="tsd-anchor"></a><h3>blur</h3><div class="tsd-signature tsd-kind-icon">blur<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L168">config.ts:168</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L166">config.ts:166</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="modelPath" class="tsd-anchor"></a><h3>model<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L167">config.ts:167</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="SegmentationConfig.html" class="tsd-kind-icon">Segmentation<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html> </div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">SegmentationConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="blur" class="tsd-anchor"></a><h3>blur</h3><div class="tsd-signature tsd-kind-icon">blur<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L149">config.ts:149</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L147">config.ts:147</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="modelPath" class="tsd-anchor"></a><h3>model<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L148">config.ts:148</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="SegmentationConfig.html" class="tsd-kind-icon">Segmentation<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>

2680
types/dist/tfjs.esm.d.ts vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"file":"blazepose.d.ts","sourceRoot":"","sources":["../../../src/body/blazepose.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAgB,UAAU,EAAc,MAAM,WAAW,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAWxC,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAWpE;AAED,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAalE;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,CAI1F;AAoFD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAUlF"} {"version":3,"file":"blazepose.d.ts","sourceRoot":"","sources":["../../../src/body/blazepose.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAgB,UAAU,EAAc,MAAM,WAAW,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAYxC,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAWpE;AAED,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAalE;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,CAI1F;AAoFD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAWlF"}

View File

@ -1 +1 @@
{"version":3,"file":"efficientpose.d.ts","sourceRoot":"","sources":["../../../src/body/efficientpose.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAS,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAaxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ9D;AAmBD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAgFlF"} {"version":3,"file":"efficientpose.d.ts","sourceRoot":"","sources":["../../../src/body/efficientpose.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAS,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAaxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ9D;AAmBD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA4ElF"}

View File

@ -1 +1 @@
{"version":3,"file":"movenet.d.ts","sourceRoot":"","sources":["../../../src/body/movenet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAgB,UAAU,EAAc,MAAM,WAAW,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAiBxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAW9D;AAyFD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAiElF"} {"version":3,"file":"movenet.d.ts","sourceRoot":"","sources":["../../../src/body/movenet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAgB,UAAU,EAAc,MAAM,WAAW,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAmBxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAW9D;AAyFD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA2DlF"}

52
types/src/config.d.ts vendored
View File

@ -1,45 +1,33 @@
/** Dectector part of face configuration */ export interface GenericConfig {
export interface FaceDetectorConfig { enabled: boolean;
modelPath: string; modelPath: string;
skipFrames: number;
skipTime: number;
}
/** Dectector part of face configuration */
export interface FaceDetectorConfig extends GenericConfig {
rotation: boolean; rotation: boolean;
maxDetected: number; maxDetected: number;
skipFrames: number;
minConfidence: number; minConfidence: number;
iouThreshold: number; iouThreshold: number;
return: boolean; return: boolean;
} }
/** Mesh part of face configuration */ /** Mesh part of face configuration */
export interface FaceMeshConfig { export declare type FaceMeshConfig = GenericConfig;
enabled: boolean;
modelPath: string;
}
/** Iris part of face configuration */ /** Iris part of face configuration */
export interface FaceIrisConfig { export declare type FaceIrisConfig = GenericConfig;
enabled: boolean;
modelPath: string;
}
/** Description or face embedding part of face configuration /** Description or face embedding part of face configuration
* - also used by age and gender detection * - also used by age and gender detection
*/ */
export interface FaceDescriptionConfig { export interface FaceDescriptionConfig extends GenericConfig {
enabled: boolean;
modelPath: string;
skipFrames: number;
minConfidence: number; minConfidence: number;
} }
/** Emotion part of face configuration */ /** Emotion part of face configuration */
export interface FaceEmotionConfig { export interface FaceEmotionConfig extends GenericConfig {
enabled: boolean;
minConfidence: number; minConfidence: number;
skipFrames: number;
modelPath: string;
} }
/** Emotion part of face configuration */ /** Emotion part of face configuration */
export interface FaceAntiSpoofConfig { export declare type FaceAntiSpoofConfig = GenericConfig;
enabled: boolean;
skipFrames: number;
modelPath: string;
}
/** Controlls and configures all face-specific options: /** Controlls and configures all face-specific options:
* - face detection, face mesh detection, age, gender, emotion detection and face description * - face detection, face mesh detection, age, gender, emotion detection and face description
* *
@ -76,17 +64,14 @@ export interface FaceConfig {
* Changing `modelPath` will change module responsible for hand detection and tracking * Changing `modelPath` will change module responsible for hand detection and tracking
* Allowed values are `posenet.json`, `blazepose.json`, `efficientpose.json`, `movenet-lightning.json`, `movenet-thunder.json`, `movenet-multipose.json` * Allowed values are `posenet.json`, `blazepose.json`, `efficientpose.json`, `movenet-lightning.json`, `movenet-thunder.json`, `movenet-multipose.json`
*/ */
export interface BodyConfig { export interface BodyConfig extends GenericConfig {
enabled: boolean;
modelPath: string;
maxDetected: number; maxDetected: number;
minConfidence: number; minConfidence: number;
skipFrames: number;
detector?: { detector?: {
modelPath: string; modelPath: string;
}; };
} }
/** Controlls and configures all hand detection specific options /** Controls and configures all hand detection specific options
* *
* Parameters: * Parameters:
* - enabled: true/false * - enabled: true/false
@ -102,10 +87,8 @@ export interface BodyConfig {
* Changing `detector.modelPath` will change module responsible for hand detection and tracking * Changing `detector.modelPath` will change module responsible for hand detection and tracking
* Allowed values are `handdetect.json` and `handtrack.json` * Allowed values are `handdetect.json` and `handtrack.json`
*/ */
export interface HandConfig { export interface HandConfig extends GenericConfig {
enabled: boolean;
rotation: boolean; rotation: boolean;
skipFrames: number;
minConfidence: number; minConfidence: number;
iouThreshold: number; iouThreshold: number;
maxDetected: number; maxDetected: number;
@ -127,13 +110,10 @@ export interface HandConfig {
* Changing `modelPath` will change module responsible for hand detection and tracking * Changing `modelPath` will change module responsible for hand detection and tracking
* Allowed values are `mb3-centernet.json` and `nanodet.json` * Allowed values are `mb3-centernet.json` and `nanodet.json`
*/ */
export interface ObjectConfig { export interface ObjectConfig extends GenericConfig {
enabled: boolean;
modelPath: string;
minConfidence: number; minConfidence: number;
iouThreshold: number; iouThreshold: number;
maxDetected: number; maxDetected: number;
skipFrames: number;
} }
/** Controlls and configures all body segmentation module /** Controlls and configures all body segmentation module
* removes background from input containing person * removes background from input containing person

View File

@ -1 +1 @@
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAGA,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,yCAAyC;AACzC,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;EAWE;AACF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACtC,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9B,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC5C,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACzC;AAED;;;;;;;;;;;;;;EAcE;AACF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QACT,SAAS,EAAE,MAAM,CAAA;KAClB,CAAC;CACH;AAED;;;;;;;;;;;;;;;EAeE;AACF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,QAAQ,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;;;;;;;;EASE;AACF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;EAaE;AACF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;EAGE;AACF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB;;;;MAIE;IACF,KAAK,EAAE,MAAM,CAAC;IACd;;;;MAIE;IACF,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAA;IACZ,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,qBAAqB;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,yBAAyB;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,2BAA2B;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,+BAA+B;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,mCAAmC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,kCAAkC;AAClC,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,MAAM;IACrB;;;;;;;;;MASE;IACF,OAAO,EAAE,EAAE,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;IAG7E;;MAEE;IACF,QAAQ,EAAE,MAAM,CAAC;IAEjB,wCAAwC;IACxC,KAAK,EAAE,OAAO,CAAC;IAEf,uEAAuE;IACvE,KAAK,EAAE,OAAO,CAAC;IAEf;;MAEE;IACF,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAG1C;;MAEE;IACF,aAAa,EAAE,MAAM,CAAC;IAEtB;;;MAGE;IACF,gBAAgB,EAAE,MAAM,CAAC;IAEzB,wBAAwB;IACxB,SAAS,EAAE,OAAO,CAAC;IAEnB;;;;MAIE;IACF,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9B,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhC,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,2BAA2B;IAC3B,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9B,iCAAiC;IACjC,YAAY,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,QAAA,MAAM,MAAM,EAAE,MA2Kb,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,CAAC"} {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,2CAA2C;AAC3C,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,sCAAsC;AACtC,oBAAY,cAAc,GAAG,aAAa,CAAA;AAE1C,sCAAsC;AACtC,oBAAY,cAAc,GAAG,aAAa,CAAA;AAE1C;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,yCAAyC;AACzC,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,yCAAyC;AACzC,oBAAY,mBAAmB,GAAG,aAAa,CAAA;AAE/C;;;;;;;;;;;EAWE;AACF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACtC,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9B,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC5C,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACzC;AAED;;;;;;;;;;;;;;EAcE;AACF,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE;QACT,SAAS,EAAE,MAAM,CAAA;KAClB,CAAC;CACH;AAED;;;;;;;;;;;;;;;EAeE;AACF,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,QAAQ,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;;;;;;;;EASE;AACF,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;EAaE;AACF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;EAGE;AACF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB;;;;MAIE;IACF,KAAK,EAAE,MAAM,CAAC;IACd;;;;MAIE;IACF,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAA;IACZ,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,qBAAqB;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,yBAAyB;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,2BAA2B;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,+BAA+B;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,mCAAmC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,kCAAkC;AAClC,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,MAAM;IACrB;;;;;;;;;MASE;IACF,OAAO,EAAE,EAAE,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;IAG7E;;MAEE;IACF,QAAQ,EAAE,MAAM,CAAC;IAEjB,wCAAwC;IACxC,KAAK,EAAE,OAAO,CAAC;IAEf,uEAAuE;IACvE,KAAK,EAAE,OAAO,CAAC;IAEf;;MAEE;IACF,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAG1C;;MAEE;IACF,aAAa,EAAE,MAAM,CAAC;IAEtB;;;MAGE;IACF,gBAAgB,EAAE,MAAM,CAAC;IAEzB,wBAAwB;IACxB,SAAS,EAAE,OAAO,CAAC;IAEnB;;;;MAIE;IACF,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9B,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhC,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,2BAA2B;IAC3B,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9B,iCAAiC;IACjC,YAAY,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,QAAA,MAAM,MAAM,EAAE,MAmLb,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,CAAC"}

View File

@ -1 +1 @@
{"version":3,"file":"antispoof.d.ts","sourceRoot":"","sources":["../../../src/face/antispoof.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AASxD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ9D;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBAgBtE"} {"version":3,"file":"antispoof.d.ts","sourceRoot":"","sources":["../../../src/face/antispoof.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAUxD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ9D;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBAiBtE"}

View File

@ -1 +1 @@
{"version":3,"file":"facemesh.d.ts","sourceRoot":"","sources":["../../../src/face/facemesh.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAS,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAUxC,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA+FlF;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAU9D;AAED,eAAO,MAAM,aAAa,UAAgB,CAAC;AAC3C,eAAO,MAAM,KAAK,oBAAe,CAAC"} {"version":3,"file":"facemesh.d.ts","sourceRoot":"","sources":["../../../src/face/facemesh.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAS,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAWxC,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAiGlF;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAU9D;AAED,eAAO,MAAM,aAAa,UAAgB,CAAC;AAC3C,eAAO,MAAM,KAAK,oBAAe,CAAC"}

View File

@ -1 +1 @@
{"version":3,"file":"faceres.d.ts","sourceRoot":"","sources":["../../../src/face/faceres.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAcxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAS9D;AAED,wBAAgB,OAAO,CAAC,KAAK,KAAA,GAAG,MAAM,CAmDrC;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBA8CtE"} {"version":3,"file":"faceres.d.ts","sourceRoot":"","sources":["../../../src/face/faceres.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAexC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAS9D;AAED,wBAAgB,OAAO,CAAC,KAAK,KAAA,GAAG,MAAM,CAmDrC;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBA8CtE"}

View File

@ -1 +1 @@
{"version":3,"file":"emotion.d.ts","sourceRoot":"","sources":["../../../src/gear/emotion.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAcxD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ9D;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBAuCtE"} {"version":3,"file":"emotion.d.ts","sourceRoot":"","sources":["../../../src/gear/emotion.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAexD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ9D;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBAwCtE"}

View File

@ -1 +1 @@
{"version":3,"file":"gear-agegenderrace.d.ts","sourceRoot":"","sources":["../../../src/gear/gear-agegenderrace.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AASxD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,uBAQ9C;AAGD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBA0C1D"} {"version":3,"file":"gear-agegenderrace.d.ts","sourceRoot":"","sources":["../../../src/gear/gear-agegenderrace.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAUxD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,uBAQ9C;AAGD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBA2C1D"}

View File

@ -1 +1 @@
{"version":3,"file":"handposepipeline.d.ts","sourceRoot":"","sources":["../../../src/hand/handposepipeline.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAU,UAAU,EAAE,MAAM,eAAe,CAAC;AASxD,qBAAa,YAAY;IACvB,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC;IACpC,aAAa,EAAE,UAAU,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAAC,aAAa,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACrH,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;gBAEV,YAAY,KAAA,EAAE,aAAa,KAAA;IAUvC,6BAA6B,CAAC,SAAS,KAAA;;;;IAQvC,sBAAsB,CAAC,aAAa,KAAA,EAAE,cAAc,KAAA;;;;;IAMpD,sBAAsB,CAAC,SAAS,KAAA;;;;;IAUhC,kBAAkB,CAAC,SAAS,KAAA,EAAE,IAAI,KAAA,EAAE,KAAK,KAAA,EAAE,cAAc,KAAA;IA0BnD,aAAa,CAAC,KAAK,KAAA,EAAE,MAAM,KAAA;mBAoBC,MAAM,EAAE;oBAAc,MAAM;uBAAiB,MAAM;0BAAoB,MAAM;aAAO;YAAE,OAAO,EAAE,MAAM,EAAE,CAAC;YAAC,WAAW,EAAE,MAAM,EAAE,CAAA;SAAE;;CA2DnK"} {"version":3,"file":"handposepipeline.d.ts","sourceRoot":"","sources":["../../../src/hand/handposepipeline.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAU,UAAU,EAAE,MAAM,eAAe,CAAC;AAWxD,qBAAa,YAAY;IACvB,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC;IACpC,aAAa,EAAE,UAAU,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAAC,aAAa,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACrH,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;gBAEV,YAAY,KAAA,EAAE,aAAa,KAAA;IAUvC,6BAA6B,CAAC,SAAS,KAAA;;;;IAQvC,sBAAsB,CAAC,aAAa,KAAA,EAAE,cAAc,KAAA;;;;;IAMpD,sBAAsB,CAAC,SAAS,KAAA;;;;;IAUhC,kBAAkB,CAAC,SAAS,KAAA,EAAE,IAAI,KAAA,EAAE,KAAK,KAAA,EAAE,cAAc,KAAA;IA0BnD,aAAa,CAAC,KAAK,KAAA,EAAE,MAAM,KAAA;mBAoBC,MAAM,EAAE;oBAAc,MAAM;uBAAiB,MAAM;0BAAoB,MAAM;aAAO;YAAE,OAAO,EAAE,MAAM,EAAE,CAAC;YAAC,WAAW,EAAE,MAAM,EAAE,CAAA;SAAE;;CA4DnK"}

View File

@ -1 +1 @@
{"version":3,"file":"handtrack.d.ts","sourceRoot":"","sources":["../../../src/hand/handtrack.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA8CxC,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAepE;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAWtE;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,CAI1F;AA0FD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA6ClF"} {"version":3,"file":"handtrack.d.ts","sourceRoot":"","sources":["../../../src/hand/handtrack.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA+CxC,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAepE;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAWtE;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,CAI1F;AA0FD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA8ClF"}

View File

@ -1 +1 @@
{"version":3,"file":"centernet.d.ts","sourceRoot":"","sources":["../../../src/object/centernet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAO,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AASxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAW9D;AAgDD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAkBpF"} {"version":3,"file":"centernet.d.ts","sourceRoot":"","sources":["../../../src/object/centernet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAO,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAUxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAW9D;AAgDD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAmBpF"}

View File

@ -1 +1 @@
{"version":3,"file":"nanodet.d.ts","sourceRoot":"","sources":["../../../src/object/nanodet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAO,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AASxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAU9D;AA6ED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAuBpF"} {"version":3,"file":"nanodet.d.ts","sourceRoot":"","sources":["../../../src/object/nanodet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAO,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAUxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAU9D;AA6ED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAwBpF"}