optimize model loading

pull/193/head
Vladimir Mandic 2021-09-23 14:09:41 -04:00
parent 36e9ca363c
commit 8ad491a5ea
40 changed files with 3425 additions and 3208 deletions

View File

@ -31,10 +31,10 @@ import jsonView from './helpers/jsonview.js';
let human; let human;
let userConfig = { let userConfig = {
/*
warmup: 'none', warmup: 'none',
backend: 'humangl', backend: 'humangl',
debug: true, debug: true,
/*
wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.9.0/dist/', wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.9.0/dist/',
async: false, async: false,
cacheSensitivity: 0.75, cacheSensitivity: 0.75,
@ -51,8 +51,8 @@ let userConfig = {
}, },
object: { enabled: false }, object: { enabled: false },
gesture: { enabled: true }, gesture: { enabled: true },
hand: { enabled: false }, // hand: { enabled: false },
// hand: { enabled: true, maxDetected: 1, minConfidence: 0.5, detector: { modelPath: 'handtrack.json' } }, hand: { enabled: true, maxDetected: 1, minConfidence: 0.5, detector: { modelPath: 'handtrack.json' } },
body: { enabled: false }, body: { enabled: false },
// body: { enabled: true, modelPath: 'movenet-multipose.json' }, // body: { enabled: true, modelPath: 'movenet-multipose.json' },
// body: { enabled: true, modelPath: 'posenet.json' }, // body: { enabled: true, modelPath: 'posenet.json' },

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

692
dist/human.esm.js vendored
View File

@ -36200,11 +36200,11 @@ var SkipIterator = class extends LazyIterator {
} }
async serialNext() { async serialNext() {
while (this.count++ < this.maxCount) { while (this.count++ < this.maxCount) {
const skipped8 = await this.upstream.next(); const skipped9 = await this.upstream.next();
if (skipped8.done) { if (skipped9.done) {
return skipped8; return skipped9;
} }
dispose(skipped8.value); dispose(skipped9.value);
} }
return this.upstream.next(); return this.upstream.next();
} }
@ -60461,16 +60461,16 @@ function decodeBounds(boxOutputs, anchors3, inputSize3) {
return concat2d([startNormalized, endNormalized], concatAxis); return concat2d([startNormalized, endNormalized], concatAxis);
} }
var BlazeFaceModel = class { var BlazeFaceModel = class {
constructor(model11, config3) { constructor(model12, config3) {
__publicField(this, "model"); __publicField(this, "model");
__publicField(this, "anchorsData"); __publicField(this, "anchorsData");
__publicField(this, "anchors"); __publicField(this, "anchors");
__publicField(this, "inputSize"); __publicField(this, "inputSize");
__publicField(this, "config"); __publicField(this, "config");
this.model = model11; this.model = model12;
this.anchorsData = generateAnchors(model11.inputs[0].shape[1]); this.anchorsData = generateAnchors(model12.inputs[0].shape[1]);
this.anchors = tensor2d(this.anchorsData); this.anchors = tensor2d(this.anchorsData);
this.inputSize = model11.inputs[0].shape[2]; this.inputSize = model12.inputs[0].shape[2];
this.config = config3; this.config = config3;
} }
async getBoundingBoxes(inputImage, userConfig) { async getBoundingBoxes(inputImage, userConfig) {
@ -60522,12 +60522,12 @@ var BlazeFaceModel = class {
}; };
async function load(config3) { async function load(config3) {
var _a, _b, _c; var _a, _b, _c;
const model11 = await loadGraphModel(join(config3.modelBasePath, ((_a = config3.face.detector) == null ? void 0 : _a.modelPath) || ""), { fromTFHub: (((_b = config3.face.detector) == null ? void 0 : _b.modelPath) || "").includes("tfhub.dev") }); const model12 = await loadGraphModel(join(config3.modelBasePath, ((_a = config3.face.detector) == null ? void 0 : _a.modelPath) || ""), { fromTFHub: (((_b = config3.face.detector) == null ? void 0 : _b.modelPath) || "").includes("tfhub.dev") });
const blazeFace = new BlazeFaceModel(model11, config3); const blazeFace = new BlazeFaceModel(model12, config3);
if (!model11 || !model11.modelUrl) if (!model12 || !model12.modelUrl)
log("load model failed:", ((_c = config3.face.detector) == null ? void 0 : _c.modelPath) || ""); log("load model failed:", ((_c = config3.face.detector) == null ? void 0 : _c.modelPath) || "");
else if (config3.debug) else if (config3.debug)
log("load model:", model11.modelUrl); log("load model:", model12.modelUrl);
return blazeFace; return blazeFace;
} }
@ -64947,7 +64947,12 @@ var Pipeline = class {
dispose(rotated); dispose(rotated);
return [angle, rotationMatrix, face5]; return [angle, rotationMatrix, face5];
} }
async augmentIris(rawCoords, face5) { async augmentIris(rawCoords, face5, config3) {
if (!this.irisModel) {
if (config3.debug)
log("face mesh detection requested, but model is not loaded");
return rawCoords;
}
const { box: leftEyeBox, boxSize: leftEyeBoxSize, crop: leftEyeCrop } = this.getEyeBox(rawCoords, face5, eyeLandmarks.leftBounds[0], eyeLandmarks.leftBounds[1], true); const { box: leftEyeBox, boxSize: leftEyeBoxSize, crop: leftEyeCrop } = this.getEyeBox(rawCoords, face5, eyeLandmarks.leftBounds[0], eyeLandmarks.leftBounds[1], true);
const { box: rightEyeBox, boxSize: rightEyeBoxSize, crop: rightEyeCrop } = this.getEyeBox(rawCoords, face5, eyeLandmarks.rightBounds[0], eyeLandmarks.rightBounds[1]); const { box: rightEyeBox, boxSize: rightEyeBoxSize, crop: rightEyeCrop } = this.getEyeBox(rawCoords, face5, eyeLandmarks.rightBounds[0], eyeLandmarks.rightBounds[1]);
const combined = concat([leftEyeCrop, rightEyeCrop]); const combined = concat([leftEyeCrop, rightEyeCrop]);
@ -65043,6 +65048,9 @@ var Pipeline = class {
confidence: box6.confidence, confidence: box6.confidence,
image: face5 image: face5
}); });
} else if (!this.meshDetector) {
if (config3.debug)
log("face mesh detection requested, but model is not loaded");
} else { } else {
const [contours, confidence, contourCoords] = this.meshDetector.execute(face5); const [contours, confidence, contourCoords] = this.meshDetector.execute(face5);
dispose(contours); dispose(contours);
@ -65057,7 +65065,7 @@ var Pipeline = class {
dispose(face5); dispose(face5);
} else { } else {
if (config3.face.iris.enabled) if (config3.face.iris.enabled)
rawCoords = await this.augmentIris(rawCoords, face5); rawCoords = await this.augmentIris(rawCoords, face5, config3);
const mesh = this.transformRawCoords(rawCoords, box6, angle, rotationMatrix); const mesh = this.transformRawCoords(rawCoords, box6, angle, rotationMatrix);
box6 = { ...enlargeBox(calculateLandmarksBoundingBox(mesh), 1.5), confidence: box6.confidence }; box6 = { ...enlargeBox(calculateLandmarksBoundingBox(mesh), 1.5), confidence: box6.confidence };
if (config3.face.detector.rotation && config3.face.mesh.enabled && config3.face.description.enabled && env2.kernels.includes("rotatewithoffset")) { if (config3.face.detector.rotation && config3.face.mesh.enabled && config3.face.description.enabled && env2.kernels.includes("rotatewithoffset")) {
@ -65132,6 +65140,7 @@ async function predict(input2, config3) {
return results; return results;
} }
async function load2(config3) { async function load2(config3) {
var _a;
if (env2.initial) if (env2.initial)
faceModels = [null, null, null]; faceModels = [null, null, null];
if (!faceModels[0] && config3.face.enabled || !faceModels[1] && config3.face.mesh.enabled || !faceModels[2] && config3.face.iris.enabled || env2.initial) { if (!faceModels[0] && config3.face.enabled || !faceModels[1] && config3.face.mesh.enabled || !faceModels[2] && config3.face.iris.enabled || env2.initial) {
@ -65161,7 +65170,7 @@ async function load2(config3) {
log("cached model:", faceModels[2]["modelUrl"]); log("cached model:", faceModels[2]["modelUrl"]);
} }
facePipeline = new Pipeline(faceModels[0], faceModels[1], faceModels[2]); facePipeline = new Pipeline(faceModels[0], faceModels[1], faceModels[2]);
return faceModels; return [((_a = faceModels[0]) == null ? void 0 : _a.model) || null, faceModels[1], faceModels[2]];
} }
var triangulation = TRI468; var triangulation = TRI468;
var uvmap = UV468; var uvmap = UV468;
@ -68679,14 +68688,14 @@ var anchors = [
// src/handpose/handdetector.ts // src/handpose/handdetector.ts
var HandDetector = class { var HandDetector = class {
constructor(model11) { constructor(model12) {
__publicField(this, "model"); __publicField(this, "model");
__publicField(this, "anchors"); __publicField(this, "anchors");
__publicField(this, "anchorsTensor"); __publicField(this, "anchorsTensor");
__publicField(this, "inputSize"); __publicField(this, "inputSize");
__publicField(this, "inputSizeTensor"); __publicField(this, "inputSizeTensor");
__publicField(this, "doubleInputSizeTensor"); __publicField(this, "doubleInputSizeTensor");
this.model = model11; this.model = model12;
this.anchors = anchors.map((anchor) => [anchor.x, anchor.y]); this.anchors = anchors.map((anchor) => [anchor.x, anchor.y]);
this.anchorsTensor = tensor2d(this.anchors); this.anchorsTensor = tensor2d(this.anchors);
this.inputSize = this.model && this.model.inputs && this.model.inputs[0].shape ? this.model.inputs[0].shape[2] : 0; this.inputSize = this.model && this.model.inputs && this.model.inputs[0].shape ? this.model.inputs[0].shape[2] : 0;
@ -69442,8 +69451,210 @@ async function load6(config3) {
return [handDetectorModel, handPoseModel]; return [handDetectorModel, handPoseModel];
} }
// src/tfjs/humangl.ts
var config2 = {
name: "humangl",
priority: 999,
canvas: null,
gl: null,
extensions: [],
webGLattr: {
alpha: false,
antialias: false,
premultipliedAlpha: false,
preserveDrawingBuffer: false,
depth: false,
stencil: false,
failIfMajorPerformanceCaveat: false,
desynchronized: true
}
};
function extensions() {
const gl = config2.gl;
if (!gl)
return;
config2.extensions = gl.getSupportedExtensions();
}
async function register(instance) {
var _a;
if (instance.config.backend !== "humangl")
return;
if (config2.name in engine().registry && (!config2.gl || !config2.gl.getParameter(config2.gl.VERSION))) {
log("error: humangl backend invalid context");
reset(instance);
}
if (!findBackend(config2.name)) {
try {
config2.canvas = await canvas(100, 100);
} catch (err) {
log("error: cannot create canvas:", err);
return;
}
try {
config2.gl = (_a = config2.canvas) == null ? void 0 : _a.getContext("webgl2", config2.webGLattr);
if (config2.canvas) {
config2.canvas.addEventListener("webglcontextlost", async (e) => {
log("error: humangl:", e.type);
log("possible browser memory leak using webgl");
instance.emit("error");
throw new Error("browser webgl error");
});
config2.canvas.addEventListener("webglcontextrestored", (e) => {
log("error: humangl context restored:", e);
});
config2.canvas.addEventListener("webglcontextcreationerror", (e) => {
log("error: humangl context create:", e);
});
}
} catch (err) {
log("error: cannot get WebGL context:", err);
return;
}
try {
setWebGLContext(2, config2.gl);
} catch (err) {
log("error: cannot set WebGL context:", err);
return;
}
const current = backend().getGPGPUContext ? backend().getGPGPUContext().gl : null;
if (current) {
log(`humangl webgl version:${current.getParameter(current.VERSION)} renderer:${current.getParameter(current.RENDERER)}`);
} else {
log("error: no current gl context:", current, config2.gl);
return;
}
try {
const ctx = new GPGPUContext(config2.gl);
registerBackend(config2.name, () => new MathBackendWebGL(ctx), config2.priority);
} catch (err) {
log("error: cannot register WebGL backend:", err);
return;
}
try {
const kernels = getKernelsForBackend("webgl");
kernels.forEach((kernelConfig) => {
const newKernelConfig = { ...kernelConfig, backendName: config2.name };
registerKernel(newKernelConfig);
});
} catch (err) {
log("error: cannot update WebGL backend registration:", err);
return;
}
try {
ENV.set("WEBGL_VERSION", 2);
} catch (err) {
log("error: cannot set WebGL backend flags:", err);
return;
}
extensions();
log("backend registered:", config2.name);
}
}
// src/tfjs/backend.ts
async function check(instance, force = false) {
instance.state = "backend";
if (force || env2.initial || instance.config.backend && instance.config.backend.length > 0 && getBackend() !== instance.config.backend) {
const timeStamp = now();
if (instance.config.backend && instance.config.backend.length > 0) {
if (typeof window === "undefined" && typeof WorkerGlobalScope !== "undefined" && instance.config.debug) {
if (instance.config.debug)
log("running inside web worker");
}
if (env2.browser && instance.config.backend === "tensorflow") {
if (instance.config.debug)
log("override: backend set to tensorflow while running in browser");
instance.config.backend = "humangl";
}
if (env2.node && (instance.config.backend === "webgl" || instance.config.backend === "humangl")) {
if (instance.config.debug)
log(`override: backend set to ${instance.config.backend} while running in nodejs`);
instance.config.backend = "tensorflow";
}
if (env2.browser && instance.config.backend === "webgpu") {
if (typeof navigator === "undefined" || typeof navigator["gpu"] === "undefined") {
log("override: backend set to webgpu but browser does not support webgpu");
instance.config.backend = "humangl";
} else {
const adapter = await navigator["gpu"].requestAdapter();
if (instance.config.debug)
log("enumerated webgpu adapter:", adapter);
}
}
if (instance.config.backend === "humangl")
await register(instance);
const available = Object.keys(engine().registryFactory);
if (instance.config.debug)
log("available backends:", available);
if (!available.includes(instance.config.backend)) {
log(`error: backend ${instance.config.backend} not found in registry`);
instance.config.backend = env2.node ? "tensorflow" : "humangl";
if (instance.config.debug)
log(`override: setting backend ${instance.config.backend}`);
}
if (instance.config.debug)
log("setting backend:", instance.config.backend);
if (instance.config.backend === "wasm") {
if (instance.config.debug)
log("wasm path:", instance.config.wasmPath);
if (typeof (tfjs_esm_exports == null ? void 0 : tfjs_esm_exports.setWasmPaths) !== "undefined")
await setWasmPaths(instance.config.wasmPath);
else
throw new Error("wasm backend is not loaded");
const simd = await env().getAsync("WASM_HAS_SIMD_SUPPORT");
const mt = await env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");
if (instance.config.debug)
log(`wasm execution: ${simd ? "SIMD" : "no SIMD"} ${mt ? "multithreaded" : "singlethreaded"}`);
if (instance.config.debug && !simd)
log("warning: wasm simd support is not enabled");
}
try {
await setBackend(instance.config.backend);
await ready();
} catch (err) {
log("error: cannot set backend:", instance.config.backend, err);
return false;
}
}
if (getBackend() === "humangl") {
ENV.set("CHECK_COMPUTATION_FOR_ERRORS", false);
ENV.set("WEBGL_CPU_FORWARD", true);
ENV.set("WEBGL_PACK_DEPTHWISECONV", false);
ENV.set("WEBGL_USE_SHAPES_UNIFORMS", true);
if (typeof instance.config["deallocate"] !== "undefined" && instance.config["deallocate"]) {
log("changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:", true);
ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD", 0);
}
const gl = await backend().getGPGPUContext().gl;
if (instance.config.debug)
log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);
}
enableProdMode();
await ready();
instance.performance.backend = Math.trunc(now() - timeStamp);
instance.config.backend = getBackend();
get3();
instance.env = env2;
}
return true;
}
function fakeOps(kernelNames, config3) {
for (const kernelName of kernelNames) {
const kernelConfig = {
kernelName,
backendName: config3.backend,
kernelFunc: () => {
if (config3.debug)
log("kernelFunc", kernelName, config3.backend);
}
};
registerKernel(kernelConfig);
}
env2.kernels = getKernelsForBackend(getBackend()).map((kernel) => kernel.kernelName.toLowerCase());
}
// src/handtrack/handtrack.ts // src/handtrack/handtrack.ts
var models = [null, null]; var models2 = [null, null];
var modelOutputNodes = ["StatefulPartitionedCall/Postprocessor/Slice", "StatefulPartitionedCall/Postprocessor/ExpandDims_1"]; var modelOutputNodes = ["StatefulPartitionedCall/Postprocessor/Slice", "StatefulPartitionedCall/Postprocessor/ExpandDims_1"];
var inputSize = [[0, 0], [0, 0]]; var inputSize = [[0, 0], [0, 0]];
var classes = [ var classes = [
@ -69470,39 +69681,44 @@ var fingerMap = {
pinky: [17, 18, 19, 20], pinky: [17, 18, 19, 20],
palm: [0] palm: [0]
}; };
async function load7(config3) { async function loadDetect(config3) {
var _a, _b; var _a;
if (env2.initial) { if (env2.initial)
models[0] = null; models2[0] = null;
models[1] = null; if (!models2[0]) {
} fakeOps(["tensorlistreserve", "enter", "tensorlistfromtensor", "merge", "loopcond", "switch", "exit", "tensorliststack", "nextiteration", "tensorlistsetitem", "tensorlistgetitem", "reciprocal", "shape", "split", "where"], config3);
if (!models[0]) { models2[0] = await loadGraphModel(join(config3.modelBasePath, ((_a = config3.hand.detector) == null ? void 0 : _a.modelPath) || ""));
models[0] = await loadGraphModel(join(config3.modelBasePath, ((_a = config3.hand.detector) == null ? void 0 : _a.modelPath) || "")); const inputs = Object.values(models2[0].modelSignature["inputs"]);
const inputs = Object.values(models[0].modelSignature["inputs"]);
inputSize[0][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0; inputSize[0][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
inputSize[0][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0; inputSize[0][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
if (!models[0] || !models[0]["modelUrl"]) if (!models2[0] || !models2[0]["modelUrl"])
log("load model failed:", config3.object.modelPath); log("load model failed:", config3.object.modelPath);
else if (config3.debug) else if (config3.debug)
log("load model:", models[0]["modelUrl"]); log("load model:", models2[0]["modelUrl"]);
} else if (config3.debug) } else if (config3.debug)
log("cached model:", models[0]["modelUrl"]); log("cached model:", models2[0]["modelUrl"]);
if (!models[1]) { return models2[0];
models[1] = await loadGraphModel(join(config3.modelBasePath, ((_b = config3.hand.skeleton) == null ? void 0 : _b.modelPath) || "")); }
const inputs = Object.values(models[1].modelSignature["inputs"]); async function loadSkeleton(config3) {
var _a;
if (env2.initial)
models2[1] = null;
if (!models2[1]) {
models2[1] = await loadGraphModel(join(config3.modelBasePath, ((_a = config3.hand.skeleton) == null ? void 0 : _a.modelPath) || ""));
const inputs = Object.values(models2[1].modelSignature["inputs"]);
inputSize[1][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0; inputSize[1][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
inputSize[1][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0; inputSize[1][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
if (!models[1] || !models[1]["modelUrl"]) if (!models2[1] || !models2[1]["modelUrl"])
log("load model failed:", config3.object.modelPath); log("load model failed:", config3.object.modelPath);
else if (config3.debug) else if (config3.debug)
log("load model:", models[1]["modelUrl"]); log("load model:", models2[1]["modelUrl"]);
} else if (config3.debug) } else if (config3.debug)
log("cached model:", models[1]["modelUrl"]); log("cached model:", models2[1]["modelUrl"]);
return models; return models2[1];
} }
async function detectHands(input2, config3) { async function detectHands(input2, config3) {
const hands = []; const hands = [];
if (!input2 || !models[0]) if (!input2 || !models2[0])
return hands; return hands;
const t = {}; const t = {};
const ratio = (input2.shape[2] || 1) / (input2.shape[1] || 1); const ratio = (input2.shape[2] || 1) / (input2.shape[1] || 1);
@ -69510,7 +69726,7 @@ async function detectHands(input2, config3) {
const width = Math.round(height * ratio / 8) * 8; const width = Math.round(height * ratio / 8) * 8;
t.resize = image.resizeBilinear(input2, [height, width]); t.resize = image.resizeBilinear(input2, [height, width]);
t.cast = cast(t.resize, "int32"); t.cast = cast(t.resize, "int32");
[t.rawScores, t.rawBoxes] = await models[0].executeAsync(t.cast, modelOutputNodes); [t.rawScores, t.rawBoxes] = await models2[0].executeAsync(t.cast, modelOutputNodes);
t.boxes = squeeze(t.rawBoxes, [0, 2]); t.boxes = squeeze(t.rawBoxes, [0, 2]);
t.scores = squeeze(t.rawScores, [0]); t.scores = squeeze(t.rawScores, [0]);
const classScores = unstack(t.scores, 1); const classScores = unstack(t.scores, 1);
@ -69579,7 +69795,7 @@ async function detectFingers(input2, h, config3) {
landmarks: {}, landmarks: {},
annotations: {} annotations: {}
}; };
if (!input2 || !models[1]) if (!input2 || !models2[1])
return hand3; return hand3;
if (config3.hand.landmarks) { if (config3.hand.landmarks) {
const t = {}; const t = {};
@ -69588,7 +69804,7 @@ async function detectFingers(input2, h, config3) {
t.crop = image.cropAndResize(input2, [h.yxBox], [0], [inputSize[1][0], inputSize[1][1]], "bilinear"); t.crop = image.cropAndResize(input2, [h.yxBox], [0], [inputSize[1][0], inputSize[1][1]], "bilinear");
t.cast = cast(t.crop, "float32"); t.cast = cast(t.crop, "float32");
t.div = div(t.cast, 255); t.div = div(t.cast, 255);
[t.score, t.keypoints] = models[1].execute(t.div); [t.score, t.keypoints] = models2[1].execute(t.div);
const score3 = Math.round(100 * (await t.score.data())[0] / 100); const score3 = Math.round(100 * (await t.score.data())[0] / 100);
if (score3 > (config3.hand.minConfidence || 0)) { if (score3 > (config3.hand.minConfidence || 0)) {
hand3.fingerScore = score3; hand3.fingerScore = score3;
@ -69711,7 +69927,7 @@ var upper = [
// src/blazepose/blazepose.ts // src/blazepose/blazepose.ts
var model5; var model5;
async function load8(config3) { async function load7(config3) {
if (env2.initial) if (env2.initial)
model5 = null; model5 = null;
if (!model5) { if (!model5) {
@ -69782,7 +69998,7 @@ var boxRaw = [0, 0, 0, 0];
var score = 0; var score = 0;
var skipped4 = Number.MAX_SAFE_INTEGER; var skipped4 = Number.MAX_SAFE_INTEGER;
var bodyParts = ["head", "neck", "rightShoulder", "rightElbow", "rightWrist", "chest", "leftShoulder", "leftElbow", "leftWrist", "pelvis", "rightHip", "rightKnee", "rightAnkle", "leftHip", "leftKnee", "leftAnkle"]; var bodyParts = ["head", "neck", "rightShoulder", "rightElbow", "rightWrist", "chest", "leftShoulder", "leftElbow", "leftWrist", "pelvis", "rightHip", "rightKnee", "rightAnkle", "leftHip", "leftKnee", "leftAnkle"];
async function load9(config3) { async function load8(config3) {
if (env2.initial) if (env2.initial)
model6 = null; model6 = null;
if (!model6) { if (!model6) {
@ -69885,7 +70101,7 @@ var boxRaw2 = [0, 0, 0, 0];
var score2 = 0; var score2 = 0;
var skipped5 = Number.MAX_SAFE_INTEGER; var skipped5 = Number.MAX_SAFE_INTEGER;
var bodyParts2 = ["nose", "leftEye", "rightEye", "leftEar", "rightEar", "leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee", "leftAnkle", "rightAnkle"]; var bodyParts2 = ["nose", "leftEye", "rightEye", "leftEar", "rightEar", "leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee", "leftAnkle", "rightAnkle"];
async function load10(config3) { async function load9(config3) {
if (env2.initial) if (env2.initial)
model7 = null; model7 = null;
if (!model7) { if (!model7) {
@ -70103,7 +70319,7 @@ var model8;
var last3 = []; var last3 = [];
var skipped6 = Number.MAX_SAFE_INTEGER; var skipped6 = Number.MAX_SAFE_INTEGER;
var scaleBox = 2.5; var scaleBox = 2.5;
async function load11(config3) { async function load10(config3) {
if (!model8 || env2.initial) { if (!model8 || env2.initial) {
model8 = await loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || "")); model8 = await loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
const inputs = Object.values(model8.modelSignature["inputs"]); const inputs = Object.values(model8.modelSignature["inputs"]);
@ -70209,10 +70425,11 @@ var model9;
var inputSize2 = 0; var inputSize2 = 0;
var last4 = []; var last4 = [];
var skipped7 = Number.MAX_SAFE_INTEGER; var skipped7 = Number.MAX_SAFE_INTEGER;
async function load12(config3) { async function load11(config3) {
if (env2.initial) if (env2.initial)
model9 = null; model9 = null;
if (!model9) { if (!model9) {
fakeOps(["floormod"], config3);
model9 = await loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || "")); model9 = await loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
const inputs = Object.values(model9.modelSignature["inputs"]); const inputs = Object.values(model9.modelSignature["inputs"]);
inputSize2 = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0; inputSize2 = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
@ -70292,7 +70509,7 @@ async function predict11(input2, config3) {
// src/segmentation/segmentation.ts // src/segmentation/segmentation.ts
var model10; var model10;
var busy = false; var busy = false;
async function load13(config3) { async function load12(config3) {
if (!model10 || env2.initial) { if (!model10 || env2.initial) {
model10 = await loadGraphModel(join(config3.modelBasePath, config3.segmentation.modelPath || "")); model10 = await loadGraphModel(join(config3.modelBasePath, config3.segmentation.modelPath || ""));
if (!model10 || !model10["modelUrl"]) if (!model10 || !model10["modelUrl"])
@ -70309,7 +70526,7 @@ async function process5(input2, background, config3) {
return { data: [], canvas: null, alpha: null }; return { data: [], canvas: null, alpha: null };
busy = true; busy = true;
if (!model10) if (!model10)
await load13(config3); await load12(config3);
const inputImage = process2(input2, config3); const inputImage = process2(input2, config3);
const width = ((_a = inputImage.canvas) == null ? void 0 : _a.width) || 0; const width = ((_a = inputImage.canvas) == null ? void 0 : _a.width) || 0;
const height = ((_b = inputImage.canvas) == null ? void 0 : _b.height) || 0; const height = ((_b = inputImage.canvas) == null ? void 0 : _b.height) || 0;
@ -70372,82 +70589,98 @@ async function process5(input2, background, config3) {
return { data, canvas: mergedCanvas || compositeCanvas, alpha: alphaCanvas }; return { data, canvas: mergedCanvas || compositeCanvas, alpha: alphaCanvas };
} }
// src/gear/agegenderrace.ts
var model11;
var skipped8 = Number.MAX_SAFE_INTEGER;
async function load13(config3) {
if (env2.initial)
model11 = null;
if (!model11) {
model11 = await loadGraphModel(join(config3.modelBasePath, config3.face.agegenderrace.modelPath));
if (!model11 || !model11["modelUrl"])
log("load model failed:", config3.face.agegenderrace.modelPath);
else if (config3.debug)
log("load model:", model11["modelUrl"]);
} else if (config3.debug)
log("cached model:", model11["modelUrl"]);
return model11;
}
// src/models.ts // src/models.ts
var Models = class {
constructor() {
__publicField(this, "age", null);
__publicField(this, "agegenderrace", null);
__publicField(this, "blazepose", null);
__publicField(this, "centernet", null);
__publicField(this, "efficientpose", null);
__publicField(this, "embedding", null);
__publicField(this, "emotion", null);
__publicField(this, "facedetect", null);
__publicField(this, "faceiris", null);
__publicField(this, "facemesh", null);
__publicField(this, "faceres", null);
__publicField(this, "gender", null);
__publicField(this, "handpose", null);
__publicField(this, "handskeleton", null);
__publicField(this, "handtrack", null);
__publicField(this, "movenet", null);
__publicField(this, "nanodet", null);
__publicField(this, "posenet", null);
__publicField(this, "segmentation", null);
}
};
function reset(instance) { function reset(instance) {
instance.models = { for (const model12 of Object.keys(instance.models))
face: null, instance.models[model12] = null;
handpose: null,
handtrack: null,
posenet: null,
blazepose: null,
efficientpose: null,
movenet: null,
age: null,
gender: null,
emotion: null,
embedding: null,
nanodet: null,
centernet: null,
faceres: null,
segmentation: null
};
} }
async function load14(instance) { async function load14(instance) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
if (env2.initial) if (env2.initial)
reset(instance); reset(instance);
if (instance.config.async) { if (instance.config.face.enabled) {
[ if (!instance.models.facedetect)
instance.models.face, [instance.models.facedetect, instance.models.facemesh, instance.models.faceiris] = await load2(instance.config);
instance.models.emotion, if (((_a = instance.config.face.mesh) == null ? void 0 : _a.enabled) && !instance.models.facemesh)
instance.models.handpose, [instance.models.facedetect, instance.models.facemesh, instance.models.faceiris] = await load2(instance.config);
instance.models.handtrack, if (((_b = instance.config.face.iris) == null ? void 0 : _b.enabled) && !instance.models.faceiris)
instance.models.posenet, [instance.models.facedetect, instance.models.facemesh, instance.models.faceiris] = await load2(instance.config);
instance.models.blazepose, }
instance.models.efficientpose, if (instance.config.hand.enabled) {
instance.models.movenet, if (!instance.models.handpose && ((_d = (_c = instance.config.hand.detector) == null ? void 0 : _c.modelPath) == null ? void 0 : _d.includes("handdetect")))
instance.models.nanodet, [instance.models.handpose, instance.models.handskeleton] = await load6(instance.config);
instance.models.centernet, if (!instance.models.handskeleton && instance.config.hand.landmarks && ((_f = (_e = instance.config.hand.detector) == null ? void 0 : _e.modelPath) == null ? void 0 : _f.includes("handdetect")))
instance.models.faceres, [instance.models.handpose, instance.models.handskeleton] = await load6(instance.config);
instance.models.segmentation }
] = await Promise.all([ if (instance.config.hand.enabled && !instance.models.handtrack && ((_h = (_g = instance.config.hand.detector) == null ? void 0 : _g.modelPath) == null ? void 0 : _h.includes("handtrack")))
instance.models.face || (instance.config.face.enabled ? load2(instance.config) : null), instance.models.handtrack = loadDetect(instance.config);
instance.models.emotion || (instance.config.face.enabled && instance.config.face.emotion.enabled ? load4(instance.config) : null), if (instance.config.hand.enabled && instance.config.hand.landmarks && !instance.models.handskeleton && ((_j = (_i = instance.config.hand.detector) == null ? void 0 : _i.modelPath) == null ? void 0 : _j.includes("handtrack")))
instance.models.handpose || (instance.config.hand.enabled && instance.config.hand.detector.modelPath.includes("handdetect") ? load6(instance.config) : null), instance.models.handskeleton = loadSkeleton(instance.config);
instance.models.handtrack || (instance.config.hand.enabled && instance.config.hand.detector.modelPath.includes("handtrack") ? load7(instance.config) : null), if (instance.config.body.enabled && !instance.models.posenet && ((_l = (_k = instance.config.body) == null ? void 0 : _k.modelPath) == null ? void 0 : _l.includes("posenet")))
instance.models.posenet || (instance.config.body.enabled && instance.config.body.modelPath.includes("posenet") ? load5(instance.config) : null), instance.models.posenet = load5(instance.config);
instance.models.blazepose || (instance.config.body.enabled && instance.config.body.modelPath.includes("blazepose") ? load8(instance.config) : null), if (instance.config.body.enabled && !instance.models.efficientpose && ((_n = (_m = instance.config.body) == null ? void 0 : _m.modelPath) == null ? void 0 : _n.includes("efficientpose")))
instance.models.efficientpose || (instance.config.body.enabled && instance.config.body.modelPath.includes("efficientpose") ? load9(instance.config) : null), instance.models.efficientpose = load8(instance.config);
instance.models.movenet || (instance.config.body.enabled && instance.config.body.modelPath.includes("movenet") ? load10(instance.config) : null), if (instance.config.body.enabled && !instance.models.blazepose && ((_p = (_o = instance.config.body) == null ? void 0 : _o.modelPath) == null ? void 0 : _p.includes("blazepose")))
instance.models.nanodet || (instance.config.object.enabled && instance.config.object.modelPath.includes("nanodet") ? load11(instance.config) : null), instance.models.blazepose = load7(instance.config);
instance.models.centernet || (instance.config.object.enabled && instance.config.object.modelPath.includes("centernet") ? load12(instance.config) : null), if (instance.config.body.enabled && !instance.models.efficientpose && ((_r = (_q = instance.config.body) == null ? void 0 : _q.modelPath) == null ? void 0 : _r.includes("efficientpose")))
instance.models.faceres || (instance.config.face.enabled && instance.config.face.description.enabled ? load3(instance.config) : null), instance.models.efficientpose = load7(instance.config);
instance.models.segmentation || (instance.config.segmentation.enabled ? load13(instance.config) : null) if (instance.config.body.enabled && !instance.models.movenet && ((_t = (_s = instance.config.body) == null ? void 0 : _s.modelPath) == null ? void 0 : _t.includes("movenet")))
]); instance.models.movenet = load9(instance.config);
} else { if (instance.config.object.enabled && !instance.models.nanodet && ((_v = (_u = instance.config.object) == null ? void 0 : _u.modelPath) == null ? void 0 : _v.includes("nanodet")))
if (instance.config.face.enabled && !instance.models.face) instance.models.nanodet = load10(instance.config);
instance.models.face = await load2(instance.config); if (instance.config.object.enabled && !instance.models.centernet && ((_x = (_w = instance.config.object) == null ? void 0 : _w.modelPath) == null ? void 0 : _x.includes("centernet")))
if (instance.config.face.enabled && instance.config.face.emotion.enabled && !instance.models.emotion) instance.models.centernet = load11(instance.config);
instance.models.emotion = await load4(instance.config); if (instance.config.face.enabled && ((_y = instance.config.face.emotion) == null ? void 0 : _y.enabled) && !instance.models.emotion)
if (instance.config.hand.enabled && !instance.models.handpose && instance.config.hand.detector.modelPath.includes("handdetect")) instance.models.emotion = load4(instance.config);
instance.models.handpose = await load6(instance.config); if (instance.config.face.enabled && ((_z = instance.config.face.description) == null ? void 0 : _z.enabled) && !instance.models.faceres)
if (instance.config.hand.enabled && !instance.models.handtrack && instance.config.hand.detector.modelPath.includes("handtrack")) instance.models.faceres = load3(instance.config);
instance.models.handtrack = await load7(instance.config); if (instance.config.segmentation.enabled && !instance.models.segmentation)
if (instance.config.body.enabled && !instance.models.posenet && instance.config.body.modelPath.includes("posenet")) instance.models.segmentation = load12(instance.config);
instance.models.posenet = await load5(instance.config); if (instance.config.face.enabled && ((_A = instance.config.face["agegenderrace"]) == null ? void 0 : _A.enabled) && !instance.models.agegenderrace)
if (instance.config.body.enabled && !instance.models.blazepose && instance.config.body.modelPath.includes("blazepose")) instance.models.agegenderrace = load13(instance.config);
instance.models.blazepose = await load8(instance.config); for await (const model12 of Object.keys(instance.models)) {
if (instance.config.body.enabled && !instance.models.efficientpose && instance.config.body.modelPath.includes("efficientpose")) if (instance.models[model12] && typeof instance.models[model12] !== "undefined")
instance.models.efficientpose = await load8(instance.config); instance.models[model12] = await instance.models[model12];
if (instance.config.body.enabled && !instance.models.movenet && instance.config.body.modelPath.includes("movenet"))
instance.models.movenet = await load10(instance.config);
if (instance.config.object.enabled && !instance.models.nanodet && instance.config.object.modelPath.includes("nanodet"))
instance.models.nanodet = await load11(instance.config);
if (instance.config.object.enabled && !instance.models.centernet && instance.config.object.modelPath.includes("centernet"))
instance.models.centernet = await load12(instance.config);
if (instance.config.face.enabled && instance.config.face.description.enabled && !instance.models.faceres)
instance.models.faceres = await load3(instance.config);
if (instance.config.segmentation.enabled && !instance.models.segmentation)
instance.models.segmentation = await load13(instance.config);
} }
} }
async function validate2(instance) { async function validate2(instance) {
@ -70456,18 +70689,18 @@ async function validate2(instance) {
if (instance.models[defined]) { if (instance.models[defined]) {
let models4 = []; let models4 = [];
if (Array.isArray(instance.models[defined])) { if (Array.isArray(instance.models[defined])) {
models4 = instance.models[defined].filter((model11) => model11 !== null).map((model11) => model11 && model11.executor ? model11 : model11.model); models4 = instance.models[defined].filter((model12) => model12 !== null).map((model12) => model12 && model12.executor ? model12 : model12.model);
} else { } else {
models4 = [instance.models[defined]]; models4 = [instance.models[defined]];
} }
for (const model11 of models4) { for (const model12 of models4) {
if (!model11) { if (!model12) {
if (instance.config.debug) if (instance.config.debug)
log("model marked as loaded but not defined:", defined); log("model marked as loaded but not defined:", defined);
continue; continue;
} }
const ops = []; const ops = [];
const executor = model11 == null ? void 0 : model11.executor; const executor = model12 == null ? void 0 : model12.executor;
if (executor && executor.graph.nodes) { if (executor && executor.graph.nodes) {
for (const kernel of Object.values(executor.graph.nodes)) { for (const kernel of Object.values(executor.graph.nodes)) {
const op2 = kernel.op.toLowerCase(); const op2 = kernel.op.toLowerCase();
@ -70597,7 +70830,7 @@ var calculateFaceAngle = (face5, imageSize) => {
return { angle, matrix, gaze }; return { angle, matrix, gaze };
}; };
var detectFace = async (parent, input2) => { var detectFace = async (parent, input2) => {
var _a, _b, _c, _d, _e, _f; var _a, _b, _c, _d;
let timeStamp; let timeStamp;
let ageRes; let ageRes;
let gearRes; let gearRes;
@ -70649,7 +70882,7 @@ var detectFace = async (parent, input2) => {
delete faces[i].annotations.leftEyeIris; delete faces[i].annotations.leftEyeIris;
delete faces[i].annotations.rightEyeIris; delete faces[i].annotations.rightEyeIris;
} }
const irisSize = ((_e = faces[i].annotations) == null ? void 0 : _e.leftEyeIris) && ((_f = faces[i].annotations) == null ? void 0 : _f.rightEyeIris) ? Math.max(Math.abs(faces[i].annotations.leftEyeIris[3][0] - faces[i].annotations.leftEyeIris[1][0]), Math.abs(faces[i].annotations.rightEyeIris[4][1] - faces[i].annotations.rightEyeIris[2][1])) / input2.shape[2] : 0; const irisSize = faces[i].annotations && faces[i].annotations.leftEyeIris && faces[i].annotations.rightEyeIris && faces[i].annotations.leftEyeIris.length > 0 && faces[i].annotations.rightEyeIris.length > 0 && faces[i].annotations.leftEyeIris[0] !== null && faces[i].annotations.rightEyeIris[0] !== null ? Math.max(Math.abs(faces[i].annotations.leftEyeIris[3][0] - faces[i].annotations.leftEyeIris[1][0]), Math.abs(faces[i].annotations.rightEyeIris[4][1] - faces[i].annotations.rightEyeIris[2][1])) / input2.shape[2] : 0;
const tensor2 = parent.config.face.detector.return ? squeeze(faces[i].tensor) : null; const tensor2 = parent.config.face.detector.return ? squeeze(faces[i].tensor) : null;
dispose(faces[i].tensor); dispose(faces[i].tensor);
if (faces[i].tensor) if (faces[i].tensor)
@ -71440,194 +71673,6 @@ function calc(newResult) {
return bufferedResult; return bufferedResult;
} }
// src/tfjs/humangl.ts
var config2 = {
name: "humangl",
priority: 999,
canvas: null,
gl: null,
extensions: [],
webGLattr: {
alpha: false,
antialias: false,
premultipliedAlpha: false,
preserveDrawingBuffer: false,
depth: false,
stencil: false,
failIfMajorPerformanceCaveat: false,
desynchronized: true
}
};
function extensions() {
const gl = config2.gl;
if (!gl)
return;
config2.extensions = gl.getSupportedExtensions();
}
async function register(instance) {
var _a;
if (instance.config.backend !== "humangl")
return;
if (config2.name in engine().registry && (!config2.gl || !config2.gl.getParameter(config2.gl.VERSION))) {
log("error: humangl backend invalid context");
reset(instance);
}
if (!findBackend(config2.name)) {
try {
config2.canvas = await canvas(100, 100);
} catch (err) {
log("error: cannot create canvas:", err);
return;
}
try {
config2.gl = (_a = config2.canvas) == null ? void 0 : _a.getContext("webgl2", config2.webGLattr);
if (config2.canvas) {
config2.canvas.addEventListener("webglcontextlost", async (e) => {
log("error: humangl:", e.type);
log("possible browser memory leak using webgl");
instance.emit("error");
throw new Error("browser webgl error");
});
config2.canvas.addEventListener("webglcontextrestored", (e) => {
log("error: humangl context restored:", e);
});
config2.canvas.addEventListener("webglcontextcreationerror", (e) => {
log("error: humangl context create:", e);
});
}
} catch (err) {
log("error: cannot get WebGL context:", err);
return;
}
try {
setWebGLContext(2, config2.gl);
} catch (err) {
log("error: cannot set WebGL context:", err);
return;
}
const current = backend().getGPGPUContext ? backend().getGPGPUContext().gl : null;
if (current) {
log(`humangl webgl version:${current.getParameter(current.VERSION)} renderer:${current.getParameter(current.RENDERER)}`);
} else {
log("error: no current gl context:", current, config2.gl);
return;
}
try {
const ctx = new GPGPUContext(config2.gl);
registerBackend(config2.name, () => new MathBackendWebGL(ctx), config2.priority);
} catch (err) {
log("error: cannot register WebGL backend:", err);
return;
}
try {
const kernels = getKernelsForBackend("webgl");
kernels.forEach((kernelConfig) => {
const newKernelConfig = { ...kernelConfig, backendName: config2.name };
registerKernel(newKernelConfig);
});
} catch (err) {
log("error: cannot update WebGL backend registration:", err);
return;
}
try {
ENV.set("WEBGL_VERSION", 2);
} catch (err) {
log("error: cannot set WebGL backend flags:", err);
return;
}
extensions();
log("backend registered:", config2.name);
}
}
// src/tfjs/backend.ts
async function check(instance, force = false) {
instance.state = "backend";
if (force || env2.initial || instance.config.backend && instance.config.backend.length > 0 && getBackend() !== instance.config.backend) {
const timeStamp = now();
if (instance.config.backend && instance.config.backend.length > 0) {
if (typeof window === "undefined" && typeof WorkerGlobalScope !== "undefined" && instance.config.debug) {
if (instance.config.debug)
log("running inside web worker");
}
if (env2.browser && instance.config.backend === "tensorflow") {
if (instance.config.debug)
log("override: backend set to tensorflow while running in browser");
instance.config.backend = "humangl";
}
if (env2.node && (instance.config.backend === "webgl" || instance.config.backend === "humangl")) {
if (instance.config.debug)
log(`override: backend set to ${instance.config.backend} while running in nodejs`);
instance.config.backend = "tensorflow";
}
if (env2.browser && instance.config.backend === "webgpu") {
if (typeof navigator === "undefined" || typeof navigator["gpu"] === "undefined") {
log("override: backend set to webgpu but browser does not support webgpu");
instance.config.backend = "humangl";
} else {
const adapter = await navigator["gpu"].requestAdapter();
if (instance.config.debug)
log("enumerated webgpu adapter:", adapter);
}
}
if (instance.config.backend === "humangl")
await register(instance);
const available = Object.keys(engine().registryFactory);
if (instance.config.debug)
log("available backends:", available);
if (!available.includes(instance.config.backend)) {
log(`error: backend ${instance.config.backend} not found in registry`);
instance.config.backend = env2.node ? "tensorflow" : "humangl";
if (instance.config.debug)
log(`override: setting backend ${instance.config.backend}`);
}
if (instance.config.debug)
log("setting backend:", instance.config.backend);
if (instance.config.backend === "wasm") {
if (instance.config.debug)
log("wasm path:", instance.config.wasmPath);
if (typeof (tfjs_esm_exports == null ? void 0 : tfjs_esm_exports.setWasmPaths) !== "undefined")
await setWasmPaths(instance.config.wasmPath);
else
throw new Error("wasm backend is not loaded");
const simd = await env().getAsync("WASM_HAS_SIMD_SUPPORT");
const mt = await env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");
if (instance.config.debug)
log(`wasm execution: ${simd ? "SIMD" : "no SIMD"} ${mt ? "multithreaded" : "singlethreaded"}`);
if (instance.config.debug && !simd)
log("warning: wasm simd support is not enabled");
}
try {
await setBackend(instance.config.backend);
await ready();
} catch (err) {
log("error: cannot set backend:", instance.config.backend, err);
return false;
}
}
if (getBackend() === "humangl") {
ENV.set("CHECK_COMPUTATION_FOR_ERRORS", false);
ENV.set("WEBGL_CPU_FORWARD", true);
ENV.set("WEBGL_PACK_DEPTHWISECONV", false);
ENV.set("WEBGL_USE_SHAPES_UNIFORMS", true);
if (typeof instance.config["deallocate"] !== "undefined" && instance.config["deallocate"]) {
log("changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:", true);
ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD", 0);
}
const gl = await backend().getGPGPUContext().gl;
if (instance.config.debug)
log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);
}
enableProdMode();
await ready();
instance.performance.backend = Math.trunc(now() - timeStamp);
instance.config.backend = getBackend();
get3();
instance.env = env2;
}
return true;
}
// package.json // package.json
var version6 = "2.2.2"; var version6 = "2.2.2";
@ -72536,23 +72581,7 @@ var Human = class {
__privateSet(this, _checkSanity, false); __privateSet(this, _checkSanity, false);
this.performance = { backend: 0, load: 0, image: 0, frames: 0, cached: 0, changed: 0, total: 0, draw: 0 }; this.performance = { backend: 0, load: 0, image: 0, frames: 0, cached: 0, changed: 0, total: 0, draw: 0 };
this.events = new EventTarget(); this.events = new EventTarget();
this.models = { this.models = new Models();
face: null,
handpose: null,
handtrack: null,
posenet: null,
blazepose: null,
efficientpose: null,
movenet: null,
age: null,
gender: null,
emotion: null,
embedding: null,
nanodet: null,
centernet: null,
faceres: null,
segmentation: null
};
this.draw = { this.draw = {
options: options2, options: options2,
canvas: (input2, output) => canvas2(input2, output), canvas: (input2, output) => canvas2(input2, output),
@ -72591,7 +72620,7 @@ var Human = class {
async load(userConfig) { async load(userConfig) {
this.state = "load"; this.state = "load";
const timeStamp = now(); const timeStamp = now();
const count3 = Object.values(this.models).filter((model11) => model11).length; const count3 = Object.values(this.models).filter((model12) => model12).length;
if (userConfig) if (userConfig)
this.config = mergeDeep(this.config, userConfig); this.config = mergeDeep(this.config, userConfig);
if (env2.initial) { if (env2.initial) {
@ -72613,7 +72642,7 @@ var Human = class {
if (env2.initial && this.config.debug) if (env2.initial && this.config.debug)
log("tf engine state:", this.tf.engine().state.numBytes, "bytes", this.tf.engine().state.numTensors, "tensors"); log("tf engine state:", this.tf.engine().state.numBytes, "bytes", this.tf.engine().state.numTensors, "tensors");
env2.initial = false; env2.initial = false;
const loaded = Object.values(this.models).filter((model11) => model11).length; const loaded = Object.values(this.models).filter((model12) => model12).length;
if (loaded !== count3) { if (loaded !== count3) {
await validate2(this); await validate2(this);
this.emit("load"); this.emit("load");
@ -72794,6 +72823,7 @@ _checkSanity = new WeakMap();
_sanity = new WeakMap(); _sanity = new WeakMap();
export { export {
Human, Human,
Models,
Human as default, Human as default,
config as defaults, config as defaults,
env2 as env env2 as env

File diff suppressed because one or more lines are too long

556
dist/human.js vendored

File diff suppressed because one or more lines are too long

1000
dist/human.node-gpu.js vendored

File diff suppressed because it is too large Load Diff

1000
dist/human.node-wasm.js vendored

File diff suppressed because it is too large Load Diff

1000
dist/human.node.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -58,7 +58,7 @@ export async function predict(input: Tensor, config: Config): Promise<FaceResult
return results; return results;
} }
export async function load(config): Promise<[unknown, GraphModel | null, GraphModel | null]> { export async function load(config): Promise<[GraphModel | null, GraphModel | null, GraphModel | null]> {
if (env.initial) faceModels = [null, null, null]; if (env.initial) faceModels = [null, null, null];
if ((!faceModels[0] && config.face.enabled) || (!faceModels[1] && config.face.mesh.enabled) || (!faceModels[2] && config.face.iris.enabled) || env.initial) { if ((!faceModels[0] && config.face.enabled) || (!faceModels[1] && config.face.mesh.enabled) || (!faceModels[2] && config.face.iris.enabled) || env.initial) {
faceModels = await Promise.all([ faceModels = await Promise.all([
@ -80,7 +80,7 @@ export async function load(config): Promise<[unknown, GraphModel | null, GraphMo
if (faceModels[2]) log('cached model:', faceModels[2]['modelUrl']); if (faceModels[2]) log('cached model:', faceModels[2]['modelUrl']);
} }
facePipeline = new facepipeline.Pipeline(faceModels[0], faceModels[1], faceModels[2]); facePipeline = new facepipeline.Pipeline(faceModels[0], faceModels[1], faceModels[2]);
return faceModels; return [faceModels[0]?.model || null, faceModels[1], faceModels[2]];
} }
export const triangulation = coords.TRI468; export const triangulation = coords.TRI468;

View File

@ -5,6 +5,7 @@ import * as coords from './coords';
import type { Tensor, GraphModel } from '../tfjs/types'; import type { Tensor, GraphModel } from '../tfjs/types';
import type { BlazeFaceModel } from './blazeface'; import type { BlazeFaceModel } from './blazeface';
import { env } from '../env'; import { env } from '../env';
import { log } from '../helpers';
const leftOutline = coords.MESH_ANNOTATIONS['leftEyeLower0']; const leftOutline = coords.MESH_ANNOTATIONS['leftEyeLower0'];
const rightOutline = coords.MESH_ANNOTATIONS['rightEyeLower0']; const rightOutline = coords.MESH_ANNOTATIONS['rightEyeLower0'];
@ -172,7 +173,11 @@ export class Pipeline {
return [angle, rotationMatrix, face]; return [angle, rotationMatrix, face];
} }
async augmentIris(rawCoords, face) { async augmentIris(rawCoords, face, config) {
if (!this.irisModel) {
if (config.debug) log('face mesh detection requested, but model is not loaded');
return rawCoords;
}
const { box: leftEyeBox, boxSize: leftEyeBoxSize, crop: leftEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.leftBounds[0], eyeLandmarks.leftBounds[1], true); const { box: leftEyeBox, boxSize: leftEyeBoxSize, crop: leftEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.leftBounds[0], eyeLandmarks.leftBounds[1], true);
const { box: rightEyeBox, boxSize: rightEyeBoxSize, crop: rightEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.rightBounds[0], eyeLandmarks.rightBounds[1]); const { box: rightEyeBox, boxSize: rightEyeBoxSize, crop: rightEyeCrop } = this.getEyeBox(rawCoords, face, eyeLandmarks.rightBounds[0], eyeLandmarks.rightBounds[1]);
const combined = tf.concat([leftEyeCrop, rightEyeCrop]); const combined = tf.concat([leftEyeCrop, rightEyeCrop]);
@ -280,6 +285,8 @@ export class Pipeline {
confidence: box.confidence, confidence: box.confidence,
image: face, image: face,
}); });
} else if (!this.meshDetector) {
if (config.debug) log('face mesh detection requested, but model is not loaded');
} else { } else {
const [contours, confidence, contourCoords] = this.meshDetector.execute(face) as Array<Tensor>; // The first returned tensor represents facial contours which are already included in the coordinates. const [contours, confidence, contourCoords] = this.meshDetector.execute(face) as Array<Tensor>; // The first returned tensor represents facial contours which are already included in the coordinates.
tf.dispose(contours); tf.dispose(contours);
@ -295,7 +302,7 @@ export class Pipeline {
box.confidence = faceConfidence; // reset confidence of cached box box.confidence = faceConfidence; // reset confidence of cached box
tf.dispose(face); tf.dispose(face);
} else { } else {
if (config.face.iris.enabled) rawCoords = await this.augmentIris(rawCoords, face); if (config.face.iris.enabled) rawCoords = await this.augmentIris(rawCoords, face, config);
// override box from detection with one calculated from mesh // override box from detection with one calculated from mesh
const mesh = this.transformRawCoords(rawCoords, box, angle, rotationMatrix); const mesh = this.transformRawCoords(rawCoords, box, angle, rotationMatrix);

View File

@ -226,10 +226,11 @@ export const detectFace = async (parent /* instance of human */, input: Tensor):
delete faces[i].annotations.leftEyeIris; delete faces[i].annotations.leftEyeIris;
delete faces[i].annotations.rightEyeIris; delete faces[i].annotations.rightEyeIris;
} }
const irisSize = (faces[i].annotations?.leftEyeIris && faces[i].annotations?.rightEyeIris) const irisSize = (faces[i].annotations && faces[i].annotations.leftEyeIris && faces[i].annotations.rightEyeIris
/* note: average human iris size is 11.7mm */ && (faces[i].annotations.leftEyeIris.length > 0) && (faces[i].annotations.rightEyeIris.length > 0)
&& (faces[i].annotations.leftEyeIris[0] !== null) && (faces[i].annotations.rightEyeIris[0] !== null))
? Math.max(Math.abs(faces[i].annotations.leftEyeIris[3][0] - faces[i].annotations.leftEyeIris[1][0]), Math.abs(faces[i].annotations.rightEyeIris[4][1] - faces[i].annotations.rightEyeIris[2][1])) / input.shape[2] ? Math.max(Math.abs(faces[i].annotations.leftEyeIris[3][0] - faces[i].annotations.leftEyeIris[1][0]), Math.abs(faces[i].annotations.rightEyeIris[4][1] - faces[i].annotations.rightEyeIris[2][1])) / input.shape[2]
: 0; : 0; // note: average human iris size is 11.7mm
// optionally return tensor // optionally return tensor
const tensor = parent.config.face.detector.return ? tf.squeeze(faces[i].tensor) : null; const tensor = parent.config.face.detector.return ? tf.squeeze(faces[i].tensor) : null;

View File

@ -9,9 +9,11 @@ import type { GraphModel, Tensor } from '../tfjs/types';
import type { Config } from '../config'; import type { Config } from '../config';
import { env } from '../env'; import { env } from '../env';
import * as fingerPose from '../fingerpose/fingerpose'; import * as fingerPose from '../fingerpose/fingerpose';
import { fakeOps } from '../tfjs/backend';
const models: [GraphModel | null, GraphModel | null] = [null, null]; const models: [GraphModel | null, GraphModel | null] = [null, null];
const modelOutputNodes = ['StatefulPartitionedCall/Postprocessor/Slice', 'StatefulPartitionedCall/Postprocessor/ExpandDims_1']; const modelOutputNodes = ['StatefulPartitionedCall/Postprocessor/Slice', 'StatefulPartitionedCall/Postprocessor/ExpandDims_1'];
const inputSize = [[0, 0], [0, 0]]; const inputSize = [[0, 0], [0, 0]];
const classes = [ const classes = [
@ -55,12 +57,12 @@ const fingerMap = {
palm: [0], palm: [0],
}; };
export async function load(config: Config): Promise<[GraphModel, GraphModel]> { export async function loadDetect(config: Config): Promise<GraphModel> {
if (env.initial) { if (env.initial) models[0] = null;
models[0] = null;
models[1] = null;
}
if (!models[0]) { if (!models[0]) {
// handtrack model has some kernel ops defined in model but those are never referenced and non-existent in tfjs
// ideally need to prune the model itself
fakeOps(['tensorlistreserve', 'enter', 'tensorlistfromtensor', 'merge', 'loopcond', 'switch', 'exit', 'tensorliststack', 'nextiteration', 'tensorlistsetitem', 'tensorlistgetitem', 'reciprocal', 'shape', 'split', 'where'], config);
models[0] = await tf.loadGraphModel(join(config.modelBasePath, config.hand.detector?.modelPath || '')) as unknown as GraphModel; models[0] = await tf.loadGraphModel(join(config.modelBasePath, config.hand.detector?.modelPath || '')) as unknown as GraphModel;
const inputs = Object.values(models[0].modelSignature['inputs']); const inputs = Object.values(models[0].modelSignature['inputs']);
inputSize[0][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0; inputSize[0][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
@ -68,6 +70,11 @@ export async function load(config: Config): Promise<[GraphModel, GraphModel]> {
if (!models[0] || !models[0]['modelUrl']) log('load model failed:', config.object.modelPath); if (!models[0] || !models[0]['modelUrl']) log('load model failed:', config.object.modelPath);
else if (config.debug) log('load model:', models[0]['modelUrl']); else if (config.debug) log('load model:', models[0]['modelUrl']);
} else if (config.debug) log('cached model:', models[0]['modelUrl']); } else if (config.debug) log('cached model:', models[0]['modelUrl']);
return models[0];
}
export async function loadSkeleton(config: Config): Promise<GraphModel> {
if (env.initial) models[1] = null;
if (!models[1]) { if (!models[1]) {
models[1] = await tf.loadGraphModel(join(config.modelBasePath, config.hand.skeleton?.modelPath || '')) as unknown as GraphModel; models[1] = await tf.loadGraphModel(join(config.modelBasePath, config.hand.skeleton?.modelPath || '')) as unknown as GraphModel;
const inputs = Object.values(models[1].modelSignature['inputs']); const inputs = Object.values(models[1].modelSignature['inputs']);
@ -76,7 +83,13 @@ export async function load(config: Config): Promise<[GraphModel, GraphModel]> {
if (!models[1] || !models[1]['modelUrl']) log('load model failed:', config.object.modelPath); if (!models[1] || !models[1]['modelUrl']) log('load model failed:', config.object.modelPath);
else if (config.debug) log('load model:', models[1]['modelUrl']); else if (config.debug) log('load model:', models[1]['modelUrl']);
} else if (config.debug) log('cached model:', models[1]['modelUrl']); } else if (config.debug) log('cached model:', models[1]['modelUrl']);
return models as [GraphModel, GraphModel]; return models[1];
}
export async function load(config: Config): Promise<[GraphModel | null, GraphModel | null]> {
if (!models[0]) await loadDetect(config);
if (!models[1]) await loadSkeleton(config);
return models;
} }
async function detectHands(input: Tensor, config: Config): Promise<HandDetectResult[]> { async function detectHands(input: Tensor, config: Config): Promise<HandDetectResult[]> {
@ -217,4 +230,20 @@ export async function predict(input: Tensor, config: Config): Promise<HandResult
- TFJS Port: <https://github.com/victordibia/handtrack.js/> - TFJS Port: <https://github.com/victordibia/handtrack.js/>
- Original: <https://github.com/victordibia/handtracking> - Original: <https://github.com/victordibia/handtracking>
- Writeup: <https://medium.com/@victor.dibia/how-to-build-a-real-time-hand-detector-using-neural-networks-ssd-on-tensorflow-d6bac0e4b2ce> - Writeup: <https://medium.com/@victor.dibia/how-to-build-a-real-time-hand-detector-using-neural-networks-ssd-on-tensorflow-d6bac0e4b2ce>
- Convert:
tensorflowjs_converter --input_format=tf_frozen_model --output_format=tfjs_graph_model \
--output_node_names='num_detections,detection_boxes,detection_scores,detection_classes' --saved_model_tags=serve --quantize_uint8=* \
--strip_debug_ops=* --weight_shard_size_bytes=10000000000 --control_flow_v2=true frozen_inference_graph.pb graph
webmodel/efficientdet512d0/base/model.json
webmodel/centernet512fpn/base/model.json
https://github.com/victordibia/handtrack.js/commit/70d5d9c98e69688414cddaad044bd8730bc982d1#diff-c40e819be4ec1dc29f26913f5cdeb05202261b3a1725ab259cb235ea0f0fc5d6
git rev-list HEAD -- webmodel/*
9ba7220fb31e9168aa248500cc70800566f4c719
70d5d9c98e69688414cddaad044bd8730bc982d1
git checkout 9ba7220fb31e9168aa248500cc70800566f4c719^ -- webmodel
git checkout 70d5d9c98e69688414cddaad044bd8730bc982d1^ -- webmodel
*/ */

View File

@ -29,7 +29,7 @@ import * as backend from './tfjs/backend';
import * as humangl from './tfjs/humangl'; import * as humangl from './tfjs/humangl';
import * as app from '../package.json'; import * as app from '../package.json';
import * as warmups from './warmup'; import * as warmups from './warmup';
import type { Tensor, GraphModel } from './tfjs/types'; import type { Tensor } from './tfjs/types';
import type { DrawOptions } from './draw'; import type { DrawOptions } from './draw';
// export types // export types
@ -37,6 +37,7 @@ export * from './config';
export * from './result'; export * from './result';
export type { DrawOptions } from './draw'; export type { DrawOptions } from './draw';
export { env, Env } from './env'; export { env, Env } from './env';
export { Models } from './models';
/** Defines all possible input types for **Human** detection /** Defines all possible input types for **Human** detection
* @typedef Input Type * @typedef Input Type
@ -119,23 +120,7 @@ export class Human {
/** Currently loaded models /** Currently loaded models
* @internal * @internal
*/ */
models: { models: models.Models;
face: [unknown, GraphModel | null, GraphModel | null] | null,
posenet: GraphModel | null,
blazepose: GraphModel | null,
efficientpose: GraphModel | null,
movenet: GraphModel | null,
handpose: [GraphModel | null, GraphModel | null] | null,
handtrack: [GraphModel | null, GraphModel | null] | null,
age: GraphModel | null,
gender: GraphModel | null,
emotion: GraphModel | null,
embedding: GraphModel | null,
nanodet: GraphModel | null,
centernet: GraphModel | null,
faceres: GraphModel | null,
segmentation: GraphModel | null,
};
/** Container for events dispatched by Human /** Container for events dispatched by Human
* *
@ -187,23 +172,7 @@ export class Human {
this.performance = { backend: 0, load: 0, image: 0, frames: 0, cached: 0, changed: 0, total: 0, draw: 0 }; this.performance = { backend: 0, load: 0, image: 0, frames: 0, cached: 0, changed: 0, total: 0, draw: 0 };
this.events = new EventTarget(); this.events = new EventTarget();
// object that contains all initialized models // object that contains all initialized models
this.models = { this.models = new models.Models();
face: null, // array of models
handpose: null, // array of models
handtrack: null, // array of models
posenet: null,
blazepose: null,
efficientpose: null,
movenet: null,
age: null,
gender: null,
emotion: null,
embedding: null,
nanodet: null,
centernet: null,
faceres: null,
segmentation: null,
};
// reexport draw methods // reexport draw methods
this.draw = { this.draw = {
options: draw.options as DrawOptions, options: draw.options as DrawOptions,

View File

@ -12,77 +12,72 @@ import * as movenet from './movenet/movenet';
import * as nanodet from './object/nanodet'; import * as nanodet from './object/nanodet';
import * as centernet from './object/centernet'; import * as centernet from './object/centernet';
import * as segmentation from './segmentation/segmentation'; import * as segmentation from './segmentation/segmentation';
import type { Human } from './human';
import { env } from './env'; import { env } from './env';
// import * as agegenderrace from './gear/agegenderrace'; import * as agegenderrace from './gear/agegenderrace';
export function reset(instance) { /** Instances of all possible TFJS Graph Models used by Human
* - loaded as needed based on configuration
* - initialized explictly with `human.load()` method
* - initialized implicity on first call to `human.detect()`
* - each model can be `null` if not loaded, instance of `GraphModel` if loaded or `Promise` if loading
*/
export class Models {
age: null | GraphModel | Promise<GraphModel> = null;
agegenderrace: null | GraphModel | Promise<GraphModel> = null;
blazepose: null | GraphModel | Promise<GraphModel> = null;
centernet: null | GraphModel | Promise<GraphModel> = null;
efficientpose: null | GraphModel | Promise<GraphModel> = null;
embedding: null | GraphModel | Promise<GraphModel> = null;
emotion: null | GraphModel | Promise<GraphModel> = null;
facedetect: null | GraphModel | Promise<GraphModel> = null;
faceiris: null | GraphModel | Promise<GraphModel> = null;
facemesh: null | GraphModel | Promise<GraphModel> = null;
faceres: null | GraphModel | Promise<GraphModel> = null;
gender: null | GraphModel | Promise<GraphModel> = null;
handpose: null | GraphModel | Promise<GraphModel> = null;
handskeleton: null | GraphModel | Promise<GraphModel> = null;
handtrack: null | GraphModel | Promise<GraphModel> = null;
movenet: null | GraphModel | Promise<GraphModel> = null;
nanodet: null | GraphModel | Promise<GraphModel> = null;
posenet: null | GraphModel | Promise<GraphModel> = null;
segmentation: null | GraphModel | Promise<GraphModel> = null;
}
export function reset(instance: Human) {
// if (instance.config.debug) log('resetting loaded models'); // if (instance.config.debug) log('resetting loaded models');
instance.models = { for (const model of Object.keys(instance.models)) instance.models[model] = null;
face: null, // array of models
handpose: null, // array of models
handtrack: null, // array of models
posenet: null,
blazepose: null,
efficientpose: null,
movenet: null,
age: null,
gender: null,
emotion: null,
embedding: null,
nanodet: null,
centernet: null,
faceres: null,
segmentation: null,
};
} }
/** Load method preloads all instance.configured models on-demand */ /** Load method preloads all instance.configured models on-demand */
export async function load(instance) { export async function load(instance: Human) {
if (env.initial) reset(instance); if (env.initial) reset(instance);
if (instance.config.async) { // load models concurrently if (instance.config.face.enabled) { // face model is a combo that must be loaded as a whole
[ if (!instance.models.facedetect) [instance.models.facedetect, instance.models.facemesh, instance.models.faceiris] = await facemesh.load(instance.config);
instance.models.face, if (instance.config.face.mesh?.enabled && !instance.models.facemesh) [instance.models.facedetect, instance.models.facemesh, instance.models.faceiris] = await facemesh.load(instance.config);
instance.models.emotion, if (instance.config.face.iris?.enabled && !instance.models.faceiris) [instance.models.facedetect, instance.models.facemesh, instance.models.faceiris] = await facemesh.load(instance.config);
instance.models.handpose, }
instance.models.handtrack, if (instance.config.hand.enabled) { // handpose model is a combo that must be loaded as a whole
instance.models.posenet, if (!instance.models.handpose && instance.config.hand.detector?.modelPath?.includes('handdetect')) [instance.models.handpose, instance.models.handskeleton] = await handpose.load(instance.config);
instance.models.blazepose, if (!instance.models.handskeleton && instance.config.hand.landmarks && instance.config.hand.detector?.modelPath?.includes('handdetect')) [instance.models.handpose, instance.models.handskeleton] = await handpose.load(instance.config);
instance.models.efficientpose, }
instance.models.movenet, if (instance.config.hand.enabled && !instance.models.handtrack && instance.config.hand.detector?.modelPath?.includes('handtrack')) instance.models.handtrack = handtrack.loadDetect(instance.config);
instance.models.nanodet, if (instance.config.hand.enabled && instance.config.hand.landmarks && !instance.models.handskeleton && instance.config.hand.detector?.modelPath?.includes('handtrack')) instance.models.handskeleton = handtrack.loadSkeleton(instance.config);
instance.models.centernet, if (instance.config.body.enabled && !instance.models.posenet && instance.config.body?.modelPath?.includes('posenet')) instance.models.posenet = posenet.load(instance.config);
instance.models.faceres, if (instance.config.body.enabled && !instance.models.efficientpose && instance.config.body?.modelPath?.includes('efficientpose')) instance.models.efficientpose = efficientpose.load(instance.config);
instance.models.segmentation, if (instance.config.body.enabled && !instance.models.blazepose && instance.config.body?.modelPath?.includes('blazepose')) instance.models.blazepose = blazepose.load(instance.config);
// instance.models.agegenderrace, if (instance.config.body.enabled && !instance.models.efficientpose && instance.config.body?.modelPath?.includes('efficientpose')) instance.models.efficientpose = blazepose.load(instance.config);
] = await Promise.all([ if (instance.config.body.enabled && !instance.models.movenet && instance.config.body?.modelPath?.includes('movenet')) instance.models.movenet = movenet.load(instance.config);
instance.models.face || (instance.config.face.enabled ? facemesh.load(instance.config) : null), if (instance.config.object.enabled && !instance.models.nanodet && instance.config.object?.modelPath?.includes('nanodet')) instance.models.nanodet = nanodet.load(instance.config);
instance.models.emotion || ((instance.config.face.enabled && instance.config.face.emotion.enabled) ? emotion.load(instance.config) : null), if (instance.config.object.enabled && !instance.models.centernet && instance.config.object?.modelPath?.includes('centernet')) instance.models.centernet = centernet.load(instance.config);
instance.models.handpose || (instance.config.hand.enabled && instance.config.hand.detector.modelPath.includes('handdetect') ? handpose.load(instance.config) : null), if (instance.config.face.enabled && instance.config.face.emotion?.enabled && !instance.models.emotion) instance.models.emotion = emotion.load(instance.config);
instance.models.handtrack || (instance.config.hand.enabled && instance.config.hand.detector.modelPath.includes('handtrack') ? handtrack.load(instance.config) : null), if (instance.config.face.enabled && instance.config.face.description?.enabled && !instance.models.faceres) instance.models.faceres = faceres.load(instance.config);
instance.models.posenet || (instance.config.body.enabled && instance.config.body.modelPath.includes('posenet') ? posenet.load(instance.config) : null), if (instance.config.segmentation.enabled && !instance.models.segmentation) instance.models.segmentation = segmentation.load(instance.config);
instance.models.blazepose || (instance.config.body.enabled && instance.config.body.modelPath.includes('blazepose') ? blazepose.load(instance.config) : null), if (instance.config.face.enabled && instance.config.face['agegenderrace']?.enabled && !instance.models.agegenderrace) instance.models.agegenderrace = agegenderrace.load(instance.config);
instance.models.efficientpose || (instance.config.body.enabled && instance.config.body.modelPath.includes('efficientpose') ? efficientpose.load(instance.config) : null),
instance.models.movenet || (instance.config.body.enabled && instance.config.body.modelPath.includes('movenet') ? movenet.load(instance.config) : null), // models are loaded in parallel asynchronously so lets wait until they are actually loaded
instance.models.nanodet || (instance.config.object.enabled && instance.config.object.modelPath.includes('nanodet') ? nanodet.load(instance.config) : null), for await (const model of Object.keys(instance.models)) {
instance.models.centernet || (instance.config.object.enabled && instance.config.object.modelPath.includes('centernet') ? centernet.load(instance.config) : null), if (instance.models[model] && typeof instance.models[model] !== 'undefined') instance.models[model] = await instance.models[model];
instance.models.faceres || ((instance.config.face.enabled && instance.config.face.description.enabled) ? faceres.load(instance.config) : null),
instance.models.segmentation || (instance.config.segmentation.enabled ? segmentation.load(instance.config) : null),
// instance.models.agegenderrace || ((instance.config.face.enabled && instance.config.face.agegenderrace.enabled) ? agegenderrace.load(instance.config) : null),
]);
} else { // load models sequentially
if (instance.config.face.enabled && !instance.models.face) instance.models.face = await facemesh.load(instance.config);
if (instance.config.face.enabled && instance.config.face.emotion.enabled && !instance.models.emotion) instance.models.emotion = await emotion.load(instance.config);
if (instance.config.hand.enabled && !instance.models.handpose && instance.config.hand.detector.modelPath.includes('handdetect')) instance.models.handpose = await handpose.load(instance.config);
if (instance.config.hand.enabled && !instance.models.handtrack && instance.config.hand.detector.modelPath.includes('handtrack')) instance.models.handtrack = await handtrack.load(instance.config);
if (instance.config.body.enabled && !instance.models.posenet && instance.config.body.modelPath.includes('posenet')) instance.models.posenet = await posenet.load(instance.config);
if (instance.config.body.enabled && !instance.models.blazepose && instance.config.body.modelPath.includes('blazepose')) instance.models.blazepose = await blazepose.load(instance.config);
if (instance.config.body.enabled && !instance.models.efficientpose && instance.config.body.modelPath.includes('efficientpose')) instance.models.efficientpose = await blazepose.load(instance.config);
if (instance.config.body.enabled && !instance.models.movenet && instance.config.body.modelPath.includes('movenet')) instance.models.movenet = await movenet.load(instance.config);
if (instance.config.object.enabled && !instance.models.nanodet && instance.config.object.modelPath.includes('nanodet')) instance.models.nanodet = await nanodet.load(instance.config);
if (instance.config.object.enabled && !instance.models.centernet && instance.config.object.modelPath.includes('centernet')) instance.models.centernet = await centernet.load(instance.config);
if (instance.config.face.enabled && instance.config.face.description.enabled && !instance.models.faceres) instance.models.faceres = await faceres.load(instance.config);
if (instance.config.segmentation.enabled && !instance.models.segmentation) instance.models.segmentation = await segmentation.load(instance.config);
// if (instance.config.face.enabled && instance.config.face.agegenderrace.enabled && !instance.models.agegenderrace) instance.models.agegenderrace = await agegenderrace.load(instance.config);
} }
} }

View File

@ -9,6 +9,7 @@ import type { ObjectResult } 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';
import { env } from '../env'; import { env } from '../env';
import { fakeOps } from '../tfjs/backend';
let model: GraphModel | null; let model: GraphModel | null;
let inputSize = 0; let inputSize = 0;
@ -18,6 +19,7 @@ let skipped = Number.MAX_SAFE_INTEGER;
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;
if (!model) { if (!model) {
fakeOps(['floormod'], config);
model = await tf.loadGraphModel(join(config.modelBasePath, config.object.modelPath || '')) as unknown as GraphModel; model = await tf.loadGraphModel(join(config.modelBasePath, config.object.modelPath || '')) as unknown as GraphModel;
const inputs = Object.values(model.modelSignature['inputs']); const inputs = Object.values(model.modelSignature['inputs']);
inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0; inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;

View File

@ -96,3 +96,19 @@ export async function check(instance, force = false) {
} }
return true; return true;
} }
// register fake missing tfjs ops
export function fakeOps(kernelNames: Array<string>, config) {
// if (config.debug) log('registerKernel:', kernelNames);
for (const kernelName of kernelNames) {
const kernelConfig = {
kernelName,
backendName: config.backend,
kernelFunc: () => { if (config.debug) log('kernelFunc', kernelName, config.backend); },
// setupFunc: () => { if (config.debug) log('kernelFunc', kernelName, config.backend); },
// disposeFunc: () => { if (config.debug) log('kernelFunc', kernelName, config.backend); },
};
tf.registerKernel(kernelConfig);
}
env.env.kernels = tf.getKernelsForBackend(tf.getBackend()).map((kernel) => kernel.kernelName.toLowerCase()); // re-scan registered ops
}

View File

@ -1,24 +1,24 @@
2021-09-22 19:21:14 INFO:  @vladmandic/human version 2.2.2 2021-09-23 14:08:34 INFO:  @vladmandic/human version 2.2.2
2021-09-22 19:21:14 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.5.0 2021-09-23 14:08:34 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.5.0
2021-09-22 19:21:14 INFO:  Application: {"name":"@vladmandic/human","version":"2.2.2"} 2021-09-23 14:08:34 INFO:  Application: {"name":"@vladmandic/human","version":"2.2.2"}
2021-09-22 19:21:14 INFO:  Environment: {"profile":"production","config":"build.json","tsconfig":true,"eslintrc":true,"git":true} 2021-09-23 14:08:34 INFO:  Environment: {"profile":"production","config":"build.json","tsconfig":true,"eslintrc":true,"git":true}
2021-09-22 19:21:14 INFO:  Toolchain: {"build":"0.5.3","esbuild":"0.13.0","typescript":"4.4.3","typedoc":"0.22.4","eslint":"7.32.0"} 2021-09-23 14:08:34 INFO:  Toolchain: {"build":"0.5.3","esbuild":"0.13.0","typescript":"4.4.3","typedoc":"0.22.4","eslint":"7.32.0"}
2021-09-22 19:21:14 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]} 2021-09-23 14:08:34 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2021-09-22 19:21:14 STATE: Clean: {"locations":["dist/*","types/*","typedoc/*"]} 2021-09-23 14:08:34 STATE: Clean: {"locations":["dist/*","types/*","typedoc/*"]}
2021-09-22 19:21:14 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-09-23 14:08:34 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-09-22 19:21:14 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":51,"inputBytes":496083,"outputBytes":418081} 2021-09-23 14:08:34 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":52,"inputBytes":500970,"outputBytes":420615}
2021-09-22 19:21:14 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-09-23 14:08:34 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-09-22 19:21:14 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":51,"inputBytes":496091,"outputBytes":418085} 2021-09-23 14:08:34 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":52,"inputBytes":500978,"outputBytes":420619}
2021-09-22 19:21:14 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-09-23 14:08:34 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-09-22 19:21:14 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":51,"inputBytes":496158,"outputBytes":418157} 2021-09-23 14:08:34 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":52,"inputBytes":501045,"outputBytes":420691}
2021-09-22 19:21:14 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":1631} 2021-09-23 14:08:34 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":1631}
2021-09-22 19:21:14 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":3088,"outputBytes":793} 2021-09-23 14:08:34 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":3088,"outputBytes":793}
2021-09-22 19:21:14 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":51,"inputBytes":495601,"outputBytes":419606} 2021-09-23 14:08:34 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":52,"inputBytes":500488,"outputBytes":422090}
2021-09-22 19:21:15 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":8,"inputBytes":3088,"outputBytes":2377041} 2021-09-23 14:08:34 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":8,"inputBytes":3088,"outputBytes":2377041}
2021-09-22 19:21:15 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":51,"inputBytes":2871849,"outputBytes":1415684} 2021-09-23 14:08:35 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":52,"inputBytes":2876736,"outputBytes":1417147}
2021-09-22 19:21:15 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":51,"inputBytes":2871849,"outputBytes":2624079} 2021-09-23 14:08:35 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":52,"inputBytes":2876736,"outputBytes":2626498}
2021-09-22 19:21:32 STATE: Typings: {"input":"src/human.ts","output":"types","files":96} 2021-09-23 14:08:51 STATE: Typings: {"input":"src/human.ts","output":"types","files":98}
2021-09-22 19:21:39 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":30,"generated":true} 2021-09-23 14:08:57 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":31,"generated":true}
2021-09-22 19:22:06 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":84,"errors":0,"warnings":0} 2021-09-23 14:09:22 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":84,"errors":0,"warnings":0}
2021-09-22 19:22:07 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"} 2021-09-23 14:09:22 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2021-09-22 19:22:07 INFO:  Done... 2021-09-23 14:09:22 INFO:  Done...

View File

@ -3,7 +3,6 @@ const process = require('process');
const canvasJS = require('canvas'); const canvasJS = require('canvas');
let fetch; // fetch is dynamically imported later let fetch; // fetch is dynamically imported later
let tensors = 0;
let config; let config;
const log = (status, ...data) => { const log = (status, ...data) => {
@ -73,10 +72,9 @@ async function testInstance(human) {
log('info', 'tfjs version:', human.tf.version.tfjs); log('info', 'tfjs version:', human.tf.version.tfjs);
await human.load(); await human.load();
tensors = human.tf.engine().state.numTensors;
if (config.backend === human.tf.getBackend()) log('state', 'passed: set backend:', config.backend); if (config.backend === human.tf.getBackend()) log('state', 'passed: set backend:', config.backend);
else log('error', 'failed: set backend:', config.backend); else log('error', 'failed: set backend:', config.backend);
log('state', 'tensors', tensors); log('state', 'tensors', human.tf.memory().numTensors);
if (human.models) { if (human.models) {
log('state', 'passed: load models'); log('state', 'passed: load models');
@ -107,9 +105,9 @@ async function testWarmup(human, title) {
return warmup; return warmup;
} }
async function testDetect(human, input, title) { async function testDetect(human, input, title, checkLeak = true) {
await human.load(config); await human.load(config);
tensors = human.tf.engine().state.numTensors; const tensors = human.tf.engine().state.numTensors;
const image = input ? await getImage(human, input) : human.tf.randomNormal([1, 1024, 1024, 3]); const image = input ? await getImage(human, input) : human.tf.randomNormal([1, 1024, 1024, 3]);
if (!image) { if (!image) {
log('error', 'failed: detect: input is null'); log('error', 'failed: detect: input is null');
@ -130,6 +128,11 @@ async function testDetect(human, input, title) {
} else { } else {
log('error', 'failed: detect', input || 'random', title); log('error', 'failed: detect', input || 'random', title);
} }
// check tensor leaks
if (checkLeak) {
const leak = human.tf.engine().state.numTensors - tensors;
if (leak !== 0) log('error', 'failed: memory leak', leak);
}
return detect; return detect;
} }
const evt = { image: 0, detect: 0, warmup: 0 }; const evt = { image: 0, detect: 0, warmup: 0 };
@ -170,8 +173,8 @@ async function test(Human, inputConfig) {
await human.load(); await human.load();
const models = Object.keys(human.models).map((model) => ({ name: model, loaded: (human.models[model] !== null) })); const models = Object.keys(human.models).map((model) => ({ name: model, loaded: (human.models[model] !== null) }));
const loaded = models.filter((model) => model.loaded); const loaded = models.filter((model) => model.loaded);
if (models.length === 15 && loaded.length === 7) log('state', 'passed: models loaded', models.length, loaded.length); if (models.length === 19 && loaded.length === 10) log('state', 'passed: models loaded', models);
else log('error', 'failed: models loaded', models.length, loaded.length); else log('error', 'failed: models loaded', models);
// test warmup sequences // test warmup sequences
await testInstance(human); await testInstance(human);
@ -315,15 +318,15 @@ async function test(Human, inputConfig) {
// test async multiple instances // test async multiple instances
log('info', 'test: concurrent'); log('info', 'test: concurrent');
await Promise.all([ await Promise.all([
testDetect(human, 'samples/ai-face.jpg', 'default'), testDetect(human, 'samples/ai-face.jpg', 'default', false),
testDetect(first, 'samples/ai-face.jpg', 'default'), testDetect(first, 'samples/ai-face.jpg', 'default', false),
testDetect(second, 'samples/ai-face.jpg', 'default'), testDetect(second, 'samples/ai-face.jpg', 'default', false),
testDetect(human, 'samples/ai-body.jpg', 'default'), testDetect(human, 'samples/ai-body.jpg', 'default', false),
testDetect(first, 'samples/ai-body.jpg', 'default'), testDetect(first, 'samples/ai-body.jpg', 'default', false),
testDetect(second, 'samples/ai-body.jpg', 'default'), testDetect(second, 'samples/ai-body.jpg', 'default', false),
testDetect(human, 'samples/ai-upper.jpg', 'default'), testDetect(human, 'samples/ai-upper.jpg', 'default', false),
testDetect(first, 'samples/ai-upper.jpg', 'default'), testDetect(first, 'samples/ai-upper.jpg', 'default', false),
testDetect(second, 'samples/ai-upper.jpg', 'default'), testDetect(second, 'samples/ai-upper.jpg', 'default', false),
]); ]);
// test monkey-patch // test monkey-patch
@ -346,11 +349,6 @@ async function test(Human, inputConfig) {
// tests end // tests end
const t1 = process.hrtime.bigint(); const t1 = process.hrtime.bigint();
// check tensor leaks
const leak = human.tf.engine().state.numTensors - tensors;
if (leak === 0) log('state', 'passeed: no memory leak');
else log('error', 'failed: memory leak', leak);
// check if all instances reported same // check if all instances reported same
const tensors1 = human.tf.engine().state.numTensors; const tensors1 = human.tf.engine().state.numTensors;
const tensors2 = first.tf.engine().state.numTensors; const tensors2 = first.tf.engine().state.numTensors;
@ -360,6 +358,7 @@ async function test(Human, inputConfig) {
// report end // report end
log('info', 'events:', evt); log('info', 'events:', evt);
log('info', 'tensors', human.tf.memory().numTensors);
log('info', 'test complete:', Math.trunc(Number(t1 - t0) / 1000 / 1000), 'ms'); log('info', 'test complete:', Math.trunc(Number(t1 - t0) / 1000 / 1000), 'ms');
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -8,15 +8,15 @@
</ul> </ul>
</div><dl class="tsd-comment-tags"><dt>param userConfig:</dt><dd><p><a href="../interfaces/Config.html">Config</a></p> </div><dl class="tsd-comment-tags"><dt>param userConfig:</dt><dd><p><a href="../interfaces/Config.html">Config</a></p>
</dd><dt>returns</dt><dd><p>instance</p> </dd><dt>returns</dt><dd><p>instance</p>
</dd></dl></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Human</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>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Human.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#config" class="tsd-kind-icon">config</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#draw" class="tsd-kind-icon">draw</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#env" class="tsd-kind-icon">env</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#events" class="tsd-kind-icon">events</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceTriangulation" class="tsd-kind-icon">face<wbr/>Triangulation</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceUVMap" class="tsd-kind-icon">faceUVMap</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#gl" class="tsd-kind-icon">gl</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#performance" class="tsd-kind-icon">performance</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#process" class="tsd-kind-icon">process</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#result" class="tsd-kind-icon">result</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#state" class="tsd-kind-icon">state</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#version" class="tsd-kind-icon">version</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#detect" class="tsd-kind-icon">detect</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#enhance" class="tsd-kind-icon">enhance</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#image" class="tsd-kind-icon">image</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#init" class="tsd-kind-icon">init</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#load" class="tsd-kind-icon">load</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#match" class="tsd-kind-icon">match</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#next" class="tsd-kind-icon">next</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#reset" class="tsd-kind-icon">reset</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#segmentation" class="tsd-kind-icon">segmentation</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#similarity" class="tsd-kind-icon">similarity</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#validate" class="tsd-kind-icon">validate</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#warmup" class="tsd-kind-icon">warmup</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"><a name="constructor" class="tsd-anchor"></a><h3>constructor</h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">new <wbr/>Human<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Human.html" class="tsd-signature-type" data-tsd-kind="Class">Human</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L170">human.ts:170</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </dd></dl></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Human</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>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Human.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#config" class="tsd-kind-icon">config</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#draw" class="tsd-kind-icon">draw</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#env" class="tsd-kind-icon">env</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#events" class="tsd-kind-icon">events</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceTriangulation" class="tsd-kind-icon">face<wbr/>Triangulation</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceUVMap" class="tsd-kind-icon">faceUVMap</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#gl" class="tsd-kind-icon">gl</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#performance" class="tsd-kind-icon">performance</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#process" class="tsd-kind-icon">process</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#result" class="tsd-kind-icon">result</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#state" class="tsd-kind-icon">state</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#version" class="tsd-kind-icon">version</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#detect" class="tsd-kind-icon">detect</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#enhance" class="tsd-kind-icon">enhance</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#image" class="tsd-kind-icon">image</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#init" class="tsd-kind-icon">init</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#load" class="tsd-kind-icon">load</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#match" class="tsd-kind-icon">match</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#next" class="tsd-kind-icon">next</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#reset" class="tsd-kind-icon">reset</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#segmentation" class="tsd-kind-icon">segmentation</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#similarity" class="tsd-kind-icon">similarity</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#validate" class="tsd-kind-icon">validate</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#warmup" class="tsd-kind-icon">warmup</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"><a name="constructor" class="tsd-anchor"></a><h3>constructor</h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">new <wbr/>Human<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Human.html" class="tsd-signature-type" data-tsd-kind="Class">Human</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L155">human.ts:155</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Constructor for <strong>Human</strong> library that is futher used for all operations</p> <p>Constructor for <strong>Human</strong> library that is futher used for all operations</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="Human.html" class="tsd-signature-type" data-tsd-kind="Class">Human</a></h4><div><p>instance</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="Human.html" class="tsd-signature-type" data-tsd-kind="Class">Human</a></h4><div><p>instance</p>
</div></li></ul></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-class"><a name="config" class="tsd-anchor"></a><h3>config</h3><div class="tsd-signature tsd-kind-icon">config<span class="tsd-signature-symbol">:</span> <a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L84">human.ts:84</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></li></ul></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-class"><a name="config" class="tsd-anchor"></a><h3>config</h3><div class="tsd-signature tsd-kind-icon">config<span class="tsd-signature-symbol">:</span> <a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L85">human.ts:85</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Current configuration</p> <p>Current configuration</p>
<ul> <ul>
<li>Details: <a href="../interfaces/Config.html">Config</a></li> <li>Details: <a href="../interfaces/Config.html">Config</a></li>
</ul> </ul>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="draw" class="tsd-anchor"></a><h3>draw</h3><div class="tsd-signature tsd-kind-icon">draw<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>all<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>body<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>face<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>gesture<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>hand<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>object<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>options<span class="tsd-signature-symbol">: </span><a href="../interfaces/DrawOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">DrawOptions</a><span class="tsd-signature-symbol">; </span>person<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L117">human.ts:117</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-class"><a name="draw" class="tsd-anchor"></a><h3>draw</h3><div class="tsd-signature tsd-kind-icon">draw<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>all<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>body<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>face<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>gesture<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>hand<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>object<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>options<span class="tsd-signature-symbol">: </span><a href="../interfaces/DrawOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">DrawOptions</a><span class="tsd-signature-symbol">; </span>person<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L118">human.ts:118</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Draw helper classes that can draw detected objects on canvas using specified draw</p> <p>Draw helper classes that can draw detected objects on canvas using specified draw</p>
<ul> <ul>
<li>options: <a href="../interfaces/DrawOptions.html">DrawOptions</a> global settings for all draw operations, can be overriden for each draw method</li> <li>options: <a href="../interfaces/DrawOptions.html">DrawOptions</a> global settings for all draw operations, can be overriden for each draw method</li>
@ -26,9 +26,9 @@
<li>canvas: draw processed canvas which is a processed copy of the input</li> <li>canvas: draw processed canvas which is a processed copy of the input</li>
<li>all: meta-function that performs: canvas, face, body, hand</li> <li>all: meta-function that performs: canvas, face, body, hand</li>
</ul> </ul>
</div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>all<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>body<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>face<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>gesture<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>hand<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>object<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>options<span class="tsd-signature-symbol">: </span><a href="../interfaces/DrawOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">DrawOptions</a></h5></li><li class="tsd-parameter"><h5>person<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="env" class="tsd-anchor"></a><h3>env</h3><div class="tsd-signature tsd-kind-icon">env<span class="tsd-signature-symbol">:</span> <a href="../index.html#Env" class="tsd-signature-type" data-tsd-kind="Type alias">Env</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L107">human.ts:107</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>all<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>body<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>face<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>gesture<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>hand<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>object<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>options<span class="tsd-signature-symbol">: </span><a href="../interfaces/DrawOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">DrawOptions</a></h5></li><li class="tsd-parameter"><h5>person<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="env" class="tsd-anchor"></a><h3>env</h3><div class="tsd-signature tsd-kind-icon">env<span class="tsd-signature-symbol">:</span> <a href="../index.html#Env" class="tsd-signature-type" data-tsd-kind="Type alias">Env</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L108">human.ts:108</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Object containing environment information used for diagnostics</p> <p>Object containing environment information used for diagnostics</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="events" class="tsd-anchor"></a><h3>events</h3><div class="tsd-signature tsd-kind-icon">events<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EventTarget</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L150">human.ts:150</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-class"><a name="events" class="tsd-anchor"></a><h3>events</h3><div class="tsd-signature tsd-kind-icon">events<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EventTarget</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L135">human.ts:135</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Container for events dispatched by Human</p> <p>Container for events dispatched by Human</p>
</div><div><p>Possible events:</p> </div><div><p>Possible events:</p>
<ul> <ul>
@ -39,30 +39,30 @@
<li><code>warmup</code>: triggered when warmup is complete</li> <li><code>warmup</code>: triggered when warmup is complete</li>
<li><code>error</code>: triggered on some errors</li> <li><code>error</code>: triggered on some errors</li>
</ul> </ul>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="faceTriangulation" class="tsd-anchor"></a><h3>face<wbr/>Triangulation</h3><div class="tsd-signature tsd-kind-icon">face<wbr/>Triangulation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L152">human.ts:152</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-class"><a name="faceTriangulation" class="tsd-anchor"></a><h3>face<wbr/>Triangulation</h3><div class="tsd-signature tsd-kind-icon">face<wbr/>Triangulation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L137">human.ts:137</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Reference face triangualtion array of 468 points, used for triangle references between points</p> <p>Reference face triangualtion array of 468 points, used for triangle references between points</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="faceUVMap" class="tsd-anchor"></a><h3>faceUVMap</h3><div class="tsd-signature tsd-kind-icon">faceUVMap<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L154">human.ts:154</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-class"><a name="faceUVMap" class="tsd-anchor"></a><h3>faceUVMap</h3><div class="tsd-signature tsd-kind-icon">faceUVMap<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L139">human.ts:139</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Refernce UV map of 468 values, used for 3D mapping of the face mesh</p> <p>Refernce UV map of 468 values, used for 3D mapping of the face mesh</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="gl" class="tsd-anchor"></a><h3>gl</h3><div class="tsd-signature tsd-kind-icon">gl<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><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/human.ts#L161">human.ts:161</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-class"><a name="gl" class="tsd-anchor"></a><h3>gl</h3><div class="tsd-signature tsd-kind-icon">gl<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><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/human.ts#L146">human.ts:146</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>WebGL debug info</p> <p>WebGL debug info</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="performance" class="tsd-anchor"></a><h3>performance</h3><div class="tsd-signature tsd-kind-icon">performance<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><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/human.ts#L156">human.ts:156</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-class"><a name="performance" class="tsd-anchor"></a><h3>performance</h3><div class="tsd-signature tsd-kind-icon">performance<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><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/human.ts#L141">human.ts:141</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Performance object that contains values for all recently performed operations</p> <p>Performance object that contains values for all recently performed operations</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="process" class="tsd-anchor"></a><h3>process</h3><div class="tsd-signature tsd-kind-icon">process<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L98">human.ts:98</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-class"><a name="process" class="tsd-anchor"></a><h3>process</h3><div class="tsd-signature tsd-kind-icon">process<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L99">human.ts:99</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>currenty processed image tensor and canvas</p> <p>currenty processed image tensor and canvas</p>
</div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span></h5></li><li class="tsd-parameter"><h5>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="result" class="tsd-anchor"></a><h3>result</h3><div class="tsd-signature tsd-kind-icon">result<span class="tsd-signature-symbol">:</span> <a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L89">human.ts:89</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span></h5></li><li class="tsd-parameter"><h5>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="result" class="tsd-anchor"></a><h3>result</h3><div class="tsd-signature tsd-kind-icon">result<span class="tsd-signature-symbol">:</span> <a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L90">human.ts:90</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Last known result of detect run</p> <p>Last known result of detect run</p>
<ul> <ul>
<li>Can be accessed anytime after initial detection</li> <li>Can be accessed anytime after initial detection</li>
</ul> </ul>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="state" class="tsd-anchor"></a><h3>state</h3><div class="tsd-signature tsd-kind-icon">state<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/human.ts#L95">human.ts:95</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-class"><a name="state" class="tsd-anchor"></a><h3>state</h3><div class="tsd-signature tsd-kind-icon">state<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/human.ts#L96">human.ts:96</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Current state of Human library</p> <p>Current state of Human library</p>
<ul> <ul>
<li>Can be polled to determine operations that are currently executed</li> <li>Can be polled to determine operations that are currently executed</li>
<li>Progresses through: &#39;config&#39;, &#39;check&#39;, &#39;backend&#39;, &#39;load&#39;, &#39;run:<model>&#39;, &#39;idle&#39;</li> <li>Progresses through: &#39;config&#39;, &#39;check&#39;, &#39;backend&#39;, &#39;load&#39;, &#39;run:<model>&#39;, &#39;idle&#39;</li>
</ul> </ul>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="version" class="tsd-anchor"></a><h3>version</h3><div class="tsd-signature tsd-kind-icon">version<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/human.ts#L79">human.ts:79</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-class"><a name="version" class="tsd-anchor"></a><h3>version</h3><div class="tsd-signature tsd-kind-icon">version<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/human.ts#L80">human.ts:80</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Current version of Human library in <em>semver</em> format</p> <p>Current version of Human library in <em>semver</em> format</p>
</div></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="detect" class="tsd-anchor"></a><h3>detect</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">detect<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a>, userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../index.html#Error" class="tsd-signature-type" data-tsd-kind="Type alias">Error</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L410">human.ts:410</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="detect" class="tsd-anchor"></a><h3>detect</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">detect<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a>, userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../index.html#Error" class="tsd-signature-type" data-tsd-kind="Type alias">Error</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L379">human.ts:379</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Main detection method</p> <p>Main detection method</p>
<ul> <ul>
<li>Analyze configuration: <a href="../interfaces/Config.html">Config</a></li> <li>Analyze configuration: <a href="../interfaces/Config.html">Config</a></li>
@ -71,12 +71,12 @@
<li>Process and return result: <a href="../interfaces/Result.html">Result</a></li> <li>Process and return result: <a href="../interfaces/Result.html">Result</a></li>
</ul> </ul>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../index.html#Error" class="tsd-signature-type" data-tsd-kind="Type alias">Error</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>result: <a href="../interfaces/Result.html">Result</a></p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../index.html#Error" class="tsd-signature-type" data-tsd-kind="Type alias">Error</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>result: <a href="../interfaces/Result.html">Result</a></p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="enhance" class="tsd-anchor"></a><h3>enhance</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">enhance<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L310">human.ts:310</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="enhance" class="tsd-anchor"></a><h3>enhance</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">enhance<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L279">human.ts:279</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Enhance method performs additional enhacements to face image previously detected for futher processing</p> <p>Enhance method performs additional enhacements to face image previously detected for futher processing</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>Tensor</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>Tensor</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="image" class="tsd-anchor"></a><h3>image</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">image<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> }</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L272">human.ts:272</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="image" class="tsd-anchor"></a><h3>image</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">image<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> }</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L241">human.ts:241</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Process input as return canvas and tensor</p> <p>Process input as return canvas and tensor</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> }</span></h4><div></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span></h5></li><li class="tsd-parameter"><h5>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span></h5></li></ul></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="init" class="tsd-anchor"></a><h3>init</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">init<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L333">human.ts:333</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> }</span></h4><div></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span></h5></li><li class="tsd-parameter"><h5>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">&gt;</span></h5></li></ul></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="init" class="tsd-anchor"></a><h3>init</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">init<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L302">human.ts:302</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Explicit backend initialization</p> <p>Explicit backend initialization</p>
<ul> <ul>
<li>Normally done implicitly during initial load phase</li> <li>Normally done implicitly during initial load phase</li>
@ -84,22 +84,22 @@
<li>Use when changing backend during runtime</li> <li>Use when changing backend during runtime</li>
</ul> </ul>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>Promise<void></p> </div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>Promise<void></p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="load" class="tsd-anchor"></a><h3>load</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">load<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L345">human.ts:345</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="load" class="tsd-anchor"></a><h3>load</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">load<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L314">human.ts:314</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Load method preloads all configured models on-demand</p> <p>Load method preloads all configured models on-demand</p>
<ul> <ul>
<li>Not explicitly required as any required model is load implicitly on it&#39;s first run</li> <li>Not explicitly required as any required model is load implicitly on it&#39;s first run</li>
</ul> </ul>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>Promise<void></p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>Promise<void></p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="match" class="tsd-anchor"></a><h3>match</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">match<span class="tsd-signature-symbol">(</span>faceEmbedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span>, db<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span>, threshold<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L322">human.ts:322</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="match" class="tsd-anchor"></a><h3>match</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">match<span class="tsd-signature-symbol">(</span>faceEmbedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span>, db<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span>, threshold<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L291">human.ts:291</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Math method find best match between provided face descriptor and predefined database of known descriptors</p> <p>Math method find best match between provided face descriptor and predefined database of known descriptors</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>faceEmbedding: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li><li><h5>db: <span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></h5></li><li><h5>threshold: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></h4><div><p>best match</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>faceEmbedding: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li><li><h5>db: <span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></h5></li><li><h5>threshold: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></h4><div><p>best match</p>
</div><ul class="tsd-parameters"><li class="tsd-parameter"><h5>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li><li class="tsd-parameter"><h5>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li><li class="tsd-parameter"><h5>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li></ul></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="next" class="tsd-anchor"></a><h3>next</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">next<span class="tsd-signature-symbol">(</span>result<span class="tsd-signature-symbol">?: </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L386">human.ts:386</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div><ul class="tsd-parameters"><li class="tsd-parameter"><h5>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li><li class="tsd-parameter"><h5>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li><li class="tsd-parameter"><h5>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li></ul></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="next" class="tsd-anchor"></a><h3>next</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">next<span class="tsd-signature-symbol">(</span>result<span class="tsd-signature-symbol">?: </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L355">human.ts:355</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Runs interpolation using last known result and returns smoothened result <p>Runs interpolation using last known result and returns smoothened result
Interpolation is based on time since last known result so can be called independently</p> Interpolation is based on time since last known result so can be called independently</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>result: <a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol"> = ...</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></h4><div><p>result: <a href="../interfaces/Result.html">Result</a></p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>result: <a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol"> = ...</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></h4><div><p>result: <a href="../interfaces/Result.html">Result</a></p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="reset" class="tsd-anchor"></a><h3>reset</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">reset<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L258">human.ts:258</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="reset" class="tsd-anchor"></a><h3>reset</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">reset<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L227">human.ts:227</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Reset configuration to default values</p> <p>Reset configuration to default values</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="segmentation" class="tsd-anchor"></a><h3>segmentation</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">segmentation<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a>, background<span class="tsd-signature-symbol">?: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>alpha<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L300">human.ts:300</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="segmentation" class="tsd-anchor"></a><h3>segmentation</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">segmentation<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a>, background<span class="tsd-signature-symbol">?: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>alpha<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L269">human.ts:269</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Segmentation method takes any input and returns processed canvas with body segmentation</p> <p>Segmentation method takes any input and returns processed canvas with body segmentation</p>
<ul> <ul>
<li>Optional parameter background is used to fill the background with specific input</li> <li>Optional parameter background is used to fill the background with specific input</li>
@ -111,16 +111,16 @@ Interpolation is based on time since last known result so can be called independ
<li><code>canvas</code> as canvas which is input image filtered with segementation data and optionally merged with background image. canvas alpha values are set to segmentation values for easy merging</li> <li><code>canvas</code> as canvas which is input image filtered with segementation data and optionally merged with background image. canvas alpha values are set to segmentation values for easy merging</li>
<li><code>alpha</code> as grayscale canvas that represents segmentation alpha values</li> <li><code>alpha</code> as grayscale canvas that represents segmentation alpha values</li>
</ul> </ul>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> background: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>alpha<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></h4><div></div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="similarity" class="tsd-anchor"></a><h3>similarity</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">similarity<span class="tsd-signature-symbol">(</span>embedding1<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span>, embedding2<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L283">human.ts:283</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> background: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>alpha<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></h4><div></div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="similarity" class="tsd-anchor"></a><h3>similarity</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">similarity<span class="tsd-signature-symbol">(</span>embedding1<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span>, embedding2<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L252">human.ts:252</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Simmilarity method calculates simmilarity between two provided face descriptors (face embeddings)</p> <p>Simmilarity method calculates simmilarity between two provided face descriptors (face embeddings)</p>
<ul> <ul>
<li>Calculation is based on normalized Minkowski distance between two descriptors</li> <li>Calculation is based on normalized Minkowski distance between two descriptors</li>
<li>Default is Euclidean distance which is Minkowski distance of 2nd order</li> <li>Default is Euclidean distance which is Minkowski distance of 2nd order</li>
</ul> </ul>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>embedding1: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li><li><h5>embedding2: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div><p>similarity: number</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>embedding1: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li><li><h5>embedding2: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div><p>similarity: number</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="validate" class="tsd-anchor"></a><h3>validate</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">validate<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>expected<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>reason<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>where<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L265">human.ts:265</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="validate" class="tsd-anchor"></a><h3>validate</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">validate<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>expected<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>reason<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>where<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L234">human.ts:234</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Validate current configuration schema</p> <p>Validate current configuration schema</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>expected<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>reason<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>where<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="warmup" class="tsd-anchor"></a><h3>warmup</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">warmup<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">{ </span>error<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L396">human.ts:396</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>expected<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>reason<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>where<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="warmup" class="tsd-anchor"></a><h3>warmup</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">warmup<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">{ </span>error<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L365">human.ts:365</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Warmup method pre-initializes all configured models for faster inference</p> <p>Warmup method pre-initializes all configured models for faster inference</p>
<ul> <ul>
<li>can take significant time on startup</li> <li>can take significant time on startup</li>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@ import type { GraphModel, Tensor } from '../tfjs/types';
import type { FaceResult } from '../result'; import type { FaceResult } from '../result';
import type { Config } from '../config'; import type { Config } from '../config';
export declare function predict(input: Tensor, config: Config): Promise<FaceResult[]>; export declare function predict(input: Tensor, config: Config): Promise<FaceResult[]>;
export declare function load(config: any): Promise<[unknown, GraphModel | null, GraphModel | null]>; export declare function load(config: any): Promise<[GraphModel | null, GraphModel | null, GraphModel | null]>;
export declare const triangulation: number[]; export declare const triangulation: number[];
export declare const uvmap: number[][]; export declare const uvmap: number[][];
//# sourceMappingURL=facemesh.d.ts.map //# sourceMappingURL=facemesh.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"facemesh.d.ts","sourceRoot":"","sources":["../../../src/blazeface/facemesh.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAMxC,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAyClF;AAED,wBAAsB,IAAI,CAAC,MAAM,KAAA,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,CAuB3F;AAED,eAAO,MAAM,aAAa,UAAgB,CAAC;AAC3C,eAAO,MAAM,KAAK,YAAe,CAAC"} {"version":3,"file":"facemesh.d.ts","sourceRoot":"","sources":["../../../src/blazeface/facemesh.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAMxC,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAyClF;AAED,wBAAsB,IAAI,CAAC,MAAM,KAAA,GAAG,OAAO,CAAC,CAAC,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,CAuBrG;AAED,eAAO,MAAM,aAAa,UAAgB,CAAC;AAC3C,eAAO,MAAM,KAAK,YAAe,CAAC"}

View File

@ -35,7 +35,7 @@ export declare class Pipeline {
}; };
getAdjustedIrisCoords(rawCoords: any, irisCoords: any, direction: any): any; getAdjustedIrisCoords(rawCoords: any, irisCoords: any, direction: any): any;
correctFaceRotation(config: any, box: any, input: any): any[]; correctFaceRotation(config: any, box: any, input: any): any[];
augmentIris(rawCoords: any, face: any): Promise<any>; augmentIris(rawCoords: any, face: any, config: any): Promise<any>;
predict(input: any, config: any): Promise<{ predict(input: any, config: any): Promise<{
mesh: any; mesh: any;
box: any; box: any;

View File

@ -1 +1 @@
{"version":3,"file":"facepipeline.d.ts","sourceRoot":"","sources":["../../../src/blazeface/facepipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAU,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAoDlD,qBAAa,QAAQ;IACnB,WAAW,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC;IACpJ,mBAAmB,EAAE,cAAc,CAAC;IACpC,YAAY,EAAE,UAAU,CAAC;IACzB,SAAS,EAAE,UAAU,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;gBAEV,mBAAmB,KAAA,EAAE,YAAY,KAAA,EAAE,SAAS,KAAA;IAcxD,kBAAkB,CAAC,SAAS,KAAA,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,cAAc,KAAA;IAmBxD,gCAAgC,CAAC,SAAS,KAAA;IAO1C,SAAS,CAAC,SAAS,KAAA,EAAE,IAAI,KAAA,EAAE,mBAAmB,KAAA,EAAE,mBAAmB,KAAA,EAAE,IAAI,UAAQ;;;;;;;;;IAiBjF,YAAY,CAAC,OAAO,KAAA,EAAE,MAAM,KAAA,EAAE,UAAU,KAAA,EAAE,IAAI,UAAQ;;;;IAgBtD,qBAAqB,CAAC,SAAS,KAAA,EAAE,UAAU,KAAA,EAAE,SAAS,KAAA;IAgBtD,mBAAmB,CAAC,MAAM,KAAA,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA;IAgBhC,WAAW,CAAC,SAAS,KAAA,EAAE,IAAI,KAAA;IA+B3B,OAAO,CAAC,KAAK,KAAA,EAAE,MAAM,KAAA;;;;;;;;CA+H5B"} {"version":3,"file":"facepipeline.d.ts","sourceRoot":"","sources":["../../../src/blazeface/facepipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAU,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAqDlD,qBAAa,QAAQ;IACnB,WAAW,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC;IACpJ,mBAAmB,EAAE,cAAc,CAAC;IACpC,YAAY,EAAE,UAAU,CAAC;IACzB,SAAS,EAAE,UAAU,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;gBAEV,mBAAmB,KAAA,EAAE,YAAY,KAAA,EAAE,SAAS,KAAA;IAcxD,kBAAkB,CAAC,SAAS,KAAA,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,cAAc,KAAA;IAmBxD,gCAAgC,CAAC,SAAS,KAAA;IAO1C,SAAS,CAAC,SAAS,KAAA,EAAE,IAAI,KAAA,EAAE,mBAAmB,KAAA,EAAE,mBAAmB,KAAA,EAAE,IAAI,UAAQ;;;;;;;;;IAiBjF,YAAY,CAAC,OAAO,KAAA,EAAE,MAAM,KAAA,EAAE,UAAU,KAAA,EAAE,IAAI,UAAQ;;;;IAgBtD,qBAAqB,CAAC,SAAS,KAAA,EAAE,UAAU,KAAA,EAAE,SAAS,KAAA;IAgBtD,mBAAmB,CAAC,MAAM,KAAA,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA;IAgBhC,WAAW,CAAC,SAAS,KAAA,EAAE,IAAI,KAAA,EAAE,MAAM,KAAA;IAmCnC,OAAO,CAAC,KAAK,KAAA,EAAE,MAAM,KAAA;;;;;;;;CAiI5B"}

View File

@ -1 +1 @@
{"version":3,"file":"face.d.ts","sourceRoot":"","sources":["../../src/face.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAwI3C,eAAO,MAAM,UAAU,uBAAiD,MAAM,KAAG,QAAQ,UAAU,EAAE,CAmHpG,CAAC"} {"version":3,"file":"face.d.ts","sourceRoot":"","sources":["../../src/face.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAwI3C,eAAO,MAAM,UAAU,uBAAiD,MAAM,KAAG,QAAQ,UAAU,EAAE,CAoHpG,CAAC"}

9
types/src/gear/agegenderrace.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
/**
* Module that analyzes person age
* Obsolete
*/
import type { Config } from '../config';
import type { GraphModel, Tensor } from '../tfjs/types';
export declare function load(config: Config | any): Promise<GraphModel>;
export declare function predict(image: Tensor, config: Config): Promise<unknown>;
//# sourceMappingURL=agegenderrace.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"agegenderrace.d.ts","sourceRoot":"","sources":["../../../src/gear/agegenderrace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH,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"}

View File

@ -4,6 +4,8 @@
import type { HandResult } from '../result'; import type { HandResult } 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';
export declare function load(config: Config): Promise<[GraphModel, GraphModel]>; export declare function loadDetect(config: Config): Promise<GraphModel>;
export declare function loadSkeleton(config: Config): Promise<GraphModel>;
export declare function load(config: Config): Promise<[GraphModel | null, GraphModel | null]>;
export declare function predict(input: Tensor, config: Config): Promise<HandResult[]>; export declare function predict(input: Tensor, config: Config): Promise<HandResult[]>;
//# sourceMappingURL=handtrack.d.ts.map //# sourceMappingURL=handtrack.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"handtrack.d.ts","sourceRoot":"","sources":["../../../src/handtrack/handtrack.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAiDxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAsB5E;AA+GD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAsBlF"} {"version":3,"file":"handtrack.d.ts","sourceRoot":"","sources":["../../../src/handtrack/handtrack.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAmDxC,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAcpE;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;AA+GD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAsBlF"}

22
types/src/human.d.ts vendored
View File

@ -4,14 +4,16 @@
import { Config } from './config'; import { Config } from './config';
import type { Result } from './result'; import type { Result } from './result';
import * as tf from '../dist/tfjs.esm.js'; import * as tf from '../dist/tfjs.esm.js';
import * as models from './models';
import * as facemesh from './blazeface/facemesh'; import * as facemesh from './blazeface/facemesh';
import * as env from './env'; import * as env from './env';
import type { Tensor, GraphModel } from './tfjs/types'; import type { Tensor } from './tfjs/types';
import type { DrawOptions } from './draw'; import type { DrawOptions } from './draw';
export * from './config'; export * from './config';
export * from './result'; export * from './result';
export type { DrawOptions } from './draw'; export type { DrawOptions } from './draw';
export { env, Env } from './env'; export { env, Env } from './env';
export { Models } from './models';
/** Defines all possible input types for **Human** detection /** Defines all possible input types for **Human** detection
* @typedef Input Type * @typedef Input Type
*/ */
@ -97,23 +99,7 @@ export declare class Human {
/** Currently loaded models /** Currently loaded models
* @internal * @internal
*/ */
models: { models: models.Models;
face: [unknown, GraphModel | null, GraphModel | null] | null;
posenet: GraphModel | null;
blazepose: GraphModel | null;
efficientpose: GraphModel | null;
movenet: GraphModel | null;
handpose: [GraphModel | null, GraphModel | null] | null;
handtrack: [GraphModel | null, GraphModel | null] | null;
age: GraphModel | null;
gender: GraphModel | null;
emotion: GraphModel | null;
embedding: GraphModel | null;
nanodet: GraphModel | null;
centernet: GraphModel | null;
faceres: GraphModel | null;
segmentation: GraphModel | null;
};
/** Container for events dispatched by Human /** Container for events dispatched by Human
* *
* Possible events: * Possible events:

View File

@ -1 +1 @@
{"version":3,"file":"human.d.ts","sourceRoot":"","sources":["../../src/human.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAY,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAiF,MAAM,UAAU,CAAC;AACtH,OAAO,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG1C,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAgBjD,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAK7B,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAG1C,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC;;GAEG;AACH,oBAAY,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAEpJ;;;;;;;GAOG;AACH,oBAAY,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjF;;GAEG;AACH,oBAAY,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC;;GAEG;AACH,oBAAY,UAAU,GAAG,OAAO,EAAE,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,qBAAa,KAAK;;IAChB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd,iDAAiD;IACjD,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,GAAG,IAAI,CAAA;KAAE,CAAC;IAEvF;;;OAGG;IACH,EAAE,EAAE,UAAU,CAAC;IAEf,qEAAqE;IACrE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC;IAEb;;;;;;;OAOG;IACH,IAAI,EAAE;QAAE,MAAM,MAAC;QAAC,IAAI,MAAC;QAAC,IAAI,MAAC;QAAC,IAAI,MAAC;QAAC,OAAO,MAAC;QAAC,MAAM,MAAC;QAAC,MAAM,MAAC;QAAC,GAAG,MAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC;IAEvF;;MAEE;IACF,MAAM,EAAE;QACN,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;QAC7D,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;QAC3B,SAAS,EAAE,UAAU,GAAG,IAAI,CAAC;QAC7B,aAAa,EAAE,UAAU,GAAG,IAAI,CAAC;QACjC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;QAC3B,QAAQ,EAAE,CAAC,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;QACxD,SAAS,EAAE,CAAC,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;QACzD,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;QACvB,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;QAC1B,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;QAC3B,SAAS,EAAE,UAAU,GAAG,IAAI,CAAC;QAC7B,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;QAC3B,SAAS,EAAE,UAAU,GAAG,IAAI,CAAC;QAC7B,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;QAC3B,YAAY,EAAE,UAAU,GAAG,IAAI,CAAC;KACjC,CAAC;IAEF;;;;;;;;;OASG;IACH,MAAM,EAAE,WAAW,CAAC;IACpB,oGAAoG;IACpG,iBAAiB,EAAE,OAAO,QAAQ,CAAC,aAAa,CAAC;IACjD,0EAA0E;IAC1E,SAAS,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC;IACjC,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAIpC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAG5B;;;;;OAKG;gBACS,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;IA+DxC,cAAc;IACd,OAAO,WAAY,MAAM,EAAE,UAO1B;IAgBD,4CAA4C;IAC5C,KAAK,aAIJ;IAED,4CAA4C;IAC5C,QAAQ;;;;QAAmF;IAE3F;;;;OAIG;IACH,KAAK,UAAW,KAAK;;;MAAuC;IAE5D;;;;;;;MAOE;IAEF,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIxE;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAA;KAAE,CAAC;IAIxL;;;;OAIG;IAEH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrC;;;;;;OAMG;IAEH,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,EAAE,SAAS,SAAI,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE;IAI/L;;;;;;OAMG;IACG,IAAI;IAMV;;;;;MAKE;IACI,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;IAgCvC,cAAc;IACd,IAAI,UAAW,MAAM,aAAkD;IAEvE;;;;;OAKG;IACH,IAAI,CAAC,MAAM,GAAE,MAAoB;IAIjC;;;;;MAKE;IACI,MAAM,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG;QAAE,KAAK,MAAA;KAAE,CAAC;IAIvE;;;;;;;;;MASE;IACI,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;CA8JlF;AAED,oCAAoC;AACpC,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,CAAC"} {"version":3,"file":"human.d.ts","sourceRoot":"","sources":["../../src/human.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAY,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAiF,MAAM,UAAU,CAAC;AACtH,OAAO,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAgBjD,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAK7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAG1C,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;GAEG;AACH,oBAAY,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAEpJ;;;;;;;GAOG;AACH,oBAAY,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjF;;GAEG;AACH,oBAAY,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC;;GAEG;AACH,oBAAY,UAAU,GAAG,OAAO,EAAE,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,qBAAa,KAAK;;IAChB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd,iDAAiD;IACjD,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,GAAG,IAAI,CAAA;KAAE,CAAC;IAEvF;;;OAGG;IACH,EAAE,EAAE,UAAU,CAAC;IAEf,qEAAqE;IACrE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC;IAEb;;;;;;;OAOG;IACH,IAAI,EAAE;QAAE,MAAM,MAAC;QAAC,IAAI,MAAC;QAAC,IAAI,MAAC;QAAC,IAAI,MAAC;QAAC,OAAO,MAAC;QAAC,MAAM,MAAC;QAAC,MAAM,MAAC;QAAC,GAAG,MAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC;IAEvF;;MAEE;IACF,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;IAEtB;;;;;;;;;OASG;IACH,MAAM,EAAE,WAAW,CAAC;IACpB,oGAAoG;IACpG,iBAAiB,EAAE,OAAO,QAAQ,CAAC,aAAa,CAAC;IACjD,0EAA0E;IAC1E,SAAS,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC;IACjC,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAIpC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAG5B;;;;;OAKG;gBACS,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;IA+CxC,cAAc;IACd,OAAO,WAAY,MAAM,EAAE,UAO1B;IAgBD,4CAA4C;IAC5C,KAAK,aAIJ;IAED,4CAA4C;IAC5C,QAAQ;;;;QAAmF;IAE3F;;;;OAIG;IACH,KAAK,UAAW,KAAK;;;MAAuC;IAE5D;;;;;;;MAOE;IAEF,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIxE;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAA;KAAE,CAAC;IAIxL;;;;OAIG;IAEH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrC;;;;;;OAMG;IAEH,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,EAAE,SAAS,SAAI,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE;IAI/L;;;;;;OAMG;IACG,IAAI;IAMV;;;;;MAKE;IACI,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;IAgCvC,cAAc;IACd,IAAI,UAAW,MAAM,aAAkD;IAEvE;;;;;OAKG;IACH,IAAI,CAAC,MAAM,GAAE,MAAoB;IAIjC;;;;;MAKE;IACI,MAAM,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG;QAAE,KAAK,MAAA;KAAE,CAAC;IAIvE;;;;;;;;;MASE;IACI,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;CA8JlF;AAED,oCAAoC;AACpC,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,CAAC"}

33
types/src/models.d.ts vendored
View File

@ -1,5 +1,34 @@
export declare function reset(instance: any): void; import type { GraphModel } from './tfjs/types';
import type { Human } from './human';
/** Instances of all possible TFJS Graph Models used by Human
* - loaded as needed based on configuration
* - initialized explictly with `human.load()` method
* - initialized implicity on first call to `human.detect()`
* - each model can be `null` if not loaded, instance of `GraphModel` if loaded or `Promise` if loading
*/
export declare class Models {
age: null | GraphModel | Promise<GraphModel>;
agegenderrace: null | GraphModel | Promise<GraphModel>;
blazepose: null | GraphModel | Promise<GraphModel>;
centernet: null | GraphModel | Promise<GraphModel>;
efficientpose: null | GraphModel | Promise<GraphModel>;
embedding: null | GraphModel | Promise<GraphModel>;
emotion: null | GraphModel | Promise<GraphModel>;
facedetect: null | GraphModel | Promise<GraphModel>;
faceiris: null | GraphModel | Promise<GraphModel>;
facemesh: null | GraphModel | Promise<GraphModel>;
faceres: null | GraphModel | Promise<GraphModel>;
gender: null | GraphModel | Promise<GraphModel>;
handpose: null | GraphModel | Promise<GraphModel>;
handskeleton: null | GraphModel | Promise<GraphModel>;
handtrack: null | GraphModel | Promise<GraphModel>;
movenet: null | GraphModel | Promise<GraphModel>;
nanodet: null | GraphModel | Promise<GraphModel>;
posenet: null | GraphModel | Promise<GraphModel>;
segmentation: null | GraphModel | Promise<GraphModel>;
}
export declare function reset(instance: Human): void;
/** Load method preloads all instance.configured models on-demand */ /** Load method preloads all instance.configured models on-demand */
export declare function load(instance: any): Promise<void>; export declare function load(instance: Human): Promise<void>;
export declare function validate(instance: any): Promise<void>; export declare function validate(instance: any): Promise<void>;
//# sourceMappingURL=models.d.ts.map //# sourceMappingURL=models.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAiBA,wBAAgB,KAAK,CAAC,QAAQ,KAAA,QAmB7B;AAED,oEAAoE;AACpE,wBAAsB,IAAI,CAAC,QAAQ,KAAA,iBA+ClC;AAED,wBAAsB,QAAQ,CAAC,QAAQ,KAAA,iBA4CtC"} {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAa/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIrC;;;;;GAKG;AACH,qBAAa,MAAM;IACjB,GAAG,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACpD,aAAa,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC9D,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,aAAa,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC9D,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,UAAU,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3D,QAAQ,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACzD,QAAQ,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACzD,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,MAAM,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACvD,QAAQ,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACzD,YAAY,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC7D,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,YAAY,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;CAC9D;AAED,wBAAgB,KAAK,CAAC,QAAQ,EAAE,KAAK,QAGpC;AAED,oEAAoE;AACpE,wBAAsB,IAAI,CAAC,QAAQ,EAAE,KAAK,iBA6BzC;AAED,wBAAsB,QAAQ,CAAC,QAAQ,KAAA,iBA4CtC"}

View File

@ -1 +1 @@
{"version":3,"file":"centernet.d.ts","sourceRoot":"","sources":["../../../src/object/centernet.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAQxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAU9D;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;;GAEG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,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"}

View File

@ -1,2 +1,3 @@
export declare function check(instance: any, force?: boolean): Promise<boolean>; export declare function check(instance: any, force?: boolean): Promise<boolean>;
export declare function fakeOps(kernelNames: Array<string>, config: any): void;
//# sourceMappingURL=backend.d.ts.map //# sourceMappingURL=backend.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../../src/tfjs/backend.ts"],"names":[],"mappings":"AAKA,wBAAsB,KAAK,CAAC,QAAQ,KAAA,EAAE,KAAK,UAAQ,oBA4FlD"} {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../../src/tfjs/backend.ts"],"names":[],"mappings":"AAKA,wBAAsB,KAAK,CAAC,QAAQ,KAAA,EAAE,KAAK,UAAQ,oBA4FlD;AAGD,wBAAgB,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,KAAA,QAazD"}