mirror of https://github.com/vladmandic/human
refactoring
parent
3a89251e51
commit
07696845df
|
@ -11,6 +11,7 @@
|
|||
|
||||
### **HEAD -> main** 2021/09/27 mandic00@live.com
|
||||
|
||||
- implement box caching for movenet
|
||||
- autodetect number of bodies and hands
|
||||
- upload new samples
|
||||
- new samples gallery and major code folder restructure
|
||||
|
|
|
@ -46,7 +46,7 @@ var __privateSet = (obj, member, value, setter) => {
|
|||
return value;
|
||||
};
|
||||
|
||||
// src/util.ts
|
||||
// src/util/util.ts
|
||||
function join(folder, file) {
|
||||
const separator = folder.endsWith("/") ? "" : "/";
|
||||
const skipJoin = file.startsWith(".") || file.startsWith("/") || file.startsWith("http:") || file.startsWith("https:") || file.startsWith("file:");
|
||||
|
@ -99,31 +99,6 @@ function mergeDeep(...objects) {
|
|||
return prev;
|
||||
}, {});
|
||||
}
|
||||
function scaleBox(keypoints3, boxScaleFact2, outputSize2) {
|
||||
const coords3 = [keypoints3.map((pt) => pt[0]), keypoints3.map((pt) => pt[1])];
|
||||
const maxmin = [Math.max(...coords3[0]), Math.min(...coords3[0]), Math.max(...coords3[1]), Math.min(...coords3[1])];
|
||||
const center = [(maxmin[0] + maxmin[1]) / 2, (maxmin[2] + maxmin[3]) / 2];
|
||||
const diff = Math.max(center[0] - maxmin[1], center[1] - maxmin[3], -center[0] + maxmin[0], -center[1] + maxmin[2]) * boxScaleFact2;
|
||||
const box5 = [
|
||||
Math.trunc(center[0] - diff),
|
||||
Math.trunc(center[1] - diff),
|
||||
Math.trunc(2 * diff),
|
||||
Math.trunc(2 * diff)
|
||||
];
|
||||
const boxRaw2 = [
|
||||
box5[0] / outputSize2[0],
|
||||
box5[1] / outputSize2[1],
|
||||
box5[2] / outputSize2[0],
|
||||
box5[3] / outputSize2[1]
|
||||
];
|
||||
const yxBox = [
|
||||
boxRaw2[1],
|
||||
boxRaw2[0],
|
||||
boxRaw2[3] + boxRaw2[1],
|
||||
boxRaw2[2] + boxRaw2[0]
|
||||
];
|
||||
return { box: box5, boxRaw: boxRaw2, yxBox };
|
||||
}
|
||||
|
||||
// src/config.ts
|
||||
var config = {
|
||||
|
@ -193,6 +168,9 @@ var config = {
|
|||
body: {
|
||||
enabled: true,
|
||||
modelPath: "movenet-lightning.json",
|
||||
detector: {
|
||||
modelPath: ""
|
||||
},
|
||||
maxDetected: -1,
|
||||
minConfidence: 0.2,
|
||||
skipFrames: 1
|
||||
|
@ -380,13 +358,13 @@ function rotatePoint(homogeneousCoordinate, rotationMatrix) {
|
|||
dot(homogeneousCoordinate, rotationMatrix[1])
|
||||
];
|
||||
}
|
||||
function generateAnchors(inputSize4) {
|
||||
const spec = { strides: [inputSize4 / 16, inputSize4 / 8], anchors: [2, 6] };
|
||||
function generateAnchors(inputSize5) {
|
||||
const spec = { strides: [inputSize5 / 16, inputSize5 / 8], anchors: [2, 6] };
|
||||
const anchors3 = [];
|
||||
for (let i = 0; i < spec.strides.length; i++) {
|
||||
const stride = spec.strides[i];
|
||||
const gridRows = Math.floor((inputSize4 + stride - 1) / stride);
|
||||
const gridCols = Math.floor((inputSize4 + stride - 1) / stride);
|
||||
const gridRows = Math.floor((inputSize5 + stride - 1) / stride);
|
||||
const gridCols = Math.floor((inputSize5 + stride - 1) / stride);
|
||||
const anchorsNum = spec.anchors[i];
|
||||
for (let gridY = 0; gridY < gridRows; gridY++) {
|
||||
const anchorY = stride * (gridY + 0.5);
|
||||
|
@ -403,31 +381,31 @@ function generateAnchors(inputSize4) {
|
|||
|
||||
// src/blazeface/blazeface.ts
|
||||
var keypointsCount = 6;
|
||||
function decodeBounds(boxOutputs, anchors3, inputSize4) {
|
||||
function decodeBounds(boxOutputs, anchors3, inputSize5) {
|
||||
const boxStarts = tfjs_esm_exports.slice(boxOutputs, [0, 1], [-1, 2]);
|
||||
const centers = tfjs_esm_exports.add(boxStarts, anchors3);
|
||||
const boxSizes = tfjs_esm_exports.slice(boxOutputs, [0, 3], [-1, 2]);
|
||||
const boxSizesNormalized = tfjs_esm_exports.div(boxSizes, inputSize4);
|
||||
const centersNormalized = tfjs_esm_exports.div(centers, inputSize4);
|
||||
const boxSizesNormalized = tfjs_esm_exports.div(boxSizes, inputSize5);
|
||||
const centersNormalized = tfjs_esm_exports.div(centers, inputSize5);
|
||||
const halfBoxSize = tfjs_esm_exports.div(boxSizesNormalized, 2);
|
||||
const starts = tfjs_esm_exports.sub(centersNormalized, halfBoxSize);
|
||||
const ends = tfjs_esm_exports.add(centersNormalized, halfBoxSize);
|
||||
const startNormalized = tfjs_esm_exports.mul(starts, inputSize4);
|
||||
const endNormalized = tfjs_esm_exports.mul(ends, inputSize4);
|
||||
const startNormalized = tfjs_esm_exports.mul(starts, inputSize5);
|
||||
const endNormalized = tfjs_esm_exports.mul(ends, inputSize5);
|
||||
const concatAxis = 1;
|
||||
return tfjs_esm_exports.concat2d([startNormalized, endNormalized], concatAxis);
|
||||
}
|
||||
var BlazeFaceModel = class {
|
||||
constructor(model11, config3) {
|
||||
constructor(model10, config3) {
|
||||
__publicField(this, "model");
|
||||
__publicField(this, "anchorsData");
|
||||
__publicField(this, "anchors");
|
||||
__publicField(this, "inputSize");
|
||||
__publicField(this, "config");
|
||||
this.model = model11;
|
||||
this.anchorsData = generateAnchors(model11.inputs[0].shape[1]);
|
||||
this.model = model10;
|
||||
this.anchorsData = generateAnchors(model10.inputs[0].shape[1]);
|
||||
this.anchors = tfjs_esm_exports.tensor2d(this.anchorsData);
|
||||
this.inputSize = model11.inputs[0].shape[2];
|
||||
this.inputSize = model10.inputs[0].shape[2];
|
||||
this.config = config3;
|
||||
}
|
||||
async getBoundingBoxes(inputImage, userConfig) {
|
||||
|
@ -479,12 +457,12 @@ var BlazeFaceModel = class {
|
|||
};
|
||||
async function load(config3) {
|
||||
var _a, _b, _c;
|
||||
const model11 = await tfjs_esm_exports.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);
|
||||
if (!model11 || !model11.modelUrl)
|
||||
const model10 = await tfjs_esm_exports.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(model10, config3);
|
||||
if (!model10 || !model10.modelUrl)
|
||||
log("load model failed:", ((_c = config3.face.detector) == null ? void 0 : _c.modelPath) || "");
|
||||
else if (config3.debug)
|
||||
log("load model:", model11.modelUrl);
|
||||
log("load model:", model10.modelUrl);
|
||||
return blazeFace;
|
||||
}
|
||||
|
||||
|
@ -4671,7 +4649,7 @@ async function skip(config3, input) {
|
|||
return skipFrame;
|
||||
}
|
||||
|
||||
// src/env.ts
|
||||
// src/util/env.ts
|
||||
var env = {
|
||||
browser: void 0,
|
||||
node: void 0,
|
||||
|
@ -5132,7 +5110,7 @@ async function load2(config3) {
|
|||
var triangulation = TRI468;
|
||||
var uvmap = UV468;
|
||||
|
||||
// src/faceres/faceres.ts
|
||||
// src/face/faceres.ts
|
||||
var model;
|
||||
var last = [];
|
||||
var lastCount = 0;
|
||||
|
@ -5235,7 +5213,7 @@ async function predict2(image24, config3, idx, count2) {
|
|||
});
|
||||
}
|
||||
|
||||
// src/emotion/emotion.ts
|
||||
// src/gear/emotion.ts
|
||||
var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"];
|
||||
var model2;
|
||||
var last2 = [];
|
||||
|
@ -8645,14 +8623,14 @@ var anchors = [
|
|||
|
||||
// src/handpose/handdetector.ts
|
||||
var HandDetector = class {
|
||||
constructor(model11) {
|
||||
constructor(model10) {
|
||||
__publicField(this, "model");
|
||||
__publicField(this, "anchors");
|
||||
__publicField(this, "anchorsTensor");
|
||||
__publicField(this, "inputSize");
|
||||
__publicField(this, "inputSizeTensor");
|
||||
__publicField(this, "doubleInputSizeTensor");
|
||||
this.model = model11;
|
||||
this.model = model10;
|
||||
this.anchors = anchors.map((anchor) => [anchor.x, anchor.y]);
|
||||
this.anchorsTensor = tfjs_esm_exports.tensor2d(this.anchors);
|
||||
this.inputSize = this.model && this.model.inputs && this.model.inputs[0].shape ? this.model.inputs[0].shape[2] : 0;
|
||||
|
@ -9408,6 +9386,33 @@ async function load6(config3) {
|
|||
return [handDetectorModel, handPoseModel];
|
||||
}
|
||||
|
||||
// src/util/box.ts
|
||||
function scale(keypoints3, boxScaleFact2, outputSize3) {
|
||||
const coords3 = [keypoints3.map((pt) => pt[0]), keypoints3.map((pt) => pt[1])];
|
||||
const maxmin = [Math.max(...coords3[0]), Math.min(...coords3[0]), Math.max(...coords3[1]), Math.min(...coords3[1])];
|
||||
const center = [(maxmin[0] + maxmin[1]) / 2, (maxmin[2] + maxmin[3]) / 2];
|
||||
const diff = Math.max(center[0] - maxmin[1], center[1] - maxmin[3], -center[0] + maxmin[0], -center[1] + maxmin[2]) * boxScaleFact2;
|
||||
const box5 = [
|
||||
Math.trunc(center[0] - diff),
|
||||
Math.trunc(center[1] - diff),
|
||||
Math.trunc(2 * diff),
|
||||
Math.trunc(2 * diff)
|
||||
];
|
||||
const boxRaw2 = [
|
||||
box5[0] / outputSize3[0],
|
||||
box5[1] / outputSize3[1],
|
||||
box5[2] / outputSize3[0],
|
||||
box5[3] / outputSize3[1]
|
||||
];
|
||||
const yxBox = [
|
||||
boxRaw2[1],
|
||||
boxRaw2[0],
|
||||
boxRaw2[3] + boxRaw2[1],
|
||||
boxRaw2[2] + boxRaw2[0]
|
||||
];
|
||||
return { box: box5, boxRaw: boxRaw2, yxBox };
|
||||
}
|
||||
|
||||
// src/tfjs/humangl.ts
|
||||
var config2 = {
|
||||
name: "humangl",
|
||||
|
@ -9610,7 +9615,7 @@ function fakeOps(kernelNames, config3) {
|
|||
env.kernels = tfjs_esm_exports.getKernelsForBackend(tfjs_esm_exports.getBackend()).map((kernel) => kernel.kernelName.toLowerCase());
|
||||
}
|
||||
|
||||
// src/handtrack/handtrack.ts
|
||||
// src/hand/handtrack.ts
|
||||
var boxScaleFact = 1.5;
|
||||
var models2 = [null, null];
|
||||
var modelOutputNodes = ["StatefulPartitionedCall/Postprocessor/Slice", "StatefulPartitionedCall/Postprocessor/ExpandDims_1"];
|
||||
|
@ -9748,7 +9753,7 @@ async function detectFingers(input, h, config3) {
|
|||
h.box[3] * coord[1] / inputSize[1][1] + h.box[1],
|
||||
(h.box[2] + h.box[3]) / 2 / inputSize[1][0] * coord[2]
|
||||
]);
|
||||
const updatedBox = scaleBox(hand3.keypoints, boxScaleFact, outputSize);
|
||||
const updatedBox = scale(hand3.keypoints, boxScaleFact, outputSize);
|
||||
h.box = updatedBox.box;
|
||||
h.boxRaw = updatedBox.boxRaw;
|
||||
h.yxBox = updatedBox.yxBox;
|
||||
|
@ -9785,7 +9790,7 @@ async function predict6(input, config3) {
|
|||
return hands;
|
||||
}
|
||||
|
||||
// src/blazepose/annotations.ts
|
||||
// src/body/annotations.ts
|
||||
var full = [
|
||||
"nose",
|
||||
"leftEyeInside",
|
||||
|
@ -9861,57 +9866,71 @@ var upper = [
|
|||
"right:30"
|
||||
];
|
||||
|
||||
// src/blazepose/blazepose.ts
|
||||
var model4;
|
||||
async function load7(config3) {
|
||||
// src/body/blazepose.ts
|
||||
var models3 = [null, null];
|
||||
var outputNodes = ["ld_3d", "activation_segmentation", "activation_heatmap", "world_3d", "output_poseflag"];
|
||||
var inputSize2 = [[0, 0], [0, 0]];
|
||||
var outputSize2 = [0, 0];
|
||||
async function loadDetect2(config3) {
|
||||
var _a;
|
||||
if (env.initial)
|
||||
model4 = null;
|
||||
if (!model4) {
|
||||
model4 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
model4["width"] = parseInt(model4["signature"].inputs["input_1:0"].tensorShape.dim[2].size);
|
||||
model4["height"] = parseInt(model4["signature"].inputs["input_1:0"].tensorShape.dim[1].size);
|
||||
if (!model4 || !model4["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
models3[0] = null;
|
||||
if (!models3[0]) {
|
||||
models3[0] = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, ((_a = config3.body.detector) == null ? void 0 : _a.modelPath) || ""));
|
||||
const inputs = Object.values(models3[0].modelSignature["inputs"]);
|
||||
inputSize2[0][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
|
||||
inputSize2[0][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!models3[0] || !models3[0]["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model4["modelUrl"]);
|
||||
log("load model:", models3[0]["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model4["modelUrl"]);
|
||||
return model4;
|
||||
log("cached model:", models3[0]["modelUrl"]);
|
||||
return models3[0];
|
||||
}
|
||||
async function predict7(image24, config3) {
|
||||
if (!model4)
|
||||
return [];
|
||||
if (!config3.body.enabled)
|
||||
return [];
|
||||
const imgSize = { width: image24.shape[2] || 0, height: image24.shape[1] || 0 };
|
||||
const resize = tfjs_esm_exports.image.resizeBilinear(image24, [model4["width"], model4["height"]], false);
|
||||
const normalize = tfjs_esm_exports.div(resize, [255]);
|
||||
tfjs_esm_exports.dispose(resize);
|
||||
const resT = await model4.predict(normalize);
|
||||
const findT = resT.find((t) => t.size === 195 || t.size === 155);
|
||||
const points = await (findT == null ? void 0 : findT.data()) || [];
|
||||
resT.forEach((t) => tfjs_esm_exports.dispose(t));
|
||||
tfjs_esm_exports.dispose(normalize);
|
||||
async function loadPose(config3) {
|
||||
if (env.initial)
|
||||
models3[1] = null;
|
||||
if (!models3[1]) {
|
||||
models3[1] = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
const inputs = Object.values(models3[1].modelSignature["inputs"]);
|
||||
inputSize2[1][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
|
||||
inputSize2[1][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!models3[1] || !models3[1]["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", models3[1]["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", models3[1]["modelUrl"]);
|
||||
return models3[1];
|
||||
}
|
||||
async function detectParts(input, config3) {
|
||||
var _a;
|
||||
const t = {};
|
||||
t.resize = tfjs_esm_exports.image.resizeBilinear(input, [inputSize2[1][0], inputSize2[1][1]]);
|
||||
[t.ld, t.segmentation, t.heatmap, t.world, t.poseflag] = await ((_a = models3[1]) == null ? void 0 : _a.execute(t.resize, outputNodes));
|
||||
const points = await t.ld.data();
|
||||
const keypoints3 = [];
|
||||
const labels2 = (points == null ? void 0 : points.length) === 195 ? full : upper;
|
||||
const depth = 5;
|
||||
for (let i = 0; i < points.length / depth; i++) {
|
||||
keypoints3.push({
|
||||
id: i,
|
||||
part: labels2[i],
|
||||
position: [
|
||||
Math.trunc(imgSize.width * points[depth * i + 0] / 255),
|
||||
Math.trunc(imgSize.height * points[depth * i + 1] / 255),
|
||||
Math.trunc(points[depth * i + 2]) + 0
|
||||
],
|
||||
positionRaw: [
|
||||
points[depth * i + 0] / 255,
|
||||
points[depth * i + 1] / 255,
|
||||
points[depth * i + 2] + 0
|
||||
],
|
||||
score: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100,
|
||||
presence: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 4])))) / 100
|
||||
});
|
||||
const score3 = (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100;
|
||||
if (score3 > (config3.body.minConfidence || 0)) {
|
||||
keypoints3.push({
|
||||
part: labels2[i],
|
||||
position: [
|
||||
Math.trunc(outputSize2[0] * points[depth * i + 0] / 255),
|
||||
Math.trunc(outputSize2[1] * points[depth * i + 1] / 255),
|
||||
Math.trunc(points[depth * i + 2]) + 0
|
||||
],
|
||||
positionRaw: [
|
||||
points[depth * i + 0] / 255,
|
||||
points[depth * i + 1] / 255,
|
||||
points[depth * i + 2] + 0
|
||||
],
|
||||
score: score3
|
||||
});
|
||||
}
|
||||
}
|
||||
const x = keypoints3.map((a) => a.position[0]);
|
||||
const y = keypoints3.map((a) => a.position[1]);
|
||||
|
@ -9923,29 +9942,37 @@ async function predict7(image24, config3) {
|
|||
];
|
||||
const boxRaw2 = [0, 0, 0, 0];
|
||||
const score2 = keypoints3.reduce((prev, curr) => curr.score > prev ? curr.score : prev, 0);
|
||||
return [{ id: 0, score: score2, box: box5, boxRaw: boxRaw2, keypoints: keypoints3 }];
|
||||
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
|
||||
return { id: 0, score: score2, box: box5, boxRaw: boxRaw2, keypoints: keypoints3 };
|
||||
}
|
||||
async function predict7(input, config3) {
|
||||
outputSize2 = [input.shape[2] || 0, input.shape[1] || 0];
|
||||
const bodies = [];
|
||||
const body4 = await detectParts(input, config3);
|
||||
bodies.push(body4);
|
||||
return bodies;
|
||||
}
|
||||
|
||||
// src/efficientpose/efficientpose.ts
|
||||
var model5;
|
||||
// src/body/efficientpose.ts
|
||||
var model4;
|
||||
var keypoints = [];
|
||||
var box4 = [0, 0, 0, 0];
|
||||
var boxRaw = [0, 0, 0, 0];
|
||||
var score = 0;
|
||||
var skipped4 = Number.MAX_SAFE_INTEGER;
|
||||
var bodyParts = ["head", "neck", "rightShoulder", "rightElbow", "rightWrist", "chest", "leftShoulder", "leftElbow", "leftWrist", "pelvis", "rightHip", "rightKnee", "rightAnkle", "leftHip", "leftKnee", "leftAnkle"];
|
||||
async function load8(config3) {
|
||||
async function load7(config3) {
|
||||
if (env.initial)
|
||||
model5 = null;
|
||||
if (!model5) {
|
||||
model5 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model5 || !model5["modelUrl"])
|
||||
model4 = null;
|
||||
if (!model4) {
|
||||
model4 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model4 || !model4["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model5["modelUrl"]);
|
||||
log("load model:", model4["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model5["modelUrl"]);
|
||||
return model5;
|
||||
log("cached model:", model4["modelUrl"]);
|
||||
return model4;
|
||||
}
|
||||
function max2d(inputs, minScore) {
|
||||
const [width, height] = inputs.shape;
|
||||
|
@ -9972,16 +9999,16 @@ async function predict8(image24, config3) {
|
|||
return new Promise(async (resolve) => {
|
||||
var _a2;
|
||||
const tensor3 = tfjs_esm_exports.tidy(() => {
|
||||
if (!(model5 == null ? void 0 : model5.inputs[0].shape))
|
||||
if (!(model4 == null ? void 0 : model4.inputs[0].shape))
|
||||
return null;
|
||||
const resize = tfjs_esm_exports.image.resizeBilinear(image24, [model5.inputs[0].shape[2], model5.inputs[0].shape[1]], false);
|
||||
const resize = tfjs_esm_exports.image.resizeBilinear(image24, [model4.inputs[0].shape[2], model4.inputs[0].shape[1]], false);
|
||||
const enhance2 = tfjs_esm_exports.mul(resize, 2);
|
||||
const norm = enhance2.sub(1);
|
||||
return norm;
|
||||
});
|
||||
let resT;
|
||||
if (config3.body.enabled)
|
||||
resT = await (model5 == null ? void 0 : model5.predict(tensor3));
|
||||
resT = await (model4 == null ? void 0 : model4.predict(tensor3));
|
||||
tfjs_esm_exports.dispose(tensor3);
|
||||
if (resT) {
|
||||
keypoints.length = 0;
|
||||
|
@ -9996,12 +10023,12 @@ async function predict8(image24, config3) {
|
|||
score: Math.round(100 * partScore) / 100,
|
||||
part: bodyParts[id],
|
||||
positionRaw: [
|
||||
x2 / model5.inputs[0].shape[2],
|
||||
y2 / model5.inputs[0].shape[1]
|
||||
x2 / model4.inputs[0].shape[2],
|
||||
y2 / model4.inputs[0].shape[1]
|
||||
],
|
||||
position: [
|
||||
Math.round(image24.shape[2] * x2 / model5.inputs[0].shape[2]),
|
||||
Math.round(image24.shape[1] * y2 / model5.inputs[0].shape[1])
|
||||
Math.round(image24.shape[2] * x2 / model4.inputs[0].shape[2]),
|
||||
Math.round(image24.shape[1] * y2 / model4.inputs[0].shape[1])
|
||||
]
|
||||
});
|
||||
}
|
||||
|
@ -10029,29 +10056,29 @@ async function predict8(image24, config3) {
|
|||
});
|
||||
}
|
||||
|
||||
// src/movenet/movenet.ts
|
||||
var model6;
|
||||
var inputSize2 = 0;
|
||||
// src/body/movenet.ts
|
||||
var model5;
|
||||
var inputSize3 = 0;
|
||||
var cachedBoxes = [];
|
||||
var skipped5 = Number.MAX_SAFE_INTEGER;
|
||||
var keypoints2 = [];
|
||||
var bodyParts2 = ["nose", "leftEye", "rightEye", "leftEar", "rightEar", "leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee", "leftAnkle", "rightAnkle"];
|
||||
async function load9(config3) {
|
||||
async function load8(config3) {
|
||||
if (env.initial)
|
||||
model6 = null;
|
||||
if (!model6) {
|
||||
model5 = null;
|
||||
if (!model5) {
|
||||
fakeOps(["size"], config3);
|
||||
model6 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model6 || !model6["modelUrl"])
|
||||
model5 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model5 || !model5["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model6["modelUrl"]);
|
||||
log("load model:", model5["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model6["modelUrl"]);
|
||||
inputSize2 = model6.inputs[0].shape ? model6.inputs[0].shape[2] : 0;
|
||||
if (inputSize2 === -1)
|
||||
inputSize2 = 256;
|
||||
return model6;
|
||||
log("cached model:", model5["modelUrl"]);
|
||||
inputSize3 = model5.inputs[0].shape ? model5.inputs[0].shape[2] : 0;
|
||||
if (inputSize3 === -1)
|
||||
inputSize3 = 256;
|
||||
return model5;
|
||||
}
|
||||
async function parseSinglePose(res, config3, image24, inputBox) {
|
||||
const kpt3 = res[0][0];
|
||||
|
@ -10136,7 +10163,7 @@ async function parseMultiPose(res, config3, image24, inputBox) {
|
|||
return bodies;
|
||||
}
|
||||
async function predict9(input, config3) {
|
||||
if (!model6 || !(model6 == null ? void 0 : model6.inputs[0].shape))
|
||||
if (!model5 || !(model5 == null ? void 0 : model5.inputs[0].shape))
|
||||
return [];
|
||||
return new Promise(async (resolve) => {
|
||||
const t = {};
|
||||
|
@ -10145,18 +10172,18 @@ async function predict9(input, config3) {
|
|||
cachedBoxes.length = 0;
|
||||
skipped5++;
|
||||
for (let i = 0; i < cachedBoxes.length; i++) {
|
||||
t.crop = tfjs_esm_exports.image.cropAndResize(input, [cachedBoxes[i]], [0], [inputSize2, inputSize2], "bilinear");
|
||||
t.crop = tfjs_esm_exports.image.cropAndResize(input, [cachedBoxes[i]], [0], [inputSize3, inputSize3], "bilinear");
|
||||
t.cast = tfjs_esm_exports.cast(t.crop, "int32");
|
||||
t.res = await (model6 == null ? void 0 : model6.predict(t.cast));
|
||||
t.res = await (model5 == null ? void 0 : model5.predict(t.cast));
|
||||
const res = await t.res.array();
|
||||
const newBodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, cachedBoxes[i]) : await parseMultiPose(res, config3, input, cachedBoxes[i]);
|
||||
bodies = bodies.concat(newBodies);
|
||||
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
|
||||
}
|
||||
if (bodies.length !== config3.body.maxDetected && skipped5 > (config3.body.skipFrames || 0)) {
|
||||
t.resized = tfjs_esm_exports.image.resizeBilinear(input, [inputSize2, inputSize2], false);
|
||||
t.resized = tfjs_esm_exports.image.resizeBilinear(input, [inputSize3, inputSize3], false);
|
||||
t.cast = tfjs_esm_exports.cast(t.resized, "int32");
|
||||
t.res = await (model6 == null ? void 0 : model6.predict(t.cast));
|
||||
t.res = await (model5 == null ? void 0 : model5.predict(t.cast));
|
||||
const res = await t.res.array();
|
||||
bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]);
|
||||
Object.keys(t).forEach((tensor3) => tfjs_esm_exports.dispose(t[tensor3]));
|
||||
|
@ -10168,7 +10195,7 @@ async function predict9(input, config3) {
|
|||
for (let i = 0; i < bodies.length; i++) {
|
||||
if (bodies[i].keypoints.length > 10) {
|
||||
const kpts = bodies[i].keypoints.map((kpt3) => kpt3.position);
|
||||
const newBox = scaleBox(kpts, 1.5, [input.shape[2], input.shape[1]]);
|
||||
const newBox = scale(kpts, 1.5, [input.shape[2], input.shape[1]]);
|
||||
cachedBoxes.push([...newBox.yxBox]);
|
||||
}
|
||||
}
|
||||
|
@ -10262,26 +10289,26 @@ var labels = [
|
|||
];
|
||||
|
||||
// src/object/nanodet.ts
|
||||
var model7;
|
||||
var model6;
|
||||
var last3 = [];
|
||||
var skipped6 = Number.MAX_SAFE_INTEGER;
|
||||
var scaleBox2 = 2.5;
|
||||
async function load10(config3) {
|
||||
if (!model7 || env.initial) {
|
||||
model7 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model7.modelSignature["inputs"]);
|
||||
model7.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;
|
||||
if (!model7.inputSize)
|
||||
var scaleBox = 2.5;
|
||||
async function load9(config3) {
|
||||
if (!model6 || env.initial) {
|
||||
model6 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model6.modelSignature["inputs"]);
|
||||
model6.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;
|
||||
if (!model6.inputSize)
|
||||
throw new Error(`cannot determine model inputSize: ${config3.object.modelPath}`);
|
||||
if (!model7 || !model7.modelUrl)
|
||||
if (!model6 || !model6.modelUrl)
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model7.modelUrl);
|
||||
log("load model:", model6.modelUrl);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model7.modelUrl);
|
||||
return model7;
|
||||
log("cached model:", model6.modelUrl);
|
||||
return model6;
|
||||
}
|
||||
async function process3(res, inputSize4, outputShape, config3) {
|
||||
async function process3(res, inputSize5, outputShape, config3) {
|
||||
let id = 0;
|
||||
let results = [];
|
||||
for (const strideSize of [1, 2, 4]) {
|
||||
|
@ -10299,14 +10326,14 @@ async function process3(res, inputSize4, outputShape, config3) {
|
|||
if (score2 > config3.object.minConfidence && j !== 61) {
|
||||
const cx = (0.5 + Math.trunc(i % baseSize)) / baseSize;
|
||||
const cy = (0.5 + Math.trunc(i / baseSize)) / baseSize;
|
||||
const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize4));
|
||||
const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize5));
|
||||
const [x, y] = [
|
||||
cx - scaleBox2 / strideSize * boxOffset[0],
|
||||
cy - scaleBox2 / strideSize * boxOffset[1]
|
||||
cx - scaleBox / strideSize * boxOffset[0],
|
||||
cy - scaleBox / strideSize * boxOffset[1]
|
||||
];
|
||||
const [w, h] = [
|
||||
cx + scaleBox2 / strideSize * boxOffset[2] - x,
|
||||
cy + scaleBox2 / strideSize * boxOffset[3] - y
|
||||
cx + scaleBox / strideSize * boxOffset[2] - x,
|
||||
cy + scaleBox / strideSize * boxOffset[3] - y
|
||||
];
|
||||
let boxRaw2 = [x, y, w, h];
|
||||
boxRaw2 = boxRaw2.map((a) => Math.max(0, Math.min(a, 1)));
|
||||
|
@ -10351,42 +10378,42 @@ async function predict10(image24, config3) {
|
|||
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
|
||||
return last3;
|
||||
return new Promise(async (resolve) => {
|
||||
const outputSize2 = [image24.shape[2], image24.shape[1]];
|
||||
const resize = tfjs_esm_exports.image.resizeBilinear(image24, [model7.inputSize, model7.inputSize], false);
|
||||
const outputSize3 = [image24.shape[2], image24.shape[1]];
|
||||
const resize = tfjs_esm_exports.image.resizeBilinear(image24, [model6.inputSize, model6.inputSize], false);
|
||||
const norm = tfjs_esm_exports.div(resize, 255);
|
||||
const transpose = norm.transpose([0, 3, 1, 2]);
|
||||
tfjs_esm_exports.dispose(norm);
|
||||
tfjs_esm_exports.dispose(resize);
|
||||
let objectT;
|
||||
if (config3.object.enabled)
|
||||
objectT = await model7.predict(transpose);
|
||||
objectT = await model6.predict(transpose);
|
||||
tfjs_esm_exports.dispose(transpose);
|
||||
const obj = await process3(objectT, model7.inputSize, outputSize2, config3);
|
||||
const obj = await process3(objectT, model6.inputSize, outputSize3, config3);
|
||||
last3 = obj;
|
||||
resolve(obj);
|
||||
});
|
||||
}
|
||||
|
||||
// src/object/centernet.ts
|
||||
var model8;
|
||||
var inputSize3 = 0;
|
||||
var model7;
|
||||
var inputSize4 = 0;
|
||||
var last4 = [];
|
||||
var skipped7 = Number.MAX_SAFE_INTEGER;
|
||||
async function load11(config3) {
|
||||
async function load10(config3) {
|
||||
if (env.initial)
|
||||
model8 = null;
|
||||
if (!model8) {
|
||||
model7 = null;
|
||||
if (!model7) {
|
||||
fakeOps(["floormod"], config3);
|
||||
model8 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model8.modelSignature["inputs"]);
|
||||
inputSize3 = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!model8 || !model8["modelUrl"])
|
||||
model7 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model7.modelSignature["inputs"]);
|
||||
inputSize4 = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!model7 || !model7["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model8["modelUrl"]);
|
||||
log("load model:", model7["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model8["modelUrl"]);
|
||||
return model8;
|
||||
log("cached model:", model7["modelUrl"]);
|
||||
return model7;
|
||||
}
|
||||
async function process4(res, outputShape, config3) {
|
||||
if (!res)
|
||||
|
@ -10415,14 +10442,14 @@ async function process4(res, outputShape, config3) {
|
|||
const classVal = detections[0][id][5];
|
||||
const label = labels[classVal].label;
|
||||
const [x, y] = [
|
||||
detections[0][id][0] / inputSize3,
|
||||
detections[0][id][1] / inputSize3
|
||||
detections[0][id][0] / inputSize4,
|
||||
detections[0][id][1] / inputSize4
|
||||
];
|
||||
const boxRaw2 = [
|
||||
x,
|
||||
y,
|
||||
detections[0][id][2] / inputSize3 - x,
|
||||
detections[0][id][3] / inputSize3 - y
|
||||
detections[0][id][2] / inputSize4 - x,
|
||||
detections[0][id][3] / inputSize4 - y
|
||||
];
|
||||
const box5 = [
|
||||
Math.trunc(boxRaw2[0] * outputShape[0]),
|
||||
|
@ -10443,47 +10470,47 @@ async function predict11(input, config3) {
|
|||
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
|
||||
return last4;
|
||||
return new Promise(async (resolve) => {
|
||||
const outputSize2 = [input.shape[2], input.shape[1]];
|
||||
const resize = tfjs_esm_exports.image.resizeBilinear(input, [inputSize3, inputSize3]);
|
||||
const objectT = config3.object.enabled ? model8 == null ? void 0 : model8.execute(resize, ["tower_0/detections"]) : null;
|
||||
const outputSize3 = [input.shape[2], input.shape[1]];
|
||||
const resize = tfjs_esm_exports.image.resizeBilinear(input, [inputSize4, inputSize4]);
|
||||
const objectT = config3.object.enabled ? model7 == null ? void 0 : model7.execute(resize, ["tower_0/detections"]) : null;
|
||||
tfjs_esm_exports.dispose(resize);
|
||||
const obj = await process4(objectT, outputSize2, config3);
|
||||
const obj = await process4(objectT, outputSize3, config3);
|
||||
last4 = obj;
|
||||
resolve(obj);
|
||||
});
|
||||
}
|
||||
|
||||
// src/segmentation/segmentation.ts
|
||||
var model9;
|
||||
var model8;
|
||||
var busy = false;
|
||||
async function load12(config3) {
|
||||
if (!model9 || env.initial) {
|
||||
model9 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.segmentation.modelPath || ""));
|
||||
if (!model9 || !model9["modelUrl"])
|
||||
async function load11(config3) {
|
||||
if (!model8 || env.initial) {
|
||||
model8 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.segmentation.modelPath || ""));
|
||||
if (!model8 || !model8["modelUrl"])
|
||||
log("load model failed:", config3.segmentation.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model9["modelUrl"]);
|
||||
log("load model:", model8["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model9["modelUrl"]);
|
||||
return model9;
|
||||
log("cached model:", model8["modelUrl"]);
|
||||
return model8;
|
||||
}
|
||||
async function process5(input, background, config3) {
|
||||
var _a, _b;
|
||||
if (busy)
|
||||
return { data: [], canvas: null, alpha: null };
|
||||
busy = true;
|
||||
if (!model9)
|
||||
await load12(config3);
|
||||
if (!model8)
|
||||
await load11(config3);
|
||||
const inputImage = process2(input, config3);
|
||||
const width = ((_a = inputImage.canvas) == null ? void 0 : _a.width) || 0;
|
||||
const height = ((_b = inputImage.canvas) == null ? void 0 : _b.height) || 0;
|
||||
if (!inputImage.tensor)
|
||||
return { data: [], canvas: null, alpha: null };
|
||||
const t = {};
|
||||
t.resize = tfjs_esm_exports.image.resizeBilinear(inputImage.tensor, [model9.inputs[0].shape ? model9.inputs[0].shape[1] : 0, model9.inputs[0].shape ? model9.inputs[0].shape[2] : 0], false);
|
||||
t.resize = tfjs_esm_exports.image.resizeBilinear(inputImage.tensor, [model8.inputs[0].shape ? model8.inputs[0].shape[1] : 0, model8.inputs[0].shape ? model8.inputs[0].shape[2] : 0], false);
|
||||
tfjs_esm_exports.dispose(inputImage.tensor);
|
||||
t.norm = tfjs_esm_exports.div(t.resize, 255);
|
||||
t.res = model9.predict(t.norm);
|
||||
t.res = model8.predict(t.norm);
|
||||
t.squeeze = tfjs_esm_exports.squeeze(t.res, 0);
|
||||
if (t.squeeze.shape[2] === 2) {
|
||||
t.softmax = tfjs_esm_exports.softmax(t.squeeze);
|
||||
|
@ -10536,21 +10563,21 @@ async function process5(input, background, config3) {
|
|||
return { data, canvas: mergedCanvas || compositeCanvas, alpha: alphaCanvas };
|
||||
}
|
||||
|
||||
// src/gear/agegenderrace.ts
|
||||
var model10;
|
||||
// src/gear/gear-agegenderrace.ts
|
||||
var model9;
|
||||
var skipped8 = Number.MAX_SAFE_INTEGER;
|
||||
async function load13(config3) {
|
||||
async function load12(config3) {
|
||||
if (env.initial)
|
||||
model10 = null;
|
||||
if (!model10) {
|
||||
model10 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.face.agegenderrace.modelPath));
|
||||
if (!model10 || !model10["modelUrl"])
|
||||
model9 = null;
|
||||
if (!model9) {
|
||||
model9 = await tfjs_esm_exports.loadGraphModel(join(config3.modelBasePath, config3.face.agegenderrace.modelPath));
|
||||
if (!model9 || !model9["modelUrl"])
|
||||
log("load model failed:", config3.face.agegenderrace.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model10["modelUrl"]);
|
||||
log("load model:", model9["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model10["modelUrl"]);
|
||||
return model10;
|
||||
log("cached model:", model9["modelUrl"]);
|
||||
return model9;
|
||||
}
|
||||
|
||||
// src/models.ts
|
||||
|
@ -10558,6 +10585,7 @@ var Models = class {
|
|||
constructor() {
|
||||
__publicField(this, "age", null);
|
||||
__publicField(this, "agegenderrace", null);
|
||||
__publicField(this, "blazeposedetect", null);
|
||||
__publicField(this, "blazepose", null);
|
||||
__publicField(this, "centernet", null);
|
||||
__publicField(this, "efficientpose", null);
|
||||
|
@ -10578,11 +10606,11 @@ var Models = class {
|
|||
}
|
||||
};
|
||||
function reset(instance) {
|
||||
for (const model11 of Object.keys(instance.models))
|
||||
instance.models[model11] = null;
|
||||
for (const model10 of Object.keys(instance.models))
|
||||
instance.models[model10] = null;
|
||||
}
|
||||
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;
|
||||
async function load13(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, _B, _C, _D;
|
||||
if (env.initial)
|
||||
reset(instance);
|
||||
if (instance.config.face.enabled) {
|
||||
|
@ -10606,48 +10634,50 @@ async function load14(instance) {
|
|||
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 = load5(instance.config);
|
||||
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 = load8(instance.config);
|
||||
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.blazepose = load7(instance.config);
|
||||
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.efficientpose = load7(instance.config);
|
||||
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);
|
||||
if (instance.config.object.enabled && !instance.models.nanodet && ((_v = (_u = instance.config.object) == null ? void 0 : _u.modelPath) == null ? void 0 : _v.includes("nanodet")))
|
||||
instance.models.nanodet = load10(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")))
|
||||
instance.models.centernet = load11(instance.config);
|
||||
if (instance.config.face.enabled && ((_y = instance.config.face.emotion) == null ? void 0 : _y.enabled) && !instance.models.emotion)
|
||||
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.blazepose = loadPose(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.blazeposedetect && ((_q = instance.config.body.detector) == null ? void 0 : _q.modelPath) && ((_s = (_r = instance.config.body) == null ? void 0 : _r.modelPath) == null ? void 0 : _s.includes("blazepose")))
|
||||
instance.models.blazeposedetect = loadDetect2(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.efficientpose && ((_u = (_t = instance.config.body) == null ? void 0 : _t.modelPath) == null ? void 0 : _u.includes("efficientpose")))
|
||||
instance.models.efficientpose = load7(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.movenet && ((_w = (_v = instance.config.body) == null ? void 0 : _v.modelPath) == null ? void 0 : _w.includes("movenet")))
|
||||
instance.models.movenet = load8(instance.config);
|
||||
if (instance.config.object.enabled && !instance.models.nanodet && ((_y = (_x = instance.config.object) == null ? void 0 : _x.modelPath) == null ? void 0 : _y.includes("nanodet")))
|
||||
instance.models.nanodet = load9(instance.config);
|
||||
if (instance.config.object.enabled && !instance.models.centernet && ((_A = (_z = instance.config.object) == null ? void 0 : _z.modelPath) == null ? void 0 : _A.includes("centernet")))
|
||||
instance.models.centernet = load10(instance.config);
|
||||
if (instance.config.face.enabled && ((_B = instance.config.face.emotion) == null ? void 0 : _B.enabled) && !instance.models.emotion)
|
||||
instance.models.emotion = load4(instance.config);
|
||||
if (instance.config.face.enabled && ((_z = instance.config.face.description) == null ? void 0 : _z.enabled) && !instance.models.faceres)
|
||||
if (instance.config.face.enabled && ((_C = instance.config.face.description) == null ? void 0 : _C.enabled) && !instance.models.faceres)
|
||||
instance.models.faceres = load3(instance.config);
|
||||
if (instance.config.segmentation.enabled && !instance.models.segmentation)
|
||||
instance.models.segmentation = load12(instance.config);
|
||||
if (instance.config.face.enabled && ((_A = instance.config.face["agegenderrace"]) == null ? void 0 : _A.enabled) && !instance.models.agegenderrace)
|
||||
instance.models.agegenderrace = load13(instance.config);
|
||||
for await (const model11 of Object.keys(instance.models)) {
|
||||
if (instance.models[model11] && typeof instance.models[model11] !== "undefined")
|
||||
instance.models[model11] = await instance.models[model11];
|
||||
instance.models.segmentation = load11(instance.config);
|
||||
if (instance.config.face.enabled && ((_D = instance.config.face["agegenderrace"]) == null ? void 0 : _D.enabled) && !instance.models.agegenderrace)
|
||||
instance.models.agegenderrace = load12(instance.config);
|
||||
for await (const model10 of Object.keys(instance.models)) {
|
||||
if (instance.models[model10] && typeof instance.models[model10] !== "undefined")
|
||||
instance.models[model10] = await instance.models[model10];
|
||||
}
|
||||
}
|
||||
async function validate2(instance) {
|
||||
const simpleOps = ["const", "placeholder", "noop", "pad", "squeeze", "add", "sub", "mul", "div"];
|
||||
for (const defined of Object.keys(instance.models)) {
|
||||
if (instance.models[defined]) {
|
||||
let models4 = [];
|
||||
let models5 = [];
|
||||
if (Array.isArray(instance.models[defined])) {
|
||||
models4 = instance.models[defined].filter((model11) => model11 !== null).map((model11) => model11 && model11.executor ? model11 : model11.model);
|
||||
models5 = instance.models[defined].filter((model10) => model10 !== null).map((model10) => model10 && model10.executor ? model10 : model10.model);
|
||||
} else {
|
||||
models4 = [instance.models[defined]];
|
||||
models5 = [instance.models[defined]];
|
||||
}
|
||||
for (const model11 of models4) {
|
||||
if (!model11) {
|
||||
for (const model10 of models5) {
|
||||
if (!model10) {
|
||||
if (instance.config.debug)
|
||||
log("model marked as loaded but not defined:", defined);
|
||||
continue;
|
||||
}
|
||||
const ops = [];
|
||||
const executor = model11 == null ? void 0 : model11.executor;
|
||||
const executor = model10 == null ? void 0 : model10.executor;
|
||||
if (executor && executor.graph.nodes) {
|
||||
for (const kernel of Object.values(executor.graph.nodes)) {
|
||||
const op = kernel.op.toLowerCase();
|
||||
|
@ -10671,7 +10701,7 @@ async function validate2(instance) {
|
|||
}
|
||||
}
|
||||
|
||||
// src/face.ts
|
||||
// src/face/face.ts
|
||||
var calculateGaze = (face5) => {
|
||||
const radians = (pt1, pt2) => Math.atan2(pt1[1] - pt2[1], pt1[0] - pt2[0]);
|
||||
if (!face5.annotations["rightEyeIris"] || !face5.annotations["leftEyeIris"])
|
||||
|
@ -10978,7 +11008,7 @@ var hand = (res) => {
|
|||
return gestures;
|
||||
};
|
||||
|
||||
// src/draw.ts
|
||||
// src/util/draw.ts
|
||||
var options2 = {
|
||||
color: "rgba(173, 216, 230, 0.6)",
|
||||
labelColor: "rgba(173, 216, 230, 1)",
|
||||
|
@ -11524,7 +11554,7 @@ function join2(faces, bodies, hands, gestures, shape) {
|
|||
return persons2;
|
||||
}
|
||||
|
||||
// src/interpolate.ts
|
||||
// src/util/interpolate.ts
|
||||
var bufferedResult = { face: [], body: [], hand: [], gesture: [], object: [], persons: [], performance: {}, timestamp: 0 };
|
||||
function calc(newResult) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
||||
|
@ -12570,7 +12600,7 @@ var Human = class {
|
|||
async load(userConfig) {
|
||||
this.state = "load";
|
||||
const timeStamp = now();
|
||||
const count2 = Object.values(this.models).filter((model11) => model11).length;
|
||||
const count2 = Object.values(this.models).filter((model10) => model10).length;
|
||||
if (userConfig)
|
||||
this.config = mergeDeep(this.config, userConfig);
|
||||
if (env.initial) {
|
||||
|
@ -12588,11 +12618,11 @@ var Human = class {
|
|||
log("tf flags:", this.tf.ENV.flags);
|
||||
}
|
||||
}
|
||||
await load14(this);
|
||||
await load13(this);
|
||||
if (env.initial && this.config.debug)
|
||||
log("tf engine state:", this.tf.engine().state.numBytes, "bytes", this.tf.engine().state.numTensors, "tensors");
|
||||
env.initial = false;
|
||||
const loaded = Object.values(this.models).filter((model11) => model11).length;
|
||||
const loaded = Object.values(this.models).filter((model10) => model10).length;
|
||||
if (loaded !== count2) {
|
||||
await validate2(this);
|
||||
this.emit("load");
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -89,7 +89,7 @@ __export(exports, {
|
|||
env: () => env
|
||||
});
|
||||
|
||||
// src/util.ts
|
||||
// src/util/util.ts
|
||||
function join(folder, file) {
|
||||
const separator = folder.endsWith("/") ? "" : "/";
|
||||
const skipJoin = file.startsWith(".") || file.startsWith("/") || file.startsWith("http:") || file.startsWith("https:") || file.startsWith("file:");
|
||||
|
@ -142,31 +142,6 @@ function mergeDeep(...objects) {
|
|||
return prev;
|
||||
}, {});
|
||||
}
|
||||
function scaleBox(keypoints3, boxScaleFact2, outputSize2) {
|
||||
const coords3 = [keypoints3.map((pt) => pt[0]), keypoints3.map((pt) => pt[1])];
|
||||
const maxmin = [Math.max(...coords3[0]), Math.min(...coords3[0]), Math.max(...coords3[1]), Math.min(...coords3[1])];
|
||||
const center = [(maxmin[0] + maxmin[1]) / 2, (maxmin[2] + maxmin[3]) / 2];
|
||||
const diff = Math.max(center[0] - maxmin[1], center[1] - maxmin[3], -center[0] + maxmin[0], -center[1] + maxmin[2]) * boxScaleFact2;
|
||||
const box5 = [
|
||||
Math.trunc(center[0] - diff),
|
||||
Math.trunc(center[1] - diff),
|
||||
Math.trunc(2 * diff),
|
||||
Math.trunc(2 * diff)
|
||||
];
|
||||
const boxRaw2 = [
|
||||
box5[0] / outputSize2[0],
|
||||
box5[1] / outputSize2[1],
|
||||
box5[2] / outputSize2[0],
|
||||
box5[3] / outputSize2[1]
|
||||
];
|
||||
const yxBox = [
|
||||
boxRaw2[1],
|
||||
boxRaw2[0],
|
||||
boxRaw2[3] + boxRaw2[1],
|
||||
boxRaw2[2] + boxRaw2[0]
|
||||
];
|
||||
return { box: box5, boxRaw: boxRaw2, yxBox };
|
||||
}
|
||||
|
||||
// src/config.ts
|
||||
var config = {
|
||||
|
@ -236,6 +211,9 @@ var config = {
|
|||
body: {
|
||||
enabled: true,
|
||||
modelPath: "movenet-lightning.json",
|
||||
detector: {
|
||||
modelPath: ""
|
||||
},
|
||||
maxDetected: -1,
|
||||
minConfidence: 0.2,
|
||||
skipFrames: 1
|
||||
|
@ -403,13 +381,13 @@ function rotatePoint(homogeneousCoordinate, rotationMatrix) {
|
|||
dot(homogeneousCoordinate, rotationMatrix[1])
|
||||
];
|
||||
}
|
||||
function generateAnchors(inputSize4) {
|
||||
const spec = { strides: [inputSize4 / 16, inputSize4 / 8], anchors: [2, 6] };
|
||||
function generateAnchors(inputSize5) {
|
||||
const spec = { strides: [inputSize5 / 16, inputSize5 / 8], anchors: [2, 6] };
|
||||
const anchors3 = [];
|
||||
for (let i = 0; i < spec.strides.length; i++) {
|
||||
const stride = spec.strides[i];
|
||||
const gridRows = Math.floor((inputSize4 + stride - 1) / stride);
|
||||
const gridCols = Math.floor((inputSize4 + stride - 1) / stride);
|
||||
const gridRows = Math.floor((inputSize5 + stride - 1) / stride);
|
||||
const gridCols = Math.floor((inputSize5 + stride - 1) / stride);
|
||||
const anchorsNum = spec.anchors[i];
|
||||
for (let gridY = 0; gridY < gridRows; gridY++) {
|
||||
const anchorY = stride * (gridY + 0.5);
|
||||
|
@ -426,31 +404,31 @@ function generateAnchors(inputSize4) {
|
|||
|
||||
// src/blazeface/blazeface.ts
|
||||
var keypointsCount = 6;
|
||||
function decodeBounds(boxOutputs, anchors3, inputSize4) {
|
||||
function decodeBounds(boxOutputs, anchors3, inputSize5) {
|
||||
const boxStarts = tf2.slice(boxOutputs, [0, 1], [-1, 2]);
|
||||
const centers = tf2.add(boxStarts, anchors3);
|
||||
const boxSizes = tf2.slice(boxOutputs, [0, 3], [-1, 2]);
|
||||
const boxSizesNormalized = tf2.div(boxSizes, inputSize4);
|
||||
const centersNormalized = tf2.div(centers, inputSize4);
|
||||
const boxSizesNormalized = tf2.div(boxSizes, inputSize5);
|
||||
const centersNormalized = tf2.div(centers, inputSize5);
|
||||
const halfBoxSize = tf2.div(boxSizesNormalized, 2);
|
||||
const starts = tf2.sub(centersNormalized, halfBoxSize);
|
||||
const ends = tf2.add(centersNormalized, halfBoxSize);
|
||||
const startNormalized = tf2.mul(starts, inputSize4);
|
||||
const endNormalized = tf2.mul(ends, inputSize4);
|
||||
const startNormalized = tf2.mul(starts, inputSize5);
|
||||
const endNormalized = tf2.mul(ends, inputSize5);
|
||||
const concatAxis = 1;
|
||||
return tf2.concat2d([startNormalized, endNormalized], concatAxis);
|
||||
}
|
||||
var BlazeFaceModel = class {
|
||||
constructor(model11, config3) {
|
||||
constructor(model10, config3) {
|
||||
__publicField(this, "model");
|
||||
__publicField(this, "anchorsData");
|
||||
__publicField(this, "anchors");
|
||||
__publicField(this, "inputSize");
|
||||
__publicField(this, "config");
|
||||
this.model = model11;
|
||||
this.anchorsData = generateAnchors(model11.inputs[0].shape[1]);
|
||||
this.model = model10;
|
||||
this.anchorsData = generateAnchors(model10.inputs[0].shape[1]);
|
||||
this.anchors = tf2.tensor2d(this.anchorsData);
|
||||
this.inputSize = model11.inputs[0].shape[2];
|
||||
this.inputSize = model10.inputs[0].shape[2];
|
||||
this.config = config3;
|
||||
}
|
||||
async getBoundingBoxes(inputImage, userConfig) {
|
||||
|
@ -502,12 +480,12 @@ var BlazeFaceModel = class {
|
|||
};
|
||||
async function load(config3) {
|
||||
var _a, _b, _c;
|
||||
const model11 = await tf2.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);
|
||||
if (!model11 || !model11.modelUrl)
|
||||
const model10 = await tf2.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(model10, config3);
|
||||
if (!model10 || !model10.modelUrl)
|
||||
log("load model failed:", ((_c = config3.face.detector) == null ? void 0 : _c.modelPath) || "");
|
||||
else if (config3.debug)
|
||||
log("load model:", model11.modelUrl);
|
||||
log("load model:", model10.modelUrl);
|
||||
return blazeFace;
|
||||
}
|
||||
|
||||
|
@ -3783,7 +3761,7 @@ var UV68 = VTX68.map((x) => UV468[x]);
|
|||
var UV33 = VTX33.map((x) => UV468[x]);
|
||||
var UV7 = VTX7.map((x) => UV468[x]);
|
||||
|
||||
// src/env.ts
|
||||
// src/util/env.ts
|
||||
var tf4 = __toModule(require_tfjs_esm());
|
||||
|
||||
// src/image/image.ts
|
||||
|
@ -4703,7 +4681,7 @@ async function skip(config3, input) {
|
|||
return skipFrame;
|
||||
}
|
||||
|
||||
// src/env.ts
|
||||
// src/util/env.ts
|
||||
var env = {
|
||||
browser: void 0,
|
||||
node: void 0,
|
||||
|
@ -5164,7 +5142,7 @@ async function load2(config3) {
|
|||
var triangulation = TRI468;
|
||||
var uvmap = UV468;
|
||||
|
||||
// src/faceres/faceres.ts
|
||||
// src/face/faceres.ts
|
||||
var tf7 = __toModule(require_tfjs_esm());
|
||||
var model;
|
||||
var last = [];
|
||||
|
@ -5268,7 +5246,7 @@ async function predict2(image24, config3, idx, count2) {
|
|||
});
|
||||
}
|
||||
|
||||
// src/emotion/emotion.ts
|
||||
// src/gear/emotion.ts
|
||||
var tf8 = __toModule(require_tfjs_esm());
|
||||
var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"];
|
||||
var model2;
|
||||
|
@ -8689,14 +8667,14 @@ var anchors = [
|
|||
|
||||
// src/handpose/handdetector.ts
|
||||
var HandDetector = class {
|
||||
constructor(model11) {
|
||||
constructor(model10) {
|
||||
__publicField(this, "model");
|
||||
__publicField(this, "anchors");
|
||||
__publicField(this, "anchorsTensor");
|
||||
__publicField(this, "inputSize");
|
||||
__publicField(this, "inputSizeTensor");
|
||||
__publicField(this, "doubleInputSizeTensor");
|
||||
this.model = model11;
|
||||
this.model = model10;
|
||||
this.anchors = anchors.map((anchor) => [anchor.x, anchor.y]);
|
||||
this.anchorsTensor = tf11.tensor2d(this.anchors);
|
||||
this.inputSize = this.model && this.model.inputs && this.model.inputs[0].shape ? this.model.inputs[0].shape[2] : 0;
|
||||
|
@ -9455,7 +9433,34 @@ async function load6(config3) {
|
|||
return [handDetectorModel, handPoseModel];
|
||||
}
|
||||
|
||||
// src/handtrack/handtrack.ts
|
||||
// src/util/box.ts
|
||||
function scale(keypoints3, boxScaleFact2, outputSize3) {
|
||||
const coords3 = [keypoints3.map((pt) => pt[0]), keypoints3.map((pt) => pt[1])];
|
||||
const maxmin = [Math.max(...coords3[0]), Math.min(...coords3[0]), Math.max(...coords3[1]), Math.min(...coords3[1])];
|
||||
const center = [(maxmin[0] + maxmin[1]) / 2, (maxmin[2] + maxmin[3]) / 2];
|
||||
const diff = Math.max(center[0] - maxmin[1], center[1] - maxmin[3], -center[0] + maxmin[0], -center[1] + maxmin[2]) * boxScaleFact2;
|
||||
const box5 = [
|
||||
Math.trunc(center[0] - diff),
|
||||
Math.trunc(center[1] - diff),
|
||||
Math.trunc(2 * diff),
|
||||
Math.trunc(2 * diff)
|
||||
];
|
||||
const boxRaw2 = [
|
||||
box5[0] / outputSize3[0],
|
||||
box5[1] / outputSize3[1],
|
||||
box5[2] / outputSize3[0],
|
||||
box5[3] / outputSize3[1]
|
||||
];
|
||||
const yxBox = [
|
||||
boxRaw2[1],
|
||||
boxRaw2[0],
|
||||
boxRaw2[3] + boxRaw2[1],
|
||||
boxRaw2[2] + boxRaw2[0]
|
||||
];
|
||||
return { box: box5, boxRaw: boxRaw2, yxBox };
|
||||
}
|
||||
|
||||
// src/hand/handtrack.ts
|
||||
var tf16 = __toModule(require_tfjs_esm());
|
||||
|
||||
// src/tfjs/humangl.ts
|
||||
|
@ -9662,7 +9667,7 @@ function fakeOps(kernelNames, config3) {
|
|||
env.kernels = tf15.getKernelsForBackend(tf15.getBackend()).map((kernel) => kernel.kernelName.toLowerCase());
|
||||
}
|
||||
|
||||
// src/handtrack/handtrack.ts
|
||||
// src/hand/handtrack.ts
|
||||
var boxScaleFact = 1.5;
|
||||
var models2 = [null, null];
|
||||
var modelOutputNodes = ["StatefulPartitionedCall/Postprocessor/Slice", "StatefulPartitionedCall/Postprocessor/ExpandDims_1"];
|
||||
|
@ -9800,7 +9805,7 @@ async function detectFingers(input, h, config3) {
|
|||
h.box[3] * coord[1] / inputSize[1][1] + h.box[1],
|
||||
(h.box[2] + h.box[3]) / 2 / inputSize[1][0] * coord[2]
|
||||
]);
|
||||
const updatedBox = scaleBox(hand3.keypoints, boxScaleFact, outputSize);
|
||||
const updatedBox = scale(hand3.keypoints, boxScaleFact, outputSize);
|
||||
h.box = updatedBox.box;
|
||||
h.boxRaw = updatedBox.boxRaw;
|
||||
h.yxBox = updatedBox.yxBox;
|
||||
|
@ -9837,10 +9842,10 @@ async function predict6(input, config3) {
|
|||
return hands;
|
||||
}
|
||||
|
||||
// src/blazepose/blazepose.ts
|
||||
// src/body/blazepose.ts
|
||||
var tf17 = __toModule(require_tfjs_esm());
|
||||
|
||||
// src/blazepose/annotations.ts
|
||||
// src/body/annotations.ts
|
||||
var full = [
|
||||
"nose",
|
||||
"leftEyeInside",
|
||||
|
@ -9916,57 +9921,71 @@ var upper = [
|
|||
"right:30"
|
||||
];
|
||||
|
||||
// src/blazepose/blazepose.ts
|
||||
var model4;
|
||||
async function load7(config3) {
|
||||
// src/body/blazepose.ts
|
||||
var models3 = [null, null];
|
||||
var outputNodes = ["ld_3d", "activation_segmentation", "activation_heatmap", "world_3d", "output_poseflag"];
|
||||
var inputSize2 = [[0, 0], [0, 0]];
|
||||
var outputSize2 = [0, 0];
|
||||
async function loadDetect2(config3) {
|
||||
var _a;
|
||||
if (env.initial)
|
||||
model4 = null;
|
||||
if (!model4) {
|
||||
model4 = await tf17.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
model4["width"] = parseInt(model4["signature"].inputs["input_1:0"].tensorShape.dim[2].size);
|
||||
model4["height"] = parseInt(model4["signature"].inputs["input_1:0"].tensorShape.dim[1].size);
|
||||
if (!model4 || !model4["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
models3[0] = null;
|
||||
if (!models3[0]) {
|
||||
models3[0] = await tf17.loadGraphModel(join(config3.modelBasePath, ((_a = config3.body.detector) == null ? void 0 : _a.modelPath) || ""));
|
||||
const inputs = Object.values(models3[0].modelSignature["inputs"]);
|
||||
inputSize2[0][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
|
||||
inputSize2[0][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!models3[0] || !models3[0]["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model4["modelUrl"]);
|
||||
log("load model:", models3[0]["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model4["modelUrl"]);
|
||||
return model4;
|
||||
log("cached model:", models3[0]["modelUrl"]);
|
||||
return models3[0];
|
||||
}
|
||||
async function predict7(image24, config3) {
|
||||
if (!model4)
|
||||
return [];
|
||||
if (!config3.body.enabled)
|
||||
return [];
|
||||
const imgSize = { width: image24.shape[2] || 0, height: image24.shape[1] || 0 };
|
||||
const resize = tf17.image.resizeBilinear(image24, [model4["width"], model4["height"]], false);
|
||||
const normalize = tf17.div(resize, [255]);
|
||||
tf17.dispose(resize);
|
||||
const resT = await model4.predict(normalize);
|
||||
const findT = resT.find((t) => t.size === 195 || t.size === 155);
|
||||
const points = await (findT == null ? void 0 : findT.data()) || [];
|
||||
resT.forEach((t) => tf17.dispose(t));
|
||||
tf17.dispose(normalize);
|
||||
async function loadPose(config3) {
|
||||
if (env.initial)
|
||||
models3[1] = null;
|
||||
if (!models3[1]) {
|
||||
models3[1] = await tf17.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
const inputs = Object.values(models3[1].modelSignature["inputs"]);
|
||||
inputSize2[1][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
|
||||
inputSize2[1][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!models3[1] || !models3[1]["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", models3[1]["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", models3[1]["modelUrl"]);
|
||||
return models3[1];
|
||||
}
|
||||
async function detectParts(input, config3) {
|
||||
var _a;
|
||||
const t = {};
|
||||
t.resize = tf17.image.resizeBilinear(input, [inputSize2[1][0], inputSize2[1][1]]);
|
||||
[t.ld, t.segmentation, t.heatmap, t.world, t.poseflag] = await ((_a = models3[1]) == null ? void 0 : _a.execute(t.resize, outputNodes));
|
||||
const points = await t.ld.data();
|
||||
const keypoints3 = [];
|
||||
const labels2 = (points == null ? void 0 : points.length) === 195 ? full : upper;
|
||||
const depth = 5;
|
||||
for (let i = 0; i < points.length / depth; i++) {
|
||||
keypoints3.push({
|
||||
id: i,
|
||||
part: labels2[i],
|
||||
position: [
|
||||
Math.trunc(imgSize.width * points[depth * i + 0] / 255),
|
||||
Math.trunc(imgSize.height * points[depth * i + 1] / 255),
|
||||
Math.trunc(points[depth * i + 2]) + 0
|
||||
],
|
||||
positionRaw: [
|
||||
points[depth * i + 0] / 255,
|
||||
points[depth * i + 1] / 255,
|
||||
points[depth * i + 2] + 0
|
||||
],
|
||||
score: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100,
|
||||
presence: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 4])))) / 100
|
||||
});
|
||||
const score3 = (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100;
|
||||
if (score3 > (config3.body.minConfidence || 0)) {
|
||||
keypoints3.push({
|
||||
part: labels2[i],
|
||||
position: [
|
||||
Math.trunc(outputSize2[0] * points[depth * i + 0] / 255),
|
||||
Math.trunc(outputSize2[1] * points[depth * i + 1] / 255),
|
||||
Math.trunc(points[depth * i + 2]) + 0
|
||||
],
|
||||
positionRaw: [
|
||||
points[depth * i + 0] / 255,
|
||||
points[depth * i + 1] / 255,
|
||||
points[depth * i + 2] + 0
|
||||
],
|
||||
score: score3
|
||||
});
|
||||
}
|
||||
}
|
||||
const x = keypoints3.map((a) => a.position[0]);
|
||||
const y = keypoints3.map((a) => a.position[1]);
|
||||
|
@ -9978,30 +9997,38 @@ async function predict7(image24, config3) {
|
|||
];
|
||||
const boxRaw2 = [0, 0, 0, 0];
|
||||
const score2 = keypoints3.reduce((prev, curr) => curr.score > prev ? curr.score : prev, 0);
|
||||
return [{ id: 0, score: score2, box: box5, boxRaw: boxRaw2, keypoints: keypoints3 }];
|
||||
Object.keys(t).forEach((tensor3) => tf17.dispose(t[tensor3]));
|
||||
return { id: 0, score: score2, box: box5, boxRaw: boxRaw2, keypoints: keypoints3 };
|
||||
}
|
||||
async function predict7(input, config3) {
|
||||
outputSize2 = [input.shape[2] || 0, input.shape[1] || 0];
|
||||
const bodies = [];
|
||||
const body4 = await detectParts(input, config3);
|
||||
bodies.push(body4);
|
||||
return bodies;
|
||||
}
|
||||
|
||||
// src/efficientpose/efficientpose.ts
|
||||
// src/body/efficientpose.ts
|
||||
var tf18 = __toModule(require_tfjs_esm());
|
||||
var model5;
|
||||
var model4;
|
||||
var keypoints = [];
|
||||
var box4 = [0, 0, 0, 0];
|
||||
var boxRaw = [0, 0, 0, 0];
|
||||
var score = 0;
|
||||
var skipped4 = Number.MAX_SAFE_INTEGER;
|
||||
var bodyParts = ["head", "neck", "rightShoulder", "rightElbow", "rightWrist", "chest", "leftShoulder", "leftElbow", "leftWrist", "pelvis", "rightHip", "rightKnee", "rightAnkle", "leftHip", "leftKnee", "leftAnkle"];
|
||||
async function load8(config3) {
|
||||
async function load7(config3) {
|
||||
if (env.initial)
|
||||
model5 = null;
|
||||
if (!model5) {
|
||||
model5 = await tf18.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model5 || !model5["modelUrl"])
|
||||
model4 = null;
|
||||
if (!model4) {
|
||||
model4 = await tf18.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model4 || !model4["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model5["modelUrl"]);
|
||||
log("load model:", model4["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model5["modelUrl"]);
|
||||
return model5;
|
||||
log("cached model:", model4["modelUrl"]);
|
||||
return model4;
|
||||
}
|
||||
function max2d(inputs, minScore) {
|
||||
const [width, height] = inputs.shape;
|
||||
|
@ -10028,16 +10055,16 @@ async function predict8(image24, config3) {
|
|||
return new Promise(async (resolve) => {
|
||||
var _a2;
|
||||
const tensor3 = tf18.tidy(() => {
|
||||
if (!(model5 == null ? void 0 : model5.inputs[0].shape))
|
||||
if (!(model4 == null ? void 0 : model4.inputs[0].shape))
|
||||
return null;
|
||||
const resize = tf18.image.resizeBilinear(image24, [model5.inputs[0].shape[2], model5.inputs[0].shape[1]], false);
|
||||
const resize = tf18.image.resizeBilinear(image24, [model4.inputs[0].shape[2], model4.inputs[0].shape[1]], false);
|
||||
const enhance2 = tf18.mul(resize, 2);
|
||||
const norm = enhance2.sub(1);
|
||||
return norm;
|
||||
});
|
||||
let resT;
|
||||
if (config3.body.enabled)
|
||||
resT = await (model5 == null ? void 0 : model5.predict(tensor3));
|
||||
resT = await (model4 == null ? void 0 : model4.predict(tensor3));
|
||||
tf18.dispose(tensor3);
|
||||
if (resT) {
|
||||
keypoints.length = 0;
|
||||
|
@ -10052,12 +10079,12 @@ async function predict8(image24, config3) {
|
|||
score: Math.round(100 * partScore) / 100,
|
||||
part: bodyParts[id],
|
||||
positionRaw: [
|
||||
x2 / model5.inputs[0].shape[2],
|
||||
y2 / model5.inputs[0].shape[1]
|
||||
x2 / model4.inputs[0].shape[2],
|
||||
y2 / model4.inputs[0].shape[1]
|
||||
],
|
||||
position: [
|
||||
Math.round(image24.shape[2] * x2 / model5.inputs[0].shape[2]),
|
||||
Math.round(image24.shape[1] * y2 / model5.inputs[0].shape[1])
|
||||
Math.round(image24.shape[2] * x2 / model4.inputs[0].shape[2]),
|
||||
Math.round(image24.shape[1] * y2 / model4.inputs[0].shape[1])
|
||||
]
|
||||
});
|
||||
}
|
||||
|
@ -10085,30 +10112,30 @@ async function predict8(image24, config3) {
|
|||
});
|
||||
}
|
||||
|
||||
// src/movenet/movenet.ts
|
||||
// src/body/movenet.ts
|
||||
var tf19 = __toModule(require_tfjs_esm());
|
||||
var model6;
|
||||
var inputSize2 = 0;
|
||||
var model5;
|
||||
var inputSize3 = 0;
|
||||
var cachedBoxes = [];
|
||||
var skipped5 = Number.MAX_SAFE_INTEGER;
|
||||
var keypoints2 = [];
|
||||
var bodyParts2 = ["nose", "leftEye", "rightEye", "leftEar", "rightEar", "leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee", "leftAnkle", "rightAnkle"];
|
||||
async function load9(config3) {
|
||||
async function load8(config3) {
|
||||
if (env.initial)
|
||||
model6 = null;
|
||||
if (!model6) {
|
||||
model5 = null;
|
||||
if (!model5) {
|
||||
fakeOps(["size"], config3);
|
||||
model6 = await tf19.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model6 || !model6["modelUrl"])
|
||||
model5 = await tf19.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model5 || !model5["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model6["modelUrl"]);
|
||||
log("load model:", model5["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model6["modelUrl"]);
|
||||
inputSize2 = model6.inputs[0].shape ? model6.inputs[0].shape[2] : 0;
|
||||
if (inputSize2 === -1)
|
||||
inputSize2 = 256;
|
||||
return model6;
|
||||
log("cached model:", model5["modelUrl"]);
|
||||
inputSize3 = model5.inputs[0].shape ? model5.inputs[0].shape[2] : 0;
|
||||
if (inputSize3 === -1)
|
||||
inputSize3 = 256;
|
||||
return model5;
|
||||
}
|
||||
async function parseSinglePose(res, config3, image24, inputBox) {
|
||||
const kpt3 = res[0][0];
|
||||
|
@ -10193,7 +10220,7 @@ async function parseMultiPose(res, config3, image24, inputBox) {
|
|||
return bodies;
|
||||
}
|
||||
async function predict9(input, config3) {
|
||||
if (!model6 || !(model6 == null ? void 0 : model6.inputs[0].shape))
|
||||
if (!model5 || !(model5 == null ? void 0 : model5.inputs[0].shape))
|
||||
return [];
|
||||
return new Promise(async (resolve) => {
|
||||
const t = {};
|
||||
|
@ -10202,18 +10229,18 @@ async function predict9(input, config3) {
|
|||
cachedBoxes.length = 0;
|
||||
skipped5++;
|
||||
for (let i = 0; i < cachedBoxes.length; i++) {
|
||||
t.crop = tf19.image.cropAndResize(input, [cachedBoxes[i]], [0], [inputSize2, inputSize2], "bilinear");
|
||||
t.crop = tf19.image.cropAndResize(input, [cachedBoxes[i]], [0], [inputSize3, inputSize3], "bilinear");
|
||||
t.cast = tf19.cast(t.crop, "int32");
|
||||
t.res = await (model6 == null ? void 0 : model6.predict(t.cast));
|
||||
t.res = await (model5 == null ? void 0 : model5.predict(t.cast));
|
||||
const res = await t.res.array();
|
||||
const newBodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, cachedBoxes[i]) : await parseMultiPose(res, config3, input, cachedBoxes[i]);
|
||||
bodies = bodies.concat(newBodies);
|
||||
Object.keys(t).forEach((tensor3) => tf19.dispose(t[tensor3]));
|
||||
}
|
||||
if (bodies.length !== config3.body.maxDetected && skipped5 > (config3.body.skipFrames || 0)) {
|
||||
t.resized = tf19.image.resizeBilinear(input, [inputSize2, inputSize2], false);
|
||||
t.resized = tf19.image.resizeBilinear(input, [inputSize3, inputSize3], false);
|
||||
t.cast = tf19.cast(t.resized, "int32");
|
||||
t.res = await (model6 == null ? void 0 : model6.predict(t.cast));
|
||||
t.res = await (model5 == null ? void 0 : model5.predict(t.cast));
|
||||
const res = await t.res.array();
|
||||
bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]);
|
||||
Object.keys(t).forEach((tensor3) => tf19.dispose(t[tensor3]));
|
||||
|
@ -10225,7 +10252,7 @@ async function predict9(input, config3) {
|
|||
for (let i = 0; i < bodies.length; i++) {
|
||||
if (bodies[i].keypoints.length > 10) {
|
||||
const kpts = bodies[i].keypoints.map((kpt3) => kpt3.position);
|
||||
const newBox = scaleBox(kpts, 1.5, [input.shape[2], input.shape[1]]);
|
||||
const newBox = scale(kpts, 1.5, [input.shape[2], input.shape[1]]);
|
||||
cachedBoxes.push([...newBox.yxBox]);
|
||||
}
|
||||
}
|
||||
|
@ -10322,26 +10349,26 @@ var labels = [
|
|||
];
|
||||
|
||||
// src/object/nanodet.ts
|
||||
var model7;
|
||||
var model6;
|
||||
var last3 = [];
|
||||
var skipped6 = Number.MAX_SAFE_INTEGER;
|
||||
var scaleBox2 = 2.5;
|
||||
async function load10(config3) {
|
||||
if (!model7 || env.initial) {
|
||||
model7 = await tf20.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model7.modelSignature["inputs"]);
|
||||
model7.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;
|
||||
if (!model7.inputSize)
|
||||
var scaleBox = 2.5;
|
||||
async function load9(config3) {
|
||||
if (!model6 || env.initial) {
|
||||
model6 = await tf20.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model6.modelSignature["inputs"]);
|
||||
model6.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;
|
||||
if (!model6.inputSize)
|
||||
throw new Error(`cannot determine model inputSize: ${config3.object.modelPath}`);
|
||||
if (!model7 || !model7.modelUrl)
|
||||
if (!model6 || !model6.modelUrl)
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model7.modelUrl);
|
||||
log("load model:", model6.modelUrl);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model7.modelUrl);
|
||||
return model7;
|
||||
log("cached model:", model6.modelUrl);
|
||||
return model6;
|
||||
}
|
||||
async function process3(res, inputSize4, outputShape, config3) {
|
||||
async function process3(res, inputSize5, outputShape, config3) {
|
||||
let id = 0;
|
||||
let results = [];
|
||||
for (const strideSize of [1, 2, 4]) {
|
||||
|
@ -10359,14 +10386,14 @@ async function process3(res, inputSize4, outputShape, config3) {
|
|||
if (score2 > config3.object.minConfidence && j !== 61) {
|
||||
const cx = (0.5 + Math.trunc(i % baseSize)) / baseSize;
|
||||
const cy = (0.5 + Math.trunc(i / baseSize)) / baseSize;
|
||||
const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize4));
|
||||
const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize5));
|
||||
const [x, y] = [
|
||||
cx - scaleBox2 / strideSize * boxOffset[0],
|
||||
cy - scaleBox2 / strideSize * boxOffset[1]
|
||||
cx - scaleBox / strideSize * boxOffset[0],
|
||||
cy - scaleBox / strideSize * boxOffset[1]
|
||||
];
|
||||
const [w, h] = [
|
||||
cx + scaleBox2 / strideSize * boxOffset[2] - x,
|
||||
cy + scaleBox2 / strideSize * boxOffset[3] - y
|
||||
cx + scaleBox / strideSize * boxOffset[2] - x,
|
||||
cy + scaleBox / strideSize * boxOffset[3] - y
|
||||
];
|
||||
let boxRaw2 = [x, y, w, h];
|
||||
boxRaw2 = boxRaw2.map((a) => Math.max(0, Math.min(a, 1)));
|
||||
|
@ -10411,17 +10438,17 @@ async function predict10(image24, config3) {
|
|||
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
|
||||
return last3;
|
||||
return new Promise(async (resolve) => {
|
||||
const outputSize2 = [image24.shape[2], image24.shape[1]];
|
||||
const resize = tf20.image.resizeBilinear(image24, [model7.inputSize, model7.inputSize], false);
|
||||
const outputSize3 = [image24.shape[2], image24.shape[1]];
|
||||
const resize = tf20.image.resizeBilinear(image24, [model6.inputSize, model6.inputSize], false);
|
||||
const norm = tf20.div(resize, 255);
|
||||
const transpose = norm.transpose([0, 3, 1, 2]);
|
||||
tf20.dispose(norm);
|
||||
tf20.dispose(resize);
|
||||
let objectT;
|
||||
if (config3.object.enabled)
|
||||
objectT = await model7.predict(transpose);
|
||||
objectT = await model6.predict(transpose);
|
||||
tf20.dispose(transpose);
|
||||
const obj = await process3(objectT, model7.inputSize, outputSize2, config3);
|
||||
const obj = await process3(objectT, model6.inputSize, outputSize3, config3);
|
||||
last3 = obj;
|
||||
resolve(obj);
|
||||
});
|
||||
|
@ -10429,25 +10456,25 @@ async function predict10(image24, config3) {
|
|||
|
||||
// src/object/centernet.ts
|
||||
var tf21 = __toModule(require_tfjs_esm());
|
||||
var model8;
|
||||
var inputSize3 = 0;
|
||||
var model7;
|
||||
var inputSize4 = 0;
|
||||
var last4 = [];
|
||||
var skipped7 = Number.MAX_SAFE_INTEGER;
|
||||
async function load11(config3) {
|
||||
async function load10(config3) {
|
||||
if (env.initial)
|
||||
model8 = null;
|
||||
if (!model8) {
|
||||
model7 = null;
|
||||
if (!model7) {
|
||||
fakeOps(["floormod"], config3);
|
||||
model8 = await tf21.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model8.modelSignature["inputs"]);
|
||||
inputSize3 = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!model8 || !model8["modelUrl"])
|
||||
model7 = await tf21.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model7.modelSignature["inputs"]);
|
||||
inputSize4 = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!model7 || !model7["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model8["modelUrl"]);
|
||||
log("load model:", model7["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model8["modelUrl"]);
|
||||
return model8;
|
||||
log("cached model:", model7["modelUrl"]);
|
||||
return model7;
|
||||
}
|
||||
async function process4(res, outputShape, config3) {
|
||||
if (!res)
|
||||
|
@ -10476,14 +10503,14 @@ async function process4(res, outputShape, config3) {
|
|||
const classVal = detections[0][id][5];
|
||||
const label = labels[classVal].label;
|
||||
const [x, y] = [
|
||||
detections[0][id][0] / inputSize3,
|
||||
detections[0][id][1] / inputSize3
|
||||
detections[0][id][0] / inputSize4,
|
||||
detections[0][id][1] / inputSize4
|
||||
];
|
||||
const boxRaw2 = [
|
||||
x,
|
||||
y,
|
||||
detections[0][id][2] / inputSize3 - x,
|
||||
detections[0][id][3] / inputSize3 - y
|
||||
detections[0][id][2] / inputSize4 - x,
|
||||
detections[0][id][3] / inputSize4 - y
|
||||
];
|
||||
const box5 = [
|
||||
Math.trunc(boxRaw2[0] * outputShape[0]),
|
||||
|
@ -10504,11 +10531,11 @@ async function predict11(input, config3) {
|
|||
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
|
||||
return last4;
|
||||
return new Promise(async (resolve) => {
|
||||
const outputSize2 = [input.shape[2], input.shape[1]];
|
||||
const resize = tf21.image.resizeBilinear(input, [inputSize3, inputSize3]);
|
||||
const objectT = config3.object.enabled ? model8 == null ? void 0 : model8.execute(resize, ["tower_0/detections"]) : null;
|
||||
const outputSize3 = [input.shape[2], input.shape[1]];
|
||||
const resize = tf21.image.resizeBilinear(input, [inputSize4, inputSize4]);
|
||||
const objectT = config3.object.enabled ? model7 == null ? void 0 : model7.execute(resize, ["tower_0/detections"]) : null;
|
||||
tf21.dispose(resize);
|
||||
const obj = await process4(objectT, outputSize2, config3);
|
||||
const obj = await process4(objectT, outputSize3, config3);
|
||||
last4 = obj;
|
||||
resolve(obj);
|
||||
});
|
||||
|
@ -10516,36 +10543,36 @@ async function predict11(input, config3) {
|
|||
|
||||
// src/segmentation/segmentation.ts
|
||||
var tf22 = __toModule(require_tfjs_esm());
|
||||
var model9;
|
||||
var model8;
|
||||
var busy = false;
|
||||
async function load12(config3) {
|
||||
if (!model9 || env.initial) {
|
||||
model9 = await tf22.loadGraphModel(join(config3.modelBasePath, config3.segmentation.modelPath || ""));
|
||||
if (!model9 || !model9["modelUrl"])
|
||||
async function load11(config3) {
|
||||
if (!model8 || env.initial) {
|
||||
model8 = await tf22.loadGraphModel(join(config3.modelBasePath, config3.segmentation.modelPath || ""));
|
||||
if (!model8 || !model8["modelUrl"])
|
||||
log("load model failed:", config3.segmentation.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model9["modelUrl"]);
|
||||
log("load model:", model8["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model9["modelUrl"]);
|
||||
return model9;
|
||||
log("cached model:", model8["modelUrl"]);
|
||||
return model8;
|
||||
}
|
||||
async function process5(input, background, config3) {
|
||||
var _a, _b;
|
||||
if (busy)
|
||||
return { data: [], canvas: null, alpha: null };
|
||||
busy = true;
|
||||
if (!model9)
|
||||
await load12(config3);
|
||||
if (!model8)
|
||||
await load11(config3);
|
||||
const inputImage = process2(input, config3);
|
||||
const width = ((_a = inputImage.canvas) == null ? void 0 : _a.width) || 0;
|
||||
const height = ((_b = inputImage.canvas) == null ? void 0 : _b.height) || 0;
|
||||
if (!inputImage.tensor)
|
||||
return { data: [], canvas: null, alpha: null };
|
||||
const t = {};
|
||||
t.resize = tf22.image.resizeBilinear(inputImage.tensor, [model9.inputs[0].shape ? model9.inputs[0].shape[1] : 0, model9.inputs[0].shape ? model9.inputs[0].shape[2] : 0], false);
|
||||
t.resize = tf22.image.resizeBilinear(inputImage.tensor, [model8.inputs[0].shape ? model8.inputs[0].shape[1] : 0, model8.inputs[0].shape ? model8.inputs[0].shape[2] : 0], false);
|
||||
tf22.dispose(inputImage.tensor);
|
||||
t.norm = tf22.div(t.resize, 255);
|
||||
t.res = model9.predict(t.norm);
|
||||
t.res = model8.predict(t.norm);
|
||||
t.squeeze = tf22.squeeze(t.res, 0);
|
||||
if (t.squeeze.shape[2] === 2) {
|
||||
t.softmax = tf22.softmax(t.squeeze);
|
||||
|
@ -10598,22 +10625,22 @@ async function process5(input, background, config3) {
|
|||
return { data, canvas: mergedCanvas || compositeCanvas, alpha: alphaCanvas };
|
||||
}
|
||||
|
||||
// src/gear/agegenderrace.ts
|
||||
// src/gear/gear-agegenderrace.ts
|
||||
var tf23 = __toModule(require_tfjs_esm());
|
||||
var model10;
|
||||
var model9;
|
||||
var skipped8 = Number.MAX_SAFE_INTEGER;
|
||||
async function load13(config3) {
|
||||
async function load12(config3) {
|
||||
if (env.initial)
|
||||
model10 = null;
|
||||
if (!model10) {
|
||||
model10 = await tf23.loadGraphModel(join(config3.modelBasePath, config3.face.agegenderrace.modelPath));
|
||||
if (!model10 || !model10["modelUrl"])
|
||||
model9 = null;
|
||||
if (!model9) {
|
||||
model9 = await tf23.loadGraphModel(join(config3.modelBasePath, config3.face.agegenderrace.modelPath));
|
||||
if (!model9 || !model9["modelUrl"])
|
||||
log("load model failed:", config3.face.agegenderrace.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model10["modelUrl"]);
|
||||
log("load model:", model9["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model10["modelUrl"]);
|
||||
return model10;
|
||||
log("cached model:", model9["modelUrl"]);
|
||||
return model9;
|
||||
}
|
||||
|
||||
// src/models.ts
|
||||
|
@ -10621,6 +10648,7 @@ var Models = class {
|
|||
constructor() {
|
||||
__publicField(this, "age", null);
|
||||
__publicField(this, "agegenderrace", null);
|
||||
__publicField(this, "blazeposedetect", null);
|
||||
__publicField(this, "blazepose", null);
|
||||
__publicField(this, "centernet", null);
|
||||
__publicField(this, "efficientpose", null);
|
||||
|
@ -10641,11 +10669,11 @@ var Models = class {
|
|||
}
|
||||
};
|
||||
function reset(instance) {
|
||||
for (const model11 of Object.keys(instance.models))
|
||||
instance.models[model11] = null;
|
||||
for (const model10 of Object.keys(instance.models))
|
||||
instance.models[model10] = null;
|
||||
}
|
||||
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;
|
||||
async function load13(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, _B, _C, _D;
|
||||
if (env.initial)
|
||||
reset(instance);
|
||||
if (instance.config.face.enabled) {
|
||||
|
@ -10669,48 +10697,50 @@ async function load14(instance) {
|
|||
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 = load5(instance.config);
|
||||
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 = load8(instance.config);
|
||||
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.blazepose = load7(instance.config);
|
||||
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.efficientpose = load7(instance.config);
|
||||
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);
|
||||
if (instance.config.object.enabled && !instance.models.nanodet && ((_v = (_u = instance.config.object) == null ? void 0 : _u.modelPath) == null ? void 0 : _v.includes("nanodet")))
|
||||
instance.models.nanodet = load10(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")))
|
||||
instance.models.centernet = load11(instance.config);
|
||||
if (instance.config.face.enabled && ((_y = instance.config.face.emotion) == null ? void 0 : _y.enabled) && !instance.models.emotion)
|
||||
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.blazepose = loadPose(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.blazeposedetect && ((_q = instance.config.body.detector) == null ? void 0 : _q.modelPath) && ((_s = (_r = instance.config.body) == null ? void 0 : _r.modelPath) == null ? void 0 : _s.includes("blazepose")))
|
||||
instance.models.blazeposedetect = loadDetect2(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.efficientpose && ((_u = (_t = instance.config.body) == null ? void 0 : _t.modelPath) == null ? void 0 : _u.includes("efficientpose")))
|
||||
instance.models.efficientpose = load7(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.movenet && ((_w = (_v = instance.config.body) == null ? void 0 : _v.modelPath) == null ? void 0 : _w.includes("movenet")))
|
||||
instance.models.movenet = load8(instance.config);
|
||||
if (instance.config.object.enabled && !instance.models.nanodet && ((_y = (_x = instance.config.object) == null ? void 0 : _x.modelPath) == null ? void 0 : _y.includes("nanodet")))
|
||||
instance.models.nanodet = load9(instance.config);
|
||||
if (instance.config.object.enabled && !instance.models.centernet && ((_A = (_z = instance.config.object) == null ? void 0 : _z.modelPath) == null ? void 0 : _A.includes("centernet")))
|
||||
instance.models.centernet = load10(instance.config);
|
||||
if (instance.config.face.enabled && ((_B = instance.config.face.emotion) == null ? void 0 : _B.enabled) && !instance.models.emotion)
|
||||
instance.models.emotion = load4(instance.config);
|
||||
if (instance.config.face.enabled && ((_z = instance.config.face.description) == null ? void 0 : _z.enabled) && !instance.models.faceres)
|
||||
if (instance.config.face.enabled && ((_C = instance.config.face.description) == null ? void 0 : _C.enabled) && !instance.models.faceres)
|
||||
instance.models.faceres = load3(instance.config);
|
||||
if (instance.config.segmentation.enabled && !instance.models.segmentation)
|
||||
instance.models.segmentation = load12(instance.config);
|
||||
if (instance.config.face.enabled && ((_A = instance.config.face["agegenderrace"]) == null ? void 0 : _A.enabled) && !instance.models.agegenderrace)
|
||||
instance.models.agegenderrace = load13(instance.config);
|
||||
for await (const model11 of Object.keys(instance.models)) {
|
||||
if (instance.models[model11] && typeof instance.models[model11] !== "undefined")
|
||||
instance.models[model11] = await instance.models[model11];
|
||||
instance.models.segmentation = load11(instance.config);
|
||||
if (instance.config.face.enabled && ((_D = instance.config.face["agegenderrace"]) == null ? void 0 : _D.enabled) && !instance.models.agegenderrace)
|
||||
instance.models.agegenderrace = load12(instance.config);
|
||||
for await (const model10 of Object.keys(instance.models)) {
|
||||
if (instance.models[model10] && typeof instance.models[model10] !== "undefined")
|
||||
instance.models[model10] = await instance.models[model10];
|
||||
}
|
||||
}
|
||||
async function validate2(instance) {
|
||||
const simpleOps = ["const", "placeholder", "noop", "pad", "squeeze", "add", "sub", "mul", "div"];
|
||||
for (const defined of Object.keys(instance.models)) {
|
||||
if (instance.models[defined]) {
|
||||
let models4 = [];
|
||||
let models5 = [];
|
||||
if (Array.isArray(instance.models[defined])) {
|
||||
models4 = instance.models[defined].filter((model11) => model11 !== null).map((model11) => model11 && model11.executor ? model11 : model11.model);
|
||||
models5 = instance.models[defined].filter((model10) => model10 !== null).map((model10) => model10 && model10.executor ? model10 : model10.model);
|
||||
} else {
|
||||
models4 = [instance.models[defined]];
|
||||
models5 = [instance.models[defined]];
|
||||
}
|
||||
for (const model11 of models4) {
|
||||
if (!model11) {
|
||||
for (const model10 of models5) {
|
||||
if (!model10) {
|
||||
if (instance.config.debug)
|
||||
log("model marked as loaded but not defined:", defined);
|
||||
continue;
|
||||
}
|
||||
const ops = [];
|
||||
const executor = model11 == null ? void 0 : model11.executor;
|
||||
const executor = model10 == null ? void 0 : model10.executor;
|
||||
if (executor && executor.graph.nodes) {
|
||||
for (const kernel of Object.values(executor.graph.nodes)) {
|
||||
const op = kernel.op.toLowerCase();
|
||||
|
@ -10734,7 +10764,7 @@ async function validate2(instance) {
|
|||
}
|
||||
}
|
||||
|
||||
// src/face.ts
|
||||
// src/face/face.ts
|
||||
var tf24 = __toModule(require_tfjs_esm());
|
||||
var calculateGaze = (face5) => {
|
||||
const radians = (pt1, pt2) => Math.atan2(pt1[1] - pt2[1], pt1[0] - pt2[0]);
|
||||
|
@ -11042,7 +11072,7 @@ var hand = (res) => {
|
|||
return gestures;
|
||||
};
|
||||
|
||||
// src/draw.ts
|
||||
// src/util/draw.ts
|
||||
var options2 = {
|
||||
color: "rgba(173, 216, 230, 0.6)",
|
||||
labelColor: "rgba(173, 216, 230, 1)",
|
||||
|
@ -11588,7 +11618,7 @@ function join2(faces, bodies, hands, gestures, shape) {
|
|||
return persons2;
|
||||
}
|
||||
|
||||
// src/interpolate.ts
|
||||
// src/util/interpolate.ts
|
||||
var bufferedResult = { face: [], body: [], hand: [], gesture: [], object: [], persons: [], performance: {}, timestamp: 0 };
|
||||
function calc(newResult) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
||||
|
@ -12635,7 +12665,7 @@ var Human = class {
|
|||
async load(userConfig) {
|
||||
this.state = "load";
|
||||
const timeStamp = now();
|
||||
const count2 = Object.values(this.models).filter((model11) => model11).length;
|
||||
const count2 = Object.values(this.models).filter((model10) => model10).length;
|
||||
if (userConfig)
|
||||
this.config = mergeDeep(this.config, userConfig);
|
||||
if (env.initial) {
|
||||
|
@ -12653,11 +12683,11 @@ var Human = class {
|
|||
log("tf flags:", this.tf.ENV.flags);
|
||||
}
|
||||
}
|
||||
await load14(this);
|
||||
await load13(this);
|
||||
if (env.initial && this.config.debug)
|
||||
log("tf engine state:", this.tf.engine().state.numBytes, "bytes", this.tf.engine().state.numTensors, "tensors");
|
||||
env.initial = false;
|
||||
const loaded = Object.values(this.models).filter((model11) => model11).length;
|
||||
const loaded = Object.values(this.models).filter((model10) => model10).length;
|
||||
if (loaded !== count2) {
|
||||
await validate2(this);
|
||||
this.emit("load");
|
||||
|
|
|
@ -90,7 +90,7 @@ __export(exports, {
|
|||
env: () => env
|
||||
});
|
||||
|
||||
// src/util.ts
|
||||
// src/util/util.ts
|
||||
function join(folder, file) {
|
||||
const separator = folder.endsWith("/") ? "" : "/";
|
||||
const skipJoin = file.startsWith(".") || file.startsWith("/") || file.startsWith("http:") || file.startsWith("https:") || file.startsWith("file:");
|
||||
|
@ -143,31 +143,6 @@ function mergeDeep(...objects) {
|
|||
return prev;
|
||||
}, {});
|
||||
}
|
||||
function scaleBox(keypoints3, boxScaleFact2, outputSize2) {
|
||||
const coords3 = [keypoints3.map((pt) => pt[0]), keypoints3.map((pt) => pt[1])];
|
||||
const maxmin = [Math.max(...coords3[0]), Math.min(...coords3[0]), Math.max(...coords3[1]), Math.min(...coords3[1])];
|
||||
const center = [(maxmin[0] + maxmin[1]) / 2, (maxmin[2] + maxmin[3]) / 2];
|
||||
const diff = Math.max(center[0] - maxmin[1], center[1] - maxmin[3], -center[0] + maxmin[0], -center[1] + maxmin[2]) * boxScaleFact2;
|
||||
const box5 = [
|
||||
Math.trunc(center[0] - diff),
|
||||
Math.trunc(center[1] - diff),
|
||||
Math.trunc(2 * diff),
|
||||
Math.trunc(2 * diff)
|
||||
];
|
||||
const boxRaw2 = [
|
||||
box5[0] / outputSize2[0],
|
||||
box5[1] / outputSize2[1],
|
||||
box5[2] / outputSize2[0],
|
||||
box5[3] / outputSize2[1]
|
||||
];
|
||||
const yxBox = [
|
||||
boxRaw2[1],
|
||||
boxRaw2[0],
|
||||
boxRaw2[3] + boxRaw2[1],
|
||||
boxRaw2[2] + boxRaw2[0]
|
||||
];
|
||||
return { box: box5, boxRaw: boxRaw2, yxBox };
|
||||
}
|
||||
|
||||
// src/config.ts
|
||||
var config = {
|
||||
|
@ -237,6 +212,9 @@ var config = {
|
|||
body: {
|
||||
enabled: true,
|
||||
modelPath: "movenet-lightning.json",
|
||||
detector: {
|
||||
modelPath: ""
|
||||
},
|
||||
maxDetected: -1,
|
||||
minConfidence: 0.2,
|
||||
skipFrames: 1
|
||||
|
@ -404,13 +382,13 @@ function rotatePoint(homogeneousCoordinate, rotationMatrix) {
|
|||
dot(homogeneousCoordinate, rotationMatrix[1])
|
||||
];
|
||||
}
|
||||
function generateAnchors(inputSize4) {
|
||||
const spec = { strides: [inputSize4 / 16, inputSize4 / 8], anchors: [2, 6] };
|
||||
function generateAnchors(inputSize5) {
|
||||
const spec = { strides: [inputSize5 / 16, inputSize5 / 8], anchors: [2, 6] };
|
||||
const anchors3 = [];
|
||||
for (let i = 0; i < spec.strides.length; i++) {
|
||||
const stride = spec.strides[i];
|
||||
const gridRows = Math.floor((inputSize4 + stride - 1) / stride);
|
||||
const gridCols = Math.floor((inputSize4 + stride - 1) / stride);
|
||||
const gridRows = Math.floor((inputSize5 + stride - 1) / stride);
|
||||
const gridCols = Math.floor((inputSize5 + stride - 1) / stride);
|
||||
const anchorsNum = spec.anchors[i];
|
||||
for (let gridY = 0; gridY < gridRows; gridY++) {
|
||||
const anchorY = stride * (gridY + 0.5);
|
||||
|
@ -427,31 +405,31 @@ function generateAnchors(inputSize4) {
|
|||
|
||||
// src/blazeface/blazeface.ts
|
||||
var keypointsCount = 6;
|
||||
function decodeBounds(boxOutputs, anchors3, inputSize4) {
|
||||
function decodeBounds(boxOutputs, anchors3, inputSize5) {
|
||||
const boxStarts = tf2.slice(boxOutputs, [0, 1], [-1, 2]);
|
||||
const centers = tf2.add(boxStarts, anchors3);
|
||||
const boxSizes = tf2.slice(boxOutputs, [0, 3], [-1, 2]);
|
||||
const boxSizesNormalized = tf2.div(boxSizes, inputSize4);
|
||||
const centersNormalized = tf2.div(centers, inputSize4);
|
||||
const boxSizesNormalized = tf2.div(boxSizes, inputSize5);
|
||||
const centersNormalized = tf2.div(centers, inputSize5);
|
||||
const halfBoxSize = tf2.div(boxSizesNormalized, 2);
|
||||
const starts = tf2.sub(centersNormalized, halfBoxSize);
|
||||
const ends = tf2.add(centersNormalized, halfBoxSize);
|
||||
const startNormalized = tf2.mul(starts, inputSize4);
|
||||
const endNormalized = tf2.mul(ends, inputSize4);
|
||||
const startNormalized = tf2.mul(starts, inputSize5);
|
||||
const endNormalized = tf2.mul(ends, inputSize5);
|
||||
const concatAxis = 1;
|
||||
return tf2.concat2d([startNormalized, endNormalized], concatAxis);
|
||||
}
|
||||
var BlazeFaceModel = class {
|
||||
constructor(model11, config3) {
|
||||
constructor(model10, config3) {
|
||||
__publicField(this, "model");
|
||||
__publicField(this, "anchorsData");
|
||||
__publicField(this, "anchors");
|
||||
__publicField(this, "inputSize");
|
||||
__publicField(this, "config");
|
||||
this.model = model11;
|
||||
this.anchorsData = generateAnchors(model11.inputs[0].shape[1]);
|
||||
this.model = model10;
|
||||
this.anchorsData = generateAnchors(model10.inputs[0].shape[1]);
|
||||
this.anchors = tf2.tensor2d(this.anchorsData);
|
||||
this.inputSize = model11.inputs[0].shape[2];
|
||||
this.inputSize = model10.inputs[0].shape[2];
|
||||
this.config = config3;
|
||||
}
|
||||
async getBoundingBoxes(inputImage, userConfig) {
|
||||
|
@ -503,12 +481,12 @@ var BlazeFaceModel = class {
|
|||
};
|
||||
async function load(config3) {
|
||||
var _a, _b, _c;
|
||||
const model11 = await tf2.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);
|
||||
if (!model11 || !model11.modelUrl)
|
||||
const model10 = await tf2.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(model10, config3);
|
||||
if (!model10 || !model10.modelUrl)
|
||||
log("load model failed:", ((_c = config3.face.detector) == null ? void 0 : _c.modelPath) || "");
|
||||
else if (config3.debug)
|
||||
log("load model:", model11.modelUrl);
|
||||
log("load model:", model10.modelUrl);
|
||||
return blazeFace;
|
||||
}
|
||||
|
||||
|
@ -3784,7 +3762,7 @@ var UV68 = VTX68.map((x) => UV468[x]);
|
|||
var UV33 = VTX33.map((x) => UV468[x]);
|
||||
var UV7 = VTX7.map((x) => UV468[x]);
|
||||
|
||||
// src/env.ts
|
||||
// src/util/env.ts
|
||||
var tf4 = __toModule(require_tfjs_esm());
|
||||
|
||||
// src/image/image.ts
|
||||
|
@ -4704,7 +4682,7 @@ async function skip(config3, input) {
|
|||
return skipFrame;
|
||||
}
|
||||
|
||||
// src/env.ts
|
||||
// src/util/env.ts
|
||||
var env = {
|
||||
browser: void 0,
|
||||
node: void 0,
|
||||
|
@ -5165,7 +5143,7 @@ async function load2(config3) {
|
|||
var triangulation = TRI468;
|
||||
var uvmap = UV468;
|
||||
|
||||
// src/faceres/faceres.ts
|
||||
// src/face/faceres.ts
|
||||
var tf7 = __toModule(require_tfjs_esm());
|
||||
var model;
|
||||
var last = [];
|
||||
|
@ -5269,7 +5247,7 @@ async function predict2(image24, config3, idx, count2) {
|
|||
});
|
||||
}
|
||||
|
||||
// src/emotion/emotion.ts
|
||||
// src/gear/emotion.ts
|
||||
var tf8 = __toModule(require_tfjs_esm());
|
||||
var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"];
|
||||
var model2;
|
||||
|
@ -8690,14 +8668,14 @@ var anchors = [
|
|||
|
||||
// src/handpose/handdetector.ts
|
||||
var HandDetector = class {
|
||||
constructor(model11) {
|
||||
constructor(model10) {
|
||||
__publicField(this, "model");
|
||||
__publicField(this, "anchors");
|
||||
__publicField(this, "anchorsTensor");
|
||||
__publicField(this, "inputSize");
|
||||
__publicField(this, "inputSizeTensor");
|
||||
__publicField(this, "doubleInputSizeTensor");
|
||||
this.model = model11;
|
||||
this.model = model10;
|
||||
this.anchors = anchors.map((anchor) => [anchor.x, anchor.y]);
|
||||
this.anchorsTensor = tf11.tensor2d(this.anchors);
|
||||
this.inputSize = this.model && this.model.inputs && this.model.inputs[0].shape ? this.model.inputs[0].shape[2] : 0;
|
||||
|
@ -9456,7 +9434,34 @@ async function load6(config3) {
|
|||
return [handDetectorModel, handPoseModel];
|
||||
}
|
||||
|
||||
// src/handtrack/handtrack.ts
|
||||
// src/util/box.ts
|
||||
function scale(keypoints3, boxScaleFact2, outputSize3) {
|
||||
const coords3 = [keypoints3.map((pt) => pt[0]), keypoints3.map((pt) => pt[1])];
|
||||
const maxmin = [Math.max(...coords3[0]), Math.min(...coords3[0]), Math.max(...coords3[1]), Math.min(...coords3[1])];
|
||||
const center = [(maxmin[0] + maxmin[1]) / 2, (maxmin[2] + maxmin[3]) / 2];
|
||||
const diff = Math.max(center[0] - maxmin[1], center[1] - maxmin[3], -center[0] + maxmin[0], -center[1] + maxmin[2]) * boxScaleFact2;
|
||||
const box5 = [
|
||||
Math.trunc(center[0] - diff),
|
||||
Math.trunc(center[1] - diff),
|
||||
Math.trunc(2 * diff),
|
||||
Math.trunc(2 * diff)
|
||||
];
|
||||
const boxRaw2 = [
|
||||
box5[0] / outputSize3[0],
|
||||
box5[1] / outputSize3[1],
|
||||
box5[2] / outputSize3[0],
|
||||
box5[3] / outputSize3[1]
|
||||
];
|
||||
const yxBox = [
|
||||
boxRaw2[1],
|
||||
boxRaw2[0],
|
||||
boxRaw2[3] + boxRaw2[1],
|
||||
boxRaw2[2] + boxRaw2[0]
|
||||
];
|
||||
return { box: box5, boxRaw: boxRaw2, yxBox };
|
||||
}
|
||||
|
||||
// src/hand/handtrack.ts
|
||||
var tf16 = __toModule(require_tfjs_esm());
|
||||
|
||||
// src/tfjs/humangl.ts
|
||||
|
@ -9663,7 +9668,7 @@ function fakeOps(kernelNames, config3) {
|
|||
env.kernels = tf15.getKernelsForBackend(tf15.getBackend()).map((kernel) => kernel.kernelName.toLowerCase());
|
||||
}
|
||||
|
||||
// src/handtrack/handtrack.ts
|
||||
// src/hand/handtrack.ts
|
||||
var boxScaleFact = 1.5;
|
||||
var models2 = [null, null];
|
||||
var modelOutputNodes = ["StatefulPartitionedCall/Postprocessor/Slice", "StatefulPartitionedCall/Postprocessor/ExpandDims_1"];
|
||||
|
@ -9801,7 +9806,7 @@ async function detectFingers(input, h, config3) {
|
|||
h.box[3] * coord[1] / inputSize[1][1] + h.box[1],
|
||||
(h.box[2] + h.box[3]) / 2 / inputSize[1][0] * coord[2]
|
||||
]);
|
||||
const updatedBox = scaleBox(hand3.keypoints, boxScaleFact, outputSize);
|
||||
const updatedBox = scale(hand3.keypoints, boxScaleFact, outputSize);
|
||||
h.box = updatedBox.box;
|
||||
h.boxRaw = updatedBox.boxRaw;
|
||||
h.yxBox = updatedBox.yxBox;
|
||||
|
@ -9838,10 +9843,10 @@ async function predict6(input, config3) {
|
|||
return hands;
|
||||
}
|
||||
|
||||
// src/blazepose/blazepose.ts
|
||||
// src/body/blazepose.ts
|
||||
var tf17 = __toModule(require_tfjs_esm());
|
||||
|
||||
// src/blazepose/annotations.ts
|
||||
// src/body/annotations.ts
|
||||
var full = [
|
||||
"nose",
|
||||
"leftEyeInside",
|
||||
|
@ -9917,57 +9922,71 @@ var upper = [
|
|||
"right:30"
|
||||
];
|
||||
|
||||
// src/blazepose/blazepose.ts
|
||||
var model4;
|
||||
async function load7(config3) {
|
||||
// src/body/blazepose.ts
|
||||
var models3 = [null, null];
|
||||
var outputNodes = ["ld_3d", "activation_segmentation", "activation_heatmap", "world_3d", "output_poseflag"];
|
||||
var inputSize2 = [[0, 0], [0, 0]];
|
||||
var outputSize2 = [0, 0];
|
||||
async function loadDetect2(config3) {
|
||||
var _a;
|
||||
if (env.initial)
|
||||
model4 = null;
|
||||
if (!model4) {
|
||||
model4 = await tf17.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
model4["width"] = parseInt(model4["signature"].inputs["input_1:0"].tensorShape.dim[2].size);
|
||||
model4["height"] = parseInt(model4["signature"].inputs["input_1:0"].tensorShape.dim[1].size);
|
||||
if (!model4 || !model4["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
models3[0] = null;
|
||||
if (!models3[0]) {
|
||||
models3[0] = await tf17.loadGraphModel(join(config3.modelBasePath, ((_a = config3.body.detector) == null ? void 0 : _a.modelPath) || ""));
|
||||
const inputs = Object.values(models3[0].modelSignature["inputs"]);
|
||||
inputSize2[0][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
|
||||
inputSize2[0][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!models3[0] || !models3[0]["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model4["modelUrl"]);
|
||||
log("load model:", models3[0]["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model4["modelUrl"]);
|
||||
return model4;
|
||||
log("cached model:", models3[0]["modelUrl"]);
|
||||
return models3[0];
|
||||
}
|
||||
async function predict7(image24, config3) {
|
||||
if (!model4)
|
||||
return [];
|
||||
if (!config3.body.enabled)
|
||||
return [];
|
||||
const imgSize = { width: image24.shape[2] || 0, height: image24.shape[1] || 0 };
|
||||
const resize = tf17.image.resizeBilinear(image24, [model4["width"], model4["height"]], false);
|
||||
const normalize = tf17.div(resize, [255]);
|
||||
tf17.dispose(resize);
|
||||
const resT = await model4.predict(normalize);
|
||||
const findT = resT.find((t) => t.size === 195 || t.size === 155);
|
||||
const points = await (findT == null ? void 0 : findT.data()) || [];
|
||||
resT.forEach((t) => tf17.dispose(t));
|
||||
tf17.dispose(normalize);
|
||||
async function loadPose(config3) {
|
||||
if (env.initial)
|
||||
models3[1] = null;
|
||||
if (!models3[1]) {
|
||||
models3[1] = await tf17.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
const inputs = Object.values(models3[1].modelSignature["inputs"]);
|
||||
inputSize2[1][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
|
||||
inputSize2[1][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!models3[1] || !models3[1]["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", models3[1]["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", models3[1]["modelUrl"]);
|
||||
return models3[1];
|
||||
}
|
||||
async function detectParts(input, config3) {
|
||||
var _a;
|
||||
const t = {};
|
||||
t.resize = tf17.image.resizeBilinear(input, [inputSize2[1][0], inputSize2[1][1]]);
|
||||
[t.ld, t.segmentation, t.heatmap, t.world, t.poseflag] = await ((_a = models3[1]) == null ? void 0 : _a.execute(t.resize, outputNodes));
|
||||
const points = await t.ld.data();
|
||||
const keypoints3 = [];
|
||||
const labels2 = (points == null ? void 0 : points.length) === 195 ? full : upper;
|
||||
const depth = 5;
|
||||
for (let i = 0; i < points.length / depth; i++) {
|
||||
keypoints3.push({
|
||||
id: i,
|
||||
part: labels2[i],
|
||||
position: [
|
||||
Math.trunc(imgSize.width * points[depth * i + 0] / 255),
|
||||
Math.trunc(imgSize.height * points[depth * i + 1] / 255),
|
||||
Math.trunc(points[depth * i + 2]) + 0
|
||||
],
|
||||
positionRaw: [
|
||||
points[depth * i + 0] / 255,
|
||||
points[depth * i + 1] / 255,
|
||||
points[depth * i + 2] + 0
|
||||
],
|
||||
score: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100,
|
||||
presence: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 4])))) / 100
|
||||
});
|
||||
const score3 = (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100;
|
||||
if (score3 > (config3.body.minConfidence || 0)) {
|
||||
keypoints3.push({
|
||||
part: labels2[i],
|
||||
position: [
|
||||
Math.trunc(outputSize2[0] * points[depth * i + 0] / 255),
|
||||
Math.trunc(outputSize2[1] * points[depth * i + 1] / 255),
|
||||
Math.trunc(points[depth * i + 2]) + 0
|
||||
],
|
||||
positionRaw: [
|
||||
points[depth * i + 0] / 255,
|
||||
points[depth * i + 1] / 255,
|
||||
points[depth * i + 2] + 0
|
||||
],
|
||||
score: score3
|
||||
});
|
||||
}
|
||||
}
|
||||
const x = keypoints3.map((a) => a.position[0]);
|
||||
const y = keypoints3.map((a) => a.position[1]);
|
||||
|
@ -9979,30 +9998,38 @@ async function predict7(image24, config3) {
|
|||
];
|
||||
const boxRaw2 = [0, 0, 0, 0];
|
||||
const score2 = keypoints3.reduce((prev, curr) => curr.score > prev ? curr.score : prev, 0);
|
||||
return [{ id: 0, score: score2, box: box5, boxRaw: boxRaw2, keypoints: keypoints3 }];
|
||||
Object.keys(t).forEach((tensor3) => tf17.dispose(t[tensor3]));
|
||||
return { id: 0, score: score2, box: box5, boxRaw: boxRaw2, keypoints: keypoints3 };
|
||||
}
|
||||
async function predict7(input, config3) {
|
||||
outputSize2 = [input.shape[2] || 0, input.shape[1] || 0];
|
||||
const bodies = [];
|
||||
const body4 = await detectParts(input, config3);
|
||||
bodies.push(body4);
|
||||
return bodies;
|
||||
}
|
||||
|
||||
// src/efficientpose/efficientpose.ts
|
||||
// src/body/efficientpose.ts
|
||||
var tf18 = __toModule(require_tfjs_esm());
|
||||
var model5;
|
||||
var model4;
|
||||
var keypoints = [];
|
||||
var box4 = [0, 0, 0, 0];
|
||||
var boxRaw = [0, 0, 0, 0];
|
||||
var score = 0;
|
||||
var skipped4 = Number.MAX_SAFE_INTEGER;
|
||||
var bodyParts = ["head", "neck", "rightShoulder", "rightElbow", "rightWrist", "chest", "leftShoulder", "leftElbow", "leftWrist", "pelvis", "rightHip", "rightKnee", "rightAnkle", "leftHip", "leftKnee", "leftAnkle"];
|
||||
async function load8(config3) {
|
||||
async function load7(config3) {
|
||||
if (env.initial)
|
||||
model5 = null;
|
||||
if (!model5) {
|
||||
model5 = await tf18.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model5 || !model5["modelUrl"])
|
||||
model4 = null;
|
||||
if (!model4) {
|
||||
model4 = await tf18.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model4 || !model4["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model5["modelUrl"]);
|
||||
log("load model:", model4["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model5["modelUrl"]);
|
||||
return model5;
|
||||
log("cached model:", model4["modelUrl"]);
|
||||
return model4;
|
||||
}
|
||||
function max2d(inputs, minScore) {
|
||||
const [width, height] = inputs.shape;
|
||||
|
@ -10029,16 +10056,16 @@ async function predict8(image24, config3) {
|
|||
return new Promise(async (resolve) => {
|
||||
var _a2;
|
||||
const tensor3 = tf18.tidy(() => {
|
||||
if (!(model5 == null ? void 0 : model5.inputs[0].shape))
|
||||
if (!(model4 == null ? void 0 : model4.inputs[0].shape))
|
||||
return null;
|
||||
const resize = tf18.image.resizeBilinear(image24, [model5.inputs[0].shape[2], model5.inputs[0].shape[1]], false);
|
||||
const resize = tf18.image.resizeBilinear(image24, [model4.inputs[0].shape[2], model4.inputs[0].shape[1]], false);
|
||||
const enhance2 = tf18.mul(resize, 2);
|
||||
const norm = enhance2.sub(1);
|
||||
return norm;
|
||||
});
|
||||
let resT;
|
||||
if (config3.body.enabled)
|
||||
resT = await (model5 == null ? void 0 : model5.predict(tensor3));
|
||||
resT = await (model4 == null ? void 0 : model4.predict(tensor3));
|
||||
tf18.dispose(tensor3);
|
||||
if (resT) {
|
||||
keypoints.length = 0;
|
||||
|
@ -10053,12 +10080,12 @@ async function predict8(image24, config3) {
|
|||
score: Math.round(100 * partScore) / 100,
|
||||
part: bodyParts[id],
|
||||
positionRaw: [
|
||||
x2 / model5.inputs[0].shape[2],
|
||||
y2 / model5.inputs[0].shape[1]
|
||||
x2 / model4.inputs[0].shape[2],
|
||||
y2 / model4.inputs[0].shape[1]
|
||||
],
|
||||
position: [
|
||||
Math.round(image24.shape[2] * x2 / model5.inputs[0].shape[2]),
|
||||
Math.round(image24.shape[1] * y2 / model5.inputs[0].shape[1])
|
||||
Math.round(image24.shape[2] * x2 / model4.inputs[0].shape[2]),
|
||||
Math.round(image24.shape[1] * y2 / model4.inputs[0].shape[1])
|
||||
]
|
||||
});
|
||||
}
|
||||
|
@ -10086,30 +10113,30 @@ async function predict8(image24, config3) {
|
|||
});
|
||||
}
|
||||
|
||||
// src/movenet/movenet.ts
|
||||
// src/body/movenet.ts
|
||||
var tf19 = __toModule(require_tfjs_esm());
|
||||
var model6;
|
||||
var inputSize2 = 0;
|
||||
var model5;
|
||||
var inputSize3 = 0;
|
||||
var cachedBoxes = [];
|
||||
var skipped5 = Number.MAX_SAFE_INTEGER;
|
||||
var keypoints2 = [];
|
||||
var bodyParts2 = ["nose", "leftEye", "rightEye", "leftEar", "rightEar", "leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee", "leftAnkle", "rightAnkle"];
|
||||
async function load9(config3) {
|
||||
async function load8(config3) {
|
||||
if (env.initial)
|
||||
model6 = null;
|
||||
if (!model6) {
|
||||
model5 = null;
|
||||
if (!model5) {
|
||||
fakeOps(["size"], config3);
|
||||
model6 = await tf19.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model6 || !model6["modelUrl"])
|
||||
model5 = await tf19.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model5 || !model5["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model6["modelUrl"]);
|
||||
log("load model:", model5["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model6["modelUrl"]);
|
||||
inputSize2 = model6.inputs[0].shape ? model6.inputs[0].shape[2] : 0;
|
||||
if (inputSize2 === -1)
|
||||
inputSize2 = 256;
|
||||
return model6;
|
||||
log("cached model:", model5["modelUrl"]);
|
||||
inputSize3 = model5.inputs[0].shape ? model5.inputs[0].shape[2] : 0;
|
||||
if (inputSize3 === -1)
|
||||
inputSize3 = 256;
|
||||
return model5;
|
||||
}
|
||||
async function parseSinglePose(res, config3, image24, inputBox) {
|
||||
const kpt3 = res[0][0];
|
||||
|
@ -10194,7 +10221,7 @@ async function parseMultiPose(res, config3, image24, inputBox) {
|
|||
return bodies;
|
||||
}
|
||||
async function predict9(input, config3) {
|
||||
if (!model6 || !(model6 == null ? void 0 : model6.inputs[0].shape))
|
||||
if (!model5 || !(model5 == null ? void 0 : model5.inputs[0].shape))
|
||||
return [];
|
||||
return new Promise(async (resolve) => {
|
||||
const t = {};
|
||||
|
@ -10203,18 +10230,18 @@ async function predict9(input, config3) {
|
|||
cachedBoxes.length = 0;
|
||||
skipped5++;
|
||||
for (let i = 0; i < cachedBoxes.length; i++) {
|
||||
t.crop = tf19.image.cropAndResize(input, [cachedBoxes[i]], [0], [inputSize2, inputSize2], "bilinear");
|
||||
t.crop = tf19.image.cropAndResize(input, [cachedBoxes[i]], [0], [inputSize3, inputSize3], "bilinear");
|
||||
t.cast = tf19.cast(t.crop, "int32");
|
||||
t.res = await (model6 == null ? void 0 : model6.predict(t.cast));
|
||||
t.res = await (model5 == null ? void 0 : model5.predict(t.cast));
|
||||
const res = await t.res.array();
|
||||
const newBodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, cachedBoxes[i]) : await parseMultiPose(res, config3, input, cachedBoxes[i]);
|
||||
bodies = bodies.concat(newBodies);
|
||||
Object.keys(t).forEach((tensor3) => tf19.dispose(t[tensor3]));
|
||||
}
|
||||
if (bodies.length !== config3.body.maxDetected && skipped5 > (config3.body.skipFrames || 0)) {
|
||||
t.resized = tf19.image.resizeBilinear(input, [inputSize2, inputSize2], false);
|
||||
t.resized = tf19.image.resizeBilinear(input, [inputSize3, inputSize3], false);
|
||||
t.cast = tf19.cast(t.resized, "int32");
|
||||
t.res = await (model6 == null ? void 0 : model6.predict(t.cast));
|
||||
t.res = await (model5 == null ? void 0 : model5.predict(t.cast));
|
||||
const res = await t.res.array();
|
||||
bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]);
|
||||
Object.keys(t).forEach((tensor3) => tf19.dispose(t[tensor3]));
|
||||
|
@ -10226,7 +10253,7 @@ async function predict9(input, config3) {
|
|||
for (let i = 0; i < bodies.length; i++) {
|
||||
if (bodies[i].keypoints.length > 10) {
|
||||
const kpts = bodies[i].keypoints.map((kpt3) => kpt3.position);
|
||||
const newBox = scaleBox(kpts, 1.5, [input.shape[2], input.shape[1]]);
|
||||
const newBox = scale(kpts, 1.5, [input.shape[2], input.shape[1]]);
|
||||
cachedBoxes.push([...newBox.yxBox]);
|
||||
}
|
||||
}
|
||||
|
@ -10323,26 +10350,26 @@ var labels = [
|
|||
];
|
||||
|
||||
// src/object/nanodet.ts
|
||||
var model7;
|
||||
var model6;
|
||||
var last3 = [];
|
||||
var skipped6 = Number.MAX_SAFE_INTEGER;
|
||||
var scaleBox2 = 2.5;
|
||||
async function load10(config3) {
|
||||
if (!model7 || env.initial) {
|
||||
model7 = await tf20.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model7.modelSignature["inputs"]);
|
||||
model7.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;
|
||||
if (!model7.inputSize)
|
||||
var scaleBox = 2.5;
|
||||
async function load9(config3) {
|
||||
if (!model6 || env.initial) {
|
||||
model6 = await tf20.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model6.modelSignature["inputs"]);
|
||||
model6.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;
|
||||
if (!model6.inputSize)
|
||||
throw new Error(`cannot determine model inputSize: ${config3.object.modelPath}`);
|
||||
if (!model7 || !model7.modelUrl)
|
||||
if (!model6 || !model6.modelUrl)
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model7.modelUrl);
|
||||
log("load model:", model6.modelUrl);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model7.modelUrl);
|
||||
return model7;
|
||||
log("cached model:", model6.modelUrl);
|
||||
return model6;
|
||||
}
|
||||
async function process3(res, inputSize4, outputShape, config3) {
|
||||
async function process3(res, inputSize5, outputShape, config3) {
|
||||
let id = 0;
|
||||
let results = [];
|
||||
for (const strideSize of [1, 2, 4]) {
|
||||
|
@ -10360,14 +10387,14 @@ async function process3(res, inputSize4, outputShape, config3) {
|
|||
if (score2 > config3.object.minConfidence && j !== 61) {
|
||||
const cx = (0.5 + Math.trunc(i % baseSize)) / baseSize;
|
||||
const cy = (0.5 + Math.trunc(i / baseSize)) / baseSize;
|
||||
const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize4));
|
||||
const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize5));
|
||||
const [x, y] = [
|
||||
cx - scaleBox2 / strideSize * boxOffset[0],
|
||||
cy - scaleBox2 / strideSize * boxOffset[1]
|
||||
cx - scaleBox / strideSize * boxOffset[0],
|
||||
cy - scaleBox / strideSize * boxOffset[1]
|
||||
];
|
||||
const [w, h] = [
|
||||
cx + scaleBox2 / strideSize * boxOffset[2] - x,
|
||||
cy + scaleBox2 / strideSize * boxOffset[3] - y
|
||||
cx + scaleBox / strideSize * boxOffset[2] - x,
|
||||
cy + scaleBox / strideSize * boxOffset[3] - y
|
||||
];
|
||||
let boxRaw2 = [x, y, w, h];
|
||||
boxRaw2 = boxRaw2.map((a) => Math.max(0, Math.min(a, 1)));
|
||||
|
@ -10412,17 +10439,17 @@ async function predict10(image24, config3) {
|
|||
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
|
||||
return last3;
|
||||
return new Promise(async (resolve) => {
|
||||
const outputSize2 = [image24.shape[2], image24.shape[1]];
|
||||
const resize = tf20.image.resizeBilinear(image24, [model7.inputSize, model7.inputSize], false);
|
||||
const outputSize3 = [image24.shape[2], image24.shape[1]];
|
||||
const resize = tf20.image.resizeBilinear(image24, [model6.inputSize, model6.inputSize], false);
|
||||
const norm = tf20.div(resize, 255);
|
||||
const transpose = norm.transpose([0, 3, 1, 2]);
|
||||
tf20.dispose(norm);
|
||||
tf20.dispose(resize);
|
||||
let objectT;
|
||||
if (config3.object.enabled)
|
||||
objectT = await model7.predict(transpose);
|
||||
objectT = await model6.predict(transpose);
|
||||
tf20.dispose(transpose);
|
||||
const obj = await process3(objectT, model7.inputSize, outputSize2, config3);
|
||||
const obj = await process3(objectT, model6.inputSize, outputSize3, config3);
|
||||
last3 = obj;
|
||||
resolve(obj);
|
||||
});
|
||||
|
@ -10430,25 +10457,25 @@ async function predict10(image24, config3) {
|
|||
|
||||
// src/object/centernet.ts
|
||||
var tf21 = __toModule(require_tfjs_esm());
|
||||
var model8;
|
||||
var inputSize3 = 0;
|
||||
var model7;
|
||||
var inputSize4 = 0;
|
||||
var last4 = [];
|
||||
var skipped7 = Number.MAX_SAFE_INTEGER;
|
||||
async function load11(config3) {
|
||||
async function load10(config3) {
|
||||
if (env.initial)
|
||||
model8 = null;
|
||||
if (!model8) {
|
||||
model7 = null;
|
||||
if (!model7) {
|
||||
fakeOps(["floormod"], config3);
|
||||
model8 = await tf21.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model8.modelSignature["inputs"]);
|
||||
inputSize3 = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!model8 || !model8["modelUrl"])
|
||||
model7 = await tf21.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model7.modelSignature["inputs"]);
|
||||
inputSize4 = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!model7 || !model7["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model8["modelUrl"]);
|
||||
log("load model:", model7["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model8["modelUrl"]);
|
||||
return model8;
|
||||
log("cached model:", model7["modelUrl"]);
|
||||
return model7;
|
||||
}
|
||||
async function process4(res, outputShape, config3) {
|
||||
if (!res)
|
||||
|
@ -10477,14 +10504,14 @@ async function process4(res, outputShape, config3) {
|
|||
const classVal = detections[0][id][5];
|
||||
const label = labels[classVal].label;
|
||||
const [x, y] = [
|
||||
detections[0][id][0] / inputSize3,
|
||||
detections[0][id][1] / inputSize3
|
||||
detections[0][id][0] / inputSize4,
|
||||
detections[0][id][1] / inputSize4
|
||||
];
|
||||
const boxRaw2 = [
|
||||
x,
|
||||
y,
|
||||
detections[0][id][2] / inputSize3 - x,
|
||||
detections[0][id][3] / inputSize3 - y
|
||||
detections[0][id][2] / inputSize4 - x,
|
||||
detections[0][id][3] / inputSize4 - y
|
||||
];
|
||||
const box5 = [
|
||||
Math.trunc(boxRaw2[0] * outputShape[0]),
|
||||
|
@ -10505,11 +10532,11 @@ async function predict11(input, config3) {
|
|||
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
|
||||
return last4;
|
||||
return new Promise(async (resolve) => {
|
||||
const outputSize2 = [input.shape[2], input.shape[1]];
|
||||
const resize = tf21.image.resizeBilinear(input, [inputSize3, inputSize3]);
|
||||
const objectT = config3.object.enabled ? model8 == null ? void 0 : model8.execute(resize, ["tower_0/detections"]) : null;
|
||||
const outputSize3 = [input.shape[2], input.shape[1]];
|
||||
const resize = tf21.image.resizeBilinear(input, [inputSize4, inputSize4]);
|
||||
const objectT = config3.object.enabled ? model7 == null ? void 0 : model7.execute(resize, ["tower_0/detections"]) : null;
|
||||
tf21.dispose(resize);
|
||||
const obj = await process4(objectT, outputSize2, config3);
|
||||
const obj = await process4(objectT, outputSize3, config3);
|
||||
last4 = obj;
|
||||
resolve(obj);
|
||||
});
|
||||
|
@ -10517,36 +10544,36 @@ async function predict11(input, config3) {
|
|||
|
||||
// src/segmentation/segmentation.ts
|
||||
var tf22 = __toModule(require_tfjs_esm());
|
||||
var model9;
|
||||
var model8;
|
||||
var busy = false;
|
||||
async function load12(config3) {
|
||||
if (!model9 || env.initial) {
|
||||
model9 = await tf22.loadGraphModel(join(config3.modelBasePath, config3.segmentation.modelPath || ""));
|
||||
if (!model9 || !model9["modelUrl"])
|
||||
async function load11(config3) {
|
||||
if (!model8 || env.initial) {
|
||||
model8 = await tf22.loadGraphModel(join(config3.modelBasePath, config3.segmentation.modelPath || ""));
|
||||
if (!model8 || !model8["modelUrl"])
|
||||
log("load model failed:", config3.segmentation.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model9["modelUrl"]);
|
||||
log("load model:", model8["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model9["modelUrl"]);
|
||||
return model9;
|
||||
log("cached model:", model8["modelUrl"]);
|
||||
return model8;
|
||||
}
|
||||
async function process5(input, background, config3) {
|
||||
var _a, _b;
|
||||
if (busy)
|
||||
return { data: [], canvas: null, alpha: null };
|
||||
busy = true;
|
||||
if (!model9)
|
||||
await load12(config3);
|
||||
if (!model8)
|
||||
await load11(config3);
|
||||
const inputImage = process2(input, config3);
|
||||
const width = ((_a = inputImage.canvas) == null ? void 0 : _a.width) || 0;
|
||||
const height = ((_b = inputImage.canvas) == null ? void 0 : _b.height) || 0;
|
||||
if (!inputImage.tensor)
|
||||
return { data: [], canvas: null, alpha: null };
|
||||
const t = {};
|
||||
t.resize = tf22.image.resizeBilinear(inputImage.tensor, [model9.inputs[0].shape ? model9.inputs[0].shape[1] : 0, model9.inputs[0].shape ? model9.inputs[0].shape[2] : 0], false);
|
||||
t.resize = tf22.image.resizeBilinear(inputImage.tensor, [model8.inputs[0].shape ? model8.inputs[0].shape[1] : 0, model8.inputs[0].shape ? model8.inputs[0].shape[2] : 0], false);
|
||||
tf22.dispose(inputImage.tensor);
|
||||
t.norm = tf22.div(t.resize, 255);
|
||||
t.res = model9.predict(t.norm);
|
||||
t.res = model8.predict(t.norm);
|
||||
t.squeeze = tf22.squeeze(t.res, 0);
|
||||
if (t.squeeze.shape[2] === 2) {
|
||||
t.softmax = tf22.softmax(t.squeeze);
|
||||
|
@ -10599,22 +10626,22 @@ async function process5(input, background, config3) {
|
|||
return { data, canvas: mergedCanvas || compositeCanvas, alpha: alphaCanvas };
|
||||
}
|
||||
|
||||
// src/gear/agegenderrace.ts
|
||||
// src/gear/gear-agegenderrace.ts
|
||||
var tf23 = __toModule(require_tfjs_esm());
|
||||
var model10;
|
||||
var model9;
|
||||
var skipped8 = Number.MAX_SAFE_INTEGER;
|
||||
async function load13(config3) {
|
||||
async function load12(config3) {
|
||||
if (env.initial)
|
||||
model10 = null;
|
||||
if (!model10) {
|
||||
model10 = await tf23.loadGraphModel(join(config3.modelBasePath, config3.face.agegenderrace.modelPath));
|
||||
if (!model10 || !model10["modelUrl"])
|
||||
model9 = null;
|
||||
if (!model9) {
|
||||
model9 = await tf23.loadGraphModel(join(config3.modelBasePath, config3.face.agegenderrace.modelPath));
|
||||
if (!model9 || !model9["modelUrl"])
|
||||
log("load model failed:", config3.face.agegenderrace.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model10["modelUrl"]);
|
||||
log("load model:", model9["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model10["modelUrl"]);
|
||||
return model10;
|
||||
log("cached model:", model9["modelUrl"]);
|
||||
return model9;
|
||||
}
|
||||
|
||||
// src/models.ts
|
||||
|
@ -10622,6 +10649,7 @@ var Models = class {
|
|||
constructor() {
|
||||
__publicField(this, "age", null);
|
||||
__publicField(this, "agegenderrace", null);
|
||||
__publicField(this, "blazeposedetect", null);
|
||||
__publicField(this, "blazepose", null);
|
||||
__publicField(this, "centernet", null);
|
||||
__publicField(this, "efficientpose", null);
|
||||
|
@ -10642,11 +10670,11 @@ var Models = class {
|
|||
}
|
||||
};
|
||||
function reset(instance) {
|
||||
for (const model11 of Object.keys(instance.models))
|
||||
instance.models[model11] = null;
|
||||
for (const model10 of Object.keys(instance.models))
|
||||
instance.models[model10] = null;
|
||||
}
|
||||
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;
|
||||
async function load13(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, _B, _C, _D;
|
||||
if (env.initial)
|
||||
reset(instance);
|
||||
if (instance.config.face.enabled) {
|
||||
|
@ -10670,48 +10698,50 @@ async function load14(instance) {
|
|||
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 = load5(instance.config);
|
||||
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 = load8(instance.config);
|
||||
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.blazepose = load7(instance.config);
|
||||
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.efficientpose = load7(instance.config);
|
||||
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);
|
||||
if (instance.config.object.enabled && !instance.models.nanodet && ((_v = (_u = instance.config.object) == null ? void 0 : _u.modelPath) == null ? void 0 : _v.includes("nanodet")))
|
||||
instance.models.nanodet = load10(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")))
|
||||
instance.models.centernet = load11(instance.config);
|
||||
if (instance.config.face.enabled && ((_y = instance.config.face.emotion) == null ? void 0 : _y.enabled) && !instance.models.emotion)
|
||||
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.blazepose = loadPose(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.blazeposedetect && ((_q = instance.config.body.detector) == null ? void 0 : _q.modelPath) && ((_s = (_r = instance.config.body) == null ? void 0 : _r.modelPath) == null ? void 0 : _s.includes("blazepose")))
|
||||
instance.models.blazeposedetect = loadDetect2(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.efficientpose && ((_u = (_t = instance.config.body) == null ? void 0 : _t.modelPath) == null ? void 0 : _u.includes("efficientpose")))
|
||||
instance.models.efficientpose = load7(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.movenet && ((_w = (_v = instance.config.body) == null ? void 0 : _v.modelPath) == null ? void 0 : _w.includes("movenet")))
|
||||
instance.models.movenet = load8(instance.config);
|
||||
if (instance.config.object.enabled && !instance.models.nanodet && ((_y = (_x = instance.config.object) == null ? void 0 : _x.modelPath) == null ? void 0 : _y.includes("nanodet")))
|
||||
instance.models.nanodet = load9(instance.config);
|
||||
if (instance.config.object.enabled && !instance.models.centernet && ((_A = (_z = instance.config.object) == null ? void 0 : _z.modelPath) == null ? void 0 : _A.includes("centernet")))
|
||||
instance.models.centernet = load10(instance.config);
|
||||
if (instance.config.face.enabled && ((_B = instance.config.face.emotion) == null ? void 0 : _B.enabled) && !instance.models.emotion)
|
||||
instance.models.emotion = load4(instance.config);
|
||||
if (instance.config.face.enabled && ((_z = instance.config.face.description) == null ? void 0 : _z.enabled) && !instance.models.faceres)
|
||||
if (instance.config.face.enabled && ((_C = instance.config.face.description) == null ? void 0 : _C.enabled) && !instance.models.faceres)
|
||||
instance.models.faceres = load3(instance.config);
|
||||
if (instance.config.segmentation.enabled && !instance.models.segmentation)
|
||||
instance.models.segmentation = load12(instance.config);
|
||||
if (instance.config.face.enabled && ((_A = instance.config.face["agegenderrace"]) == null ? void 0 : _A.enabled) && !instance.models.agegenderrace)
|
||||
instance.models.agegenderrace = load13(instance.config);
|
||||
for await (const model11 of Object.keys(instance.models)) {
|
||||
if (instance.models[model11] && typeof instance.models[model11] !== "undefined")
|
||||
instance.models[model11] = await instance.models[model11];
|
||||
instance.models.segmentation = load11(instance.config);
|
||||
if (instance.config.face.enabled && ((_D = instance.config.face["agegenderrace"]) == null ? void 0 : _D.enabled) && !instance.models.agegenderrace)
|
||||
instance.models.agegenderrace = load12(instance.config);
|
||||
for await (const model10 of Object.keys(instance.models)) {
|
||||
if (instance.models[model10] && typeof instance.models[model10] !== "undefined")
|
||||
instance.models[model10] = await instance.models[model10];
|
||||
}
|
||||
}
|
||||
async function validate2(instance) {
|
||||
const simpleOps = ["const", "placeholder", "noop", "pad", "squeeze", "add", "sub", "mul", "div"];
|
||||
for (const defined of Object.keys(instance.models)) {
|
||||
if (instance.models[defined]) {
|
||||
let models4 = [];
|
||||
let models5 = [];
|
||||
if (Array.isArray(instance.models[defined])) {
|
||||
models4 = instance.models[defined].filter((model11) => model11 !== null).map((model11) => model11 && model11.executor ? model11 : model11.model);
|
||||
models5 = instance.models[defined].filter((model10) => model10 !== null).map((model10) => model10 && model10.executor ? model10 : model10.model);
|
||||
} else {
|
||||
models4 = [instance.models[defined]];
|
||||
models5 = [instance.models[defined]];
|
||||
}
|
||||
for (const model11 of models4) {
|
||||
if (!model11) {
|
||||
for (const model10 of models5) {
|
||||
if (!model10) {
|
||||
if (instance.config.debug)
|
||||
log("model marked as loaded but not defined:", defined);
|
||||
continue;
|
||||
}
|
||||
const ops = [];
|
||||
const executor = model11 == null ? void 0 : model11.executor;
|
||||
const executor = model10 == null ? void 0 : model10.executor;
|
||||
if (executor && executor.graph.nodes) {
|
||||
for (const kernel of Object.values(executor.graph.nodes)) {
|
||||
const op = kernel.op.toLowerCase();
|
||||
|
@ -10735,7 +10765,7 @@ async function validate2(instance) {
|
|||
}
|
||||
}
|
||||
|
||||
// src/face.ts
|
||||
// src/face/face.ts
|
||||
var tf24 = __toModule(require_tfjs_esm());
|
||||
var calculateGaze = (face5) => {
|
||||
const radians = (pt1, pt2) => Math.atan2(pt1[1] - pt2[1], pt1[0] - pt2[0]);
|
||||
|
@ -11043,7 +11073,7 @@ var hand = (res) => {
|
|||
return gestures;
|
||||
};
|
||||
|
||||
// src/draw.ts
|
||||
// src/util/draw.ts
|
||||
var options2 = {
|
||||
color: "rgba(173, 216, 230, 0.6)",
|
||||
labelColor: "rgba(173, 216, 230, 1)",
|
||||
|
@ -11589,7 +11619,7 @@ function join2(faces, bodies, hands, gestures, shape) {
|
|||
return persons2;
|
||||
}
|
||||
|
||||
// src/interpolate.ts
|
||||
// src/util/interpolate.ts
|
||||
var bufferedResult = { face: [], body: [], hand: [], gesture: [], object: [], persons: [], performance: {}, timestamp: 0 };
|
||||
function calc(newResult) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
||||
|
@ -12636,7 +12666,7 @@ var Human = class {
|
|||
async load(userConfig) {
|
||||
this.state = "load";
|
||||
const timeStamp = now();
|
||||
const count2 = Object.values(this.models).filter((model11) => model11).length;
|
||||
const count2 = Object.values(this.models).filter((model10) => model10).length;
|
||||
if (userConfig)
|
||||
this.config = mergeDeep(this.config, userConfig);
|
||||
if (env.initial) {
|
||||
|
@ -12654,11 +12684,11 @@ var Human = class {
|
|||
log("tf flags:", this.tf.ENV.flags);
|
||||
}
|
||||
}
|
||||
await load14(this);
|
||||
await load13(this);
|
||||
if (env.initial && this.config.debug)
|
||||
log("tf engine state:", this.tf.engine().state.numBytes, "bytes", this.tf.engine().state.numTensors, "tensors");
|
||||
env.initial = false;
|
||||
const loaded = Object.values(this.models).filter((model11) => model11).length;
|
||||
const loaded = Object.values(this.models).filter((model10) => model10).length;
|
||||
if (loaded !== count2) {
|
||||
await validate2(this);
|
||||
this.emit("load");
|
||||
|
|
|
@ -89,7 +89,7 @@ __export(exports, {
|
|||
env: () => env
|
||||
});
|
||||
|
||||
// src/util.ts
|
||||
// src/util/util.ts
|
||||
function join(folder, file) {
|
||||
const separator = folder.endsWith("/") ? "" : "/";
|
||||
const skipJoin = file.startsWith(".") || file.startsWith("/") || file.startsWith("http:") || file.startsWith("https:") || file.startsWith("file:");
|
||||
|
@ -142,31 +142,6 @@ function mergeDeep(...objects) {
|
|||
return prev;
|
||||
}, {});
|
||||
}
|
||||
function scaleBox(keypoints3, boxScaleFact2, outputSize2) {
|
||||
const coords3 = [keypoints3.map((pt) => pt[0]), keypoints3.map((pt) => pt[1])];
|
||||
const maxmin = [Math.max(...coords3[0]), Math.min(...coords3[0]), Math.max(...coords3[1]), Math.min(...coords3[1])];
|
||||
const center = [(maxmin[0] + maxmin[1]) / 2, (maxmin[2] + maxmin[3]) / 2];
|
||||
const diff = Math.max(center[0] - maxmin[1], center[1] - maxmin[3], -center[0] + maxmin[0], -center[1] + maxmin[2]) * boxScaleFact2;
|
||||
const box5 = [
|
||||
Math.trunc(center[0] - diff),
|
||||
Math.trunc(center[1] - diff),
|
||||
Math.trunc(2 * diff),
|
||||
Math.trunc(2 * diff)
|
||||
];
|
||||
const boxRaw2 = [
|
||||
box5[0] / outputSize2[0],
|
||||
box5[1] / outputSize2[1],
|
||||
box5[2] / outputSize2[0],
|
||||
box5[3] / outputSize2[1]
|
||||
];
|
||||
const yxBox = [
|
||||
boxRaw2[1],
|
||||
boxRaw2[0],
|
||||
boxRaw2[3] + boxRaw2[1],
|
||||
boxRaw2[2] + boxRaw2[0]
|
||||
];
|
||||
return { box: box5, boxRaw: boxRaw2, yxBox };
|
||||
}
|
||||
|
||||
// src/config.ts
|
||||
var config = {
|
||||
|
@ -236,6 +211,9 @@ var config = {
|
|||
body: {
|
||||
enabled: true,
|
||||
modelPath: "movenet-lightning.json",
|
||||
detector: {
|
||||
modelPath: ""
|
||||
},
|
||||
maxDetected: -1,
|
||||
minConfidence: 0.2,
|
||||
skipFrames: 1
|
||||
|
@ -403,13 +381,13 @@ function rotatePoint(homogeneousCoordinate, rotationMatrix) {
|
|||
dot(homogeneousCoordinate, rotationMatrix[1])
|
||||
];
|
||||
}
|
||||
function generateAnchors(inputSize4) {
|
||||
const spec = { strides: [inputSize4 / 16, inputSize4 / 8], anchors: [2, 6] };
|
||||
function generateAnchors(inputSize5) {
|
||||
const spec = { strides: [inputSize5 / 16, inputSize5 / 8], anchors: [2, 6] };
|
||||
const anchors3 = [];
|
||||
for (let i = 0; i < spec.strides.length; i++) {
|
||||
const stride = spec.strides[i];
|
||||
const gridRows = Math.floor((inputSize4 + stride - 1) / stride);
|
||||
const gridCols = Math.floor((inputSize4 + stride - 1) / stride);
|
||||
const gridRows = Math.floor((inputSize5 + stride - 1) / stride);
|
||||
const gridCols = Math.floor((inputSize5 + stride - 1) / stride);
|
||||
const anchorsNum = spec.anchors[i];
|
||||
for (let gridY = 0; gridY < gridRows; gridY++) {
|
||||
const anchorY = stride * (gridY + 0.5);
|
||||
|
@ -426,31 +404,31 @@ function generateAnchors(inputSize4) {
|
|||
|
||||
// src/blazeface/blazeface.ts
|
||||
var keypointsCount = 6;
|
||||
function decodeBounds(boxOutputs, anchors3, inputSize4) {
|
||||
function decodeBounds(boxOutputs, anchors3, inputSize5) {
|
||||
const boxStarts = tf2.slice(boxOutputs, [0, 1], [-1, 2]);
|
||||
const centers = tf2.add(boxStarts, anchors3);
|
||||
const boxSizes = tf2.slice(boxOutputs, [0, 3], [-1, 2]);
|
||||
const boxSizesNormalized = tf2.div(boxSizes, inputSize4);
|
||||
const centersNormalized = tf2.div(centers, inputSize4);
|
||||
const boxSizesNormalized = tf2.div(boxSizes, inputSize5);
|
||||
const centersNormalized = tf2.div(centers, inputSize5);
|
||||
const halfBoxSize = tf2.div(boxSizesNormalized, 2);
|
||||
const starts = tf2.sub(centersNormalized, halfBoxSize);
|
||||
const ends = tf2.add(centersNormalized, halfBoxSize);
|
||||
const startNormalized = tf2.mul(starts, inputSize4);
|
||||
const endNormalized = tf2.mul(ends, inputSize4);
|
||||
const startNormalized = tf2.mul(starts, inputSize5);
|
||||
const endNormalized = tf2.mul(ends, inputSize5);
|
||||
const concatAxis = 1;
|
||||
return tf2.concat2d([startNormalized, endNormalized], concatAxis);
|
||||
}
|
||||
var BlazeFaceModel = class {
|
||||
constructor(model11, config3) {
|
||||
constructor(model10, config3) {
|
||||
__publicField(this, "model");
|
||||
__publicField(this, "anchorsData");
|
||||
__publicField(this, "anchors");
|
||||
__publicField(this, "inputSize");
|
||||
__publicField(this, "config");
|
||||
this.model = model11;
|
||||
this.anchorsData = generateAnchors(model11.inputs[0].shape[1]);
|
||||
this.model = model10;
|
||||
this.anchorsData = generateAnchors(model10.inputs[0].shape[1]);
|
||||
this.anchors = tf2.tensor2d(this.anchorsData);
|
||||
this.inputSize = model11.inputs[0].shape[2];
|
||||
this.inputSize = model10.inputs[0].shape[2];
|
||||
this.config = config3;
|
||||
}
|
||||
async getBoundingBoxes(inputImage, userConfig) {
|
||||
|
@ -502,12 +480,12 @@ var BlazeFaceModel = class {
|
|||
};
|
||||
async function load(config3) {
|
||||
var _a, _b, _c;
|
||||
const model11 = await tf2.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);
|
||||
if (!model11 || !model11.modelUrl)
|
||||
const model10 = await tf2.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(model10, config3);
|
||||
if (!model10 || !model10.modelUrl)
|
||||
log("load model failed:", ((_c = config3.face.detector) == null ? void 0 : _c.modelPath) || "");
|
||||
else if (config3.debug)
|
||||
log("load model:", model11.modelUrl);
|
||||
log("load model:", model10.modelUrl);
|
||||
return blazeFace;
|
||||
}
|
||||
|
||||
|
@ -3783,7 +3761,7 @@ var UV68 = VTX68.map((x) => UV468[x]);
|
|||
var UV33 = VTX33.map((x) => UV468[x]);
|
||||
var UV7 = VTX7.map((x) => UV468[x]);
|
||||
|
||||
// src/env.ts
|
||||
// src/util/env.ts
|
||||
var tf4 = __toModule(require_tfjs_esm());
|
||||
|
||||
// src/image/image.ts
|
||||
|
@ -4703,7 +4681,7 @@ async function skip(config3, input) {
|
|||
return skipFrame;
|
||||
}
|
||||
|
||||
// src/env.ts
|
||||
// src/util/env.ts
|
||||
var env = {
|
||||
browser: void 0,
|
||||
node: void 0,
|
||||
|
@ -5164,7 +5142,7 @@ async function load2(config3) {
|
|||
var triangulation = TRI468;
|
||||
var uvmap = UV468;
|
||||
|
||||
// src/faceres/faceres.ts
|
||||
// src/face/faceres.ts
|
||||
var tf7 = __toModule(require_tfjs_esm());
|
||||
var model;
|
||||
var last = [];
|
||||
|
@ -5268,7 +5246,7 @@ async function predict2(image24, config3, idx, count2) {
|
|||
});
|
||||
}
|
||||
|
||||
// src/emotion/emotion.ts
|
||||
// src/gear/emotion.ts
|
||||
var tf8 = __toModule(require_tfjs_esm());
|
||||
var annotations = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"];
|
||||
var model2;
|
||||
|
@ -8689,14 +8667,14 @@ var anchors = [
|
|||
|
||||
// src/handpose/handdetector.ts
|
||||
var HandDetector = class {
|
||||
constructor(model11) {
|
||||
constructor(model10) {
|
||||
__publicField(this, "model");
|
||||
__publicField(this, "anchors");
|
||||
__publicField(this, "anchorsTensor");
|
||||
__publicField(this, "inputSize");
|
||||
__publicField(this, "inputSizeTensor");
|
||||
__publicField(this, "doubleInputSizeTensor");
|
||||
this.model = model11;
|
||||
this.model = model10;
|
||||
this.anchors = anchors.map((anchor) => [anchor.x, anchor.y]);
|
||||
this.anchorsTensor = tf11.tensor2d(this.anchors);
|
||||
this.inputSize = this.model && this.model.inputs && this.model.inputs[0].shape ? this.model.inputs[0].shape[2] : 0;
|
||||
|
@ -9455,7 +9433,34 @@ async function load6(config3) {
|
|||
return [handDetectorModel, handPoseModel];
|
||||
}
|
||||
|
||||
// src/handtrack/handtrack.ts
|
||||
// src/util/box.ts
|
||||
function scale(keypoints3, boxScaleFact2, outputSize3) {
|
||||
const coords3 = [keypoints3.map((pt) => pt[0]), keypoints3.map((pt) => pt[1])];
|
||||
const maxmin = [Math.max(...coords3[0]), Math.min(...coords3[0]), Math.max(...coords3[1]), Math.min(...coords3[1])];
|
||||
const center = [(maxmin[0] + maxmin[1]) / 2, (maxmin[2] + maxmin[3]) / 2];
|
||||
const diff = Math.max(center[0] - maxmin[1], center[1] - maxmin[3], -center[0] + maxmin[0], -center[1] + maxmin[2]) * boxScaleFact2;
|
||||
const box5 = [
|
||||
Math.trunc(center[0] - diff),
|
||||
Math.trunc(center[1] - diff),
|
||||
Math.trunc(2 * diff),
|
||||
Math.trunc(2 * diff)
|
||||
];
|
||||
const boxRaw2 = [
|
||||
box5[0] / outputSize3[0],
|
||||
box5[1] / outputSize3[1],
|
||||
box5[2] / outputSize3[0],
|
||||
box5[3] / outputSize3[1]
|
||||
];
|
||||
const yxBox = [
|
||||
boxRaw2[1],
|
||||
boxRaw2[0],
|
||||
boxRaw2[3] + boxRaw2[1],
|
||||
boxRaw2[2] + boxRaw2[0]
|
||||
];
|
||||
return { box: box5, boxRaw: boxRaw2, yxBox };
|
||||
}
|
||||
|
||||
// src/hand/handtrack.ts
|
||||
var tf16 = __toModule(require_tfjs_esm());
|
||||
|
||||
// src/tfjs/humangl.ts
|
||||
|
@ -9662,7 +9667,7 @@ function fakeOps(kernelNames, config3) {
|
|||
env.kernels = tf15.getKernelsForBackend(tf15.getBackend()).map((kernel) => kernel.kernelName.toLowerCase());
|
||||
}
|
||||
|
||||
// src/handtrack/handtrack.ts
|
||||
// src/hand/handtrack.ts
|
||||
var boxScaleFact = 1.5;
|
||||
var models2 = [null, null];
|
||||
var modelOutputNodes = ["StatefulPartitionedCall/Postprocessor/Slice", "StatefulPartitionedCall/Postprocessor/ExpandDims_1"];
|
||||
|
@ -9800,7 +9805,7 @@ async function detectFingers(input, h, config3) {
|
|||
h.box[3] * coord[1] / inputSize[1][1] + h.box[1],
|
||||
(h.box[2] + h.box[3]) / 2 / inputSize[1][0] * coord[2]
|
||||
]);
|
||||
const updatedBox = scaleBox(hand3.keypoints, boxScaleFact, outputSize);
|
||||
const updatedBox = scale(hand3.keypoints, boxScaleFact, outputSize);
|
||||
h.box = updatedBox.box;
|
||||
h.boxRaw = updatedBox.boxRaw;
|
||||
h.yxBox = updatedBox.yxBox;
|
||||
|
@ -9837,10 +9842,10 @@ async function predict6(input, config3) {
|
|||
return hands;
|
||||
}
|
||||
|
||||
// src/blazepose/blazepose.ts
|
||||
// src/body/blazepose.ts
|
||||
var tf17 = __toModule(require_tfjs_esm());
|
||||
|
||||
// src/blazepose/annotations.ts
|
||||
// src/body/annotations.ts
|
||||
var full = [
|
||||
"nose",
|
||||
"leftEyeInside",
|
||||
|
@ -9916,57 +9921,71 @@ var upper = [
|
|||
"right:30"
|
||||
];
|
||||
|
||||
// src/blazepose/blazepose.ts
|
||||
var model4;
|
||||
async function load7(config3) {
|
||||
// src/body/blazepose.ts
|
||||
var models3 = [null, null];
|
||||
var outputNodes = ["ld_3d", "activation_segmentation", "activation_heatmap", "world_3d", "output_poseflag"];
|
||||
var inputSize2 = [[0, 0], [0, 0]];
|
||||
var outputSize2 = [0, 0];
|
||||
async function loadDetect2(config3) {
|
||||
var _a;
|
||||
if (env.initial)
|
||||
model4 = null;
|
||||
if (!model4) {
|
||||
model4 = await tf17.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
model4["width"] = parseInt(model4["signature"].inputs["input_1:0"].tensorShape.dim[2].size);
|
||||
model4["height"] = parseInt(model4["signature"].inputs["input_1:0"].tensorShape.dim[1].size);
|
||||
if (!model4 || !model4["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
models3[0] = null;
|
||||
if (!models3[0]) {
|
||||
models3[0] = await tf17.loadGraphModel(join(config3.modelBasePath, ((_a = config3.body.detector) == null ? void 0 : _a.modelPath) || ""));
|
||||
const inputs = Object.values(models3[0].modelSignature["inputs"]);
|
||||
inputSize2[0][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
|
||||
inputSize2[0][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!models3[0] || !models3[0]["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model4["modelUrl"]);
|
||||
log("load model:", models3[0]["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model4["modelUrl"]);
|
||||
return model4;
|
||||
log("cached model:", models3[0]["modelUrl"]);
|
||||
return models3[0];
|
||||
}
|
||||
async function predict7(image24, config3) {
|
||||
if (!model4)
|
||||
return [];
|
||||
if (!config3.body.enabled)
|
||||
return [];
|
||||
const imgSize = { width: image24.shape[2] || 0, height: image24.shape[1] || 0 };
|
||||
const resize = tf17.image.resizeBilinear(image24, [model4["width"], model4["height"]], false);
|
||||
const normalize = tf17.div(resize, [255]);
|
||||
tf17.dispose(resize);
|
||||
const resT = await model4.predict(normalize);
|
||||
const findT = resT.find((t) => t.size === 195 || t.size === 155);
|
||||
const points = await (findT == null ? void 0 : findT.data()) || [];
|
||||
resT.forEach((t) => tf17.dispose(t));
|
||||
tf17.dispose(normalize);
|
||||
async function loadPose(config3) {
|
||||
if (env.initial)
|
||||
models3[1] = null;
|
||||
if (!models3[1]) {
|
||||
models3[1] = await tf17.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
const inputs = Object.values(models3[1].modelSignature["inputs"]);
|
||||
inputSize2[1][0] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[1].size) : 0;
|
||||
inputSize2[1][1] = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!models3[1] || !models3[1]["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", models3[1]["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", models3[1]["modelUrl"]);
|
||||
return models3[1];
|
||||
}
|
||||
async function detectParts(input, config3) {
|
||||
var _a;
|
||||
const t = {};
|
||||
t.resize = tf17.image.resizeBilinear(input, [inputSize2[1][0], inputSize2[1][1]]);
|
||||
[t.ld, t.segmentation, t.heatmap, t.world, t.poseflag] = await ((_a = models3[1]) == null ? void 0 : _a.execute(t.resize, outputNodes));
|
||||
const points = await t.ld.data();
|
||||
const keypoints3 = [];
|
||||
const labels2 = (points == null ? void 0 : points.length) === 195 ? full : upper;
|
||||
const depth = 5;
|
||||
for (let i = 0; i < points.length / depth; i++) {
|
||||
keypoints3.push({
|
||||
id: i,
|
||||
part: labels2[i],
|
||||
position: [
|
||||
Math.trunc(imgSize.width * points[depth * i + 0] / 255),
|
||||
Math.trunc(imgSize.height * points[depth * i + 1] / 255),
|
||||
Math.trunc(points[depth * i + 2]) + 0
|
||||
],
|
||||
positionRaw: [
|
||||
points[depth * i + 0] / 255,
|
||||
points[depth * i + 1] / 255,
|
||||
points[depth * i + 2] + 0
|
||||
],
|
||||
score: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100,
|
||||
presence: (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 4])))) / 100
|
||||
});
|
||||
const score3 = (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100;
|
||||
if (score3 > (config3.body.minConfidence || 0)) {
|
||||
keypoints3.push({
|
||||
part: labels2[i],
|
||||
position: [
|
||||
Math.trunc(outputSize2[0] * points[depth * i + 0] / 255),
|
||||
Math.trunc(outputSize2[1] * points[depth * i + 1] / 255),
|
||||
Math.trunc(points[depth * i + 2]) + 0
|
||||
],
|
||||
positionRaw: [
|
||||
points[depth * i + 0] / 255,
|
||||
points[depth * i + 1] / 255,
|
||||
points[depth * i + 2] + 0
|
||||
],
|
||||
score: score3
|
||||
});
|
||||
}
|
||||
}
|
||||
const x = keypoints3.map((a) => a.position[0]);
|
||||
const y = keypoints3.map((a) => a.position[1]);
|
||||
|
@ -9978,30 +9997,38 @@ async function predict7(image24, config3) {
|
|||
];
|
||||
const boxRaw2 = [0, 0, 0, 0];
|
||||
const score2 = keypoints3.reduce((prev, curr) => curr.score > prev ? curr.score : prev, 0);
|
||||
return [{ id: 0, score: score2, box: box5, boxRaw: boxRaw2, keypoints: keypoints3 }];
|
||||
Object.keys(t).forEach((tensor3) => tf17.dispose(t[tensor3]));
|
||||
return { id: 0, score: score2, box: box5, boxRaw: boxRaw2, keypoints: keypoints3 };
|
||||
}
|
||||
async function predict7(input, config3) {
|
||||
outputSize2 = [input.shape[2] || 0, input.shape[1] || 0];
|
||||
const bodies = [];
|
||||
const body4 = await detectParts(input, config3);
|
||||
bodies.push(body4);
|
||||
return bodies;
|
||||
}
|
||||
|
||||
// src/efficientpose/efficientpose.ts
|
||||
// src/body/efficientpose.ts
|
||||
var tf18 = __toModule(require_tfjs_esm());
|
||||
var model5;
|
||||
var model4;
|
||||
var keypoints = [];
|
||||
var box4 = [0, 0, 0, 0];
|
||||
var boxRaw = [0, 0, 0, 0];
|
||||
var score = 0;
|
||||
var skipped4 = Number.MAX_SAFE_INTEGER;
|
||||
var bodyParts = ["head", "neck", "rightShoulder", "rightElbow", "rightWrist", "chest", "leftShoulder", "leftElbow", "leftWrist", "pelvis", "rightHip", "rightKnee", "rightAnkle", "leftHip", "leftKnee", "leftAnkle"];
|
||||
async function load8(config3) {
|
||||
async function load7(config3) {
|
||||
if (env.initial)
|
||||
model5 = null;
|
||||
if (!model5) {
|
||||
model5 = await tf18.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model5 || !model5["modelUrl"])
|
||||
model4 = null;
|
||||
if (!model4) {
|
||||
model4 = await tf18.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model4 || !model4["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model5["modelUrl"]);
|
||||
log("load model:", model4["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model5["modelUrl"]);
|
||||
return model5;
|
||||
log("cached model:", model4["modelUrl"]);
|
||||
return model4;
|
||||
}
|
||||
function max2d(inputs, minScore) {
|
||||
const [width, height] = inputs.shape;
|
||||
|
@ -10028,16 +10055,16 @@ async function predict8(image24, config3) {
|
|||
return new Promise(async (resolve) => {
|
||||
var _a2;
|
||||
const tensor3 = tf18.tidy(() => {
|
||||
if (!(model5 == null ? void 0 : model5.inputs[0].shape))
|
||||
if (!(model4 == null ? void 0 : model4.inputs[0].shape))
|
||||
return null;
|
||||
const resize = tf18.image.resizeBilinear(image24, [model5.inputs[0].shape[2], model5.inputs[0].shape[1]], false);
|
||||
const resize = tf18.image.resizeBilinear(image24, [model4.inputs[0].shape[2], model4.inputs[0].shape[1]], false);
|
||||
const enhance2 = tf18.mul(resize, 2);
|
||||
const norm = enhance2.sub(1);
|
||||
return norm;
|
||||
});
|
||||
let resT;
|
||||
if (config3.body.enabled)
|
||||
resT = await (model5 == null ? void 0 : model5.predict(tensor3));
|
||||
resT = await (model4 == null ? void 0 : model4.predict(tensor3));
|
||||
tf18.dispose(tensor3);
|
||||
if (resT) {
|
||||
keypoints.length = 0;
|
||||
|
@ -10052,12 +10079,12 @@ async function predict8(image24, config3) {
|
|||
score: Math.round(100 * partScore) / 100,
|
||||
part: bodyParts[id],
|
||||
positionRaw: [
|
||||
x2 / model5.inputs[0].shape[2],
|
||||
y2 / model5.inputs[0].shape[1]
|
||||
x2 / model4.inputs[0].shape[2],
|
||||
y2 / model4.inputs[0].shape[1]
|
||||
],
|
||||
position: [
|
||||
Math.round(image24.shape[2] * x2 / model5.inputs[0].shape[2]),
|
||||
Math.round(image24.shape[1] * y2 / model5.inputs[0].shape[1])
|
||||
Math.round(image24.shape[2] * x2 / model4.inputs[0].shape[2]),
|
||||
Math.round(image24.shape[1] * y2 / model4.inputs[0].shape[1])
|
||||
]
|
||||
});
|
||||
}
|
||||
|
@ -10085,30 +10112,30 @@ async function predict8(image24, config3) {
|
|||
});
|
||||
}
|
||||
|
||||
// src/movenet/movenet.ts
|
||||
// src/body/movenet.ts
|
||||
var tf19 = __toModule(require_tfjs_esm());
|
||||
var model6;
|
||||
var inputSize2 = 0;
|
||||
var model5;
|
||||
var inputSize3 = 0;
|
||||
var cachedBoxes = [];
|
||||
var skipped5 = Number.MAX_SAFE_INTEGER;
|
||||
var keypoints2 = [];
|
||||
var bodyParts2 = ["nose", "leftEye", "rightEye", "leftEar", "rightEar", "leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee", "leftAnkle", "rightAnkle"];
|
||||
async function load9(config3) {
|
||||
async function load8(config3) {
|
||||
if (env.initial)
|
||||
model6 = null;
|
||||
if (!model6) {
|
||||
model5 = null;
|
||||
if (!model5) {
|
||||
fakeOps(["size"], config3);
|
||||
model6 = await tf19.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model6 || !model6["modelUrl"])
|
||||
model5 = await tf19.loadGraphModel(join(config3.modelBasePath, config3.body.modelPath || ""));
|
||||
if (!model5 || !model5["modelUrl"])
|
||||
log("load model failed:", config3.body.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model6["modelUrl"]);
|
||||
log("load model:", model5["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model6["modelUrl"]);
|
||||
inputSize2 = model6.inputs[0].shape ? model6.inputs[0].shape[2] : 0;
|
||||
if (inputSize2 === -1)
|
||||
inputSize2 = 256;
|
||||
return model6;
|
||||
log("cached model:", model5["modelUrl"]);
|
||||
inputSize3 = model5.inputs[0].shape ? model5.inputs[0].shape[2] : 0;
|
||||
if (inputSize3 === -1)
|
||||
inputSize3 = 256;
|
||||
return model5;
|
||||
}
|
||||
async function parseSinglePose(res, config3, image24, inputBox) {
|
||||
const kpt3 = res[0][0];
|
||||
|
@ -10193,7 +10220,7 @@ async function parseMultiPose(res, config3, image24, inputBox) {
|
|||
return bodies;
|
||||
}
|
||||
async function predict9(input, config3) {
|
||||
if (!model6 || !(model6 == null ? void 0 : model6.inputs[0].shape))
|
||||
if (!model5 || !(model5 == null ? void 0 : model5.inputs[0].shape))
|
||||
return [];
|
||||
return new Promise(async (resolve) => {
|
||||
const t = {};
|
||||
|
@ -10202,18 +10229,18 @@ async function predict9(input, config3) {
|
|||
cachedBoxes.length = 0;
|
||||
skipped5++;
|
||||
for (let i = 0; i < cachedBoxes.length; i++) {
|
||||
t.crop = tf19.image.cropAndResize(input, [cachedBoxes[i]], [0], [inputSize2, inputSize2], "bilinear");
|
||||
t.crop = tf19.image.cropAndResize(input, [cachedBoxes[i]], [0], [inputSize3, inputSize3], "bilinear");
|
||||
t.cast = tf19.cast(t.crop, "int32");
|
||||
t.res = await (model6 == null ? void 0 : model6.predict(t.cast));
|
||||
t.res = await (model5 == null ? void 0 : model5.predict(t.cast));
|
||||
const res = await t.res.array();
|
||||
const newBodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, cachedBoxes[i]) : await parseMultiPose(res, config3, input, cachedBoxes[i]);
|
||||
bodies = bodies.concat(newBodies);
|
||||
Object.keys(t).forEach((tensor3) => tf19.dispose(t[tensor3]));
|
||||
}
|
||||
if (bodies.length !== config3.body.maxDetected && skipped5 > (config3.body.skipFrames || 0)) {
|
||||
t.resized = tf19.image.resizeBilinear(input, [inputSize2, inputSize2], false);
|
||||
t.resized = tf19.image.resizeBilinear(input, [inputSize3, inputSize3], false);
|
||||
t.cast = tf19.cast(t.resized, "int32");
|
||||
t.res = await (model6 == null ? void 0 : model6.predict(t.cast));
|
||||
t.res = await (model5 == null ? void 0 : model5.predict(t.cast));
|
||||
const res = await t.res.array();
|
||||
bodies = t.res.shape[2] === 17 ? await parseSinglePose(res, config3, input, [0, 0, 1, 1]) : await parseMultiPose(res, config3, input, [0, 0, 1, 1]);
|
||||
Object.keys(t).forEach((tensor3) => tf19.dispose(t[tensor3]));
|
||||
|
@ -10225,7 +10252,7 @@ async function predict9(input, config3) {
|
|||
for (let i = 0; i < bodies.length; i++) {
|
||||
if (bodies[i].keypoints.length > 10) {
|
||||
const kpts = bodies[i].keypoints.map((kpt3) => kpt3.position);
|
||||
const newBox = scaleBox(kpts, 1.5, [input.shape[2], input.shape[1]]);
|
||||
const newBox = scale(kpts, 1.5, [input.shape[2], input.shape[1]]);
|
||||
cachedBoxes.push([...newBox.yxBox]);
|
||||
}
|
||||
}
|
||||
|
@ -10322,26 +10349,26 @@ var labels = [
|
|||
];
|
||||
|
||||
// src/object/nanodet.ts
|
||||
var model7;
|
||||
var model6;
|
||||
var last3 = [];
|
||||
var skipped6 = Number.MAX_SAFE_INTEGER;
|
||||
var scaleBox2 = 2.5;
|
||||
async function load10(config3) {
|
||||
if (!model7 || env.initial) {
|
||||
model7 = await tf20.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model7.modelSignature["inputs"]);
|
||||
model7.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;
|
||||
if (!model7.inputSize)
|
||||
var scaleBox = 2.5;
|
||||
async function load9(config3) {
|
||||
if (!model6 || env.initial) {
|
||||
model6 = await tf20.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model6.modelSignature["inputs"]);
|
||||
model6.inputSize = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : null;
|
||||
if (!model6.inputSize)
|
||||
throw new Error(`cannot determine model inputSize: ${config3.object.modelPath}`);
|
||||
if (!model7 || !model7.modelUrl)
|
||||
if (!model6 || !model6.modelUrl)
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model7.modelUrl);
|
||||
log("load model:", model6.modelUrl);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model7.modelUrl);
|
||||
return model7;
|
||||
log("cached model:", model6.modelUrl);
|
||||
return model6;
|
||||
}
|
||||
async function process3(res, inputSize4, outputShape, config3) {
|
||||
async function process3(res, inputSize5, outputShape, config3) {
|
||||
let id = 0;
|
||||
let results = [];
|
||||
for (const strideSize of [1, 2, 4]) {
|
||||
|
@ -10359,14 +10386,14 @@ async function process3(res, inputSize4, outputShape, config3) {
|
|||
if (score2 > config3.object.minConfidence && j !== 61) {
|
||||
const cx = (0.5 + Math.trunc(i % baseSize)) / baseSize;
|
||||
const cy = (0.5 + Math.trunc(i / baseSize)) / baseSize;
|
||||
const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize4));
|
||||
const boxOffset = boxIdx[i].map((a) => a * (baseSize / strideSize / inputSize5));
|
||||
const [x, y] = [
|
||||
cx - scaleBox2 / strideSize * boxOffset[0],
|
||||
cy - scaleBox2 / strideSize * boxOffset[1]
|
||||
cx - scaleBox / strideSize * boxOffset[0],
|
||||
cy - scaleBox / strideSize * boxOffset[1]
|
||||
];
|
||||
const [w, h] = [
|
||||
cx + scaleBox2 / strideSize * boxOffset[2] - x,
|
||||
cy + scaleBox2 / strideSize * boxOffset[3] - y
|
||||
cx + scaleBox / strideSize * boxOffset[2] - x,
|
||||
cy + scaleBox / strideSize * boxOffset[3] - y
|
||||
];
|
||||
let boxRaw2 = [x, y, w, h];
|
||||
boxRaw2 = boxRaw2.map((a) => Math.max(0, Math.min(a, 1)));
|
||||
|
@ -10411,17 +10438,17 @@ async function predict10(image24, config3) {
|
|||
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
|
||||
return last3;
|
||||
return new Promise(async (resolve) => {
|
||||
const outputSize2 = [image24.shape[2], image24.shape[1]];
|
||||
const resize = tf20.image.resizeBilinear(image24, [model7.inputSize, model7.inputSize], false);
|
||||
const outputSize3 = [image24.shape[2], image24.shape[1]];
|
||||
const resize = tf20.image.resizeBilinear(image24, [model6.inputSize, model6.inputSize], false);
|
||||
const norm = tf20.div(resize, 255);
|
||||
const transpose = norm.transpose([0, 3, 1, 2]);
|
||||
tf20.dispose(norm);
|
||||
tf20.dispose(resize);
|
||||
let objectT;
|
||||
if (config3.object.enabled)
|
||||
objectT = await model7.predict(transpose);
|
||||
objectT = await model6.predict(transpose);
|
||||
tf20.dispose(transpose);
|
||||
const obj = await process3(objectT, model7.inputSize, outputSize2, config3);
|
||||
const obj = await process3(objectT, model6.inputSize, outputSize3, config3);
|
||||
last3 = obj;
|
||||
resolve(obj);
|
||||
});
|
||||
|
@ -10429,25 +10456,25 @@ async function predict10(image24, config3) {
|
|||
|
||||
// src/object/centernet.ts
|
||||
var tf21 = __toModule(require_tfjs_esm());
|
||||
var model8;
|
||||
var inputSize3 = 0;
|
||||
var model7;
|
||||
var inputSize4 = 0;
|
||||
var last4 = [];
|
||||
var skipped7 = Number.MAX_SAFE_INTEGER;
|
||||
async function load11(config3) {
|
||||
async function load10(config3) {
|
||||
if (env.initial)
|
||||
model8 = null;
|
||||
if (!model8) {
|
||||
model7 = null;
|
||||
if (!model7) {
|
||||
fakeOps(["floormod"], config3);
|
||||
model8 = await tf21.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model8.modelSignature["inputs"]);
|
||||
inputSize3 = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!model8 || !model8["modelUrl"])
|
||||
model7 = await tf21.loadGraphModel(join(config3.modelBasePath, config3.object.modelPath || ""));
|
||||
const inputs = Object.values(model7.modelSignature["inputs"]);
|
||||
inputSize4 = Array.isArray(inputs) ? parseInt(inputs[0].tensorShape.dim[2].size) : 0;
|
||||
if (!model7 || !model7["modelUrl"])
|
||||
log("load model failed:", config3.object.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model8["modelUrl"]);
|
||||
log("load model:", model7["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model8["modelUrl"]);
|
||||
return model8;
|
||||
log("cached model:", model7["modelUrl"]);
|
||||
return model7;
|
||||
}
|
||||
async function process4(res, outputShape, config3) {
|
||||
if (!res)
|
||||
|
@ -10476,14 +10503,14 @@ async function process4(res, outputShape, config3) {
|
|||
const classVal = detections[0][id][5];
|
||||
const label = labels[classVal].label;
|
||||
const [x, y] = [
|
||||
detections[0][id][0] / inputSize3,
|
||||
detections[0][id][1] / inputSize3
|
||||
detections[0][id][0] / inputSize4,
|
||||
detections[0][id][1] / inputSize4
|
||||
];
|
||||
const boxRaw2 = [
|
||||
x,
|
||||
y,
|
||||
detections[0][id][2] / inputSize3 - x,
|
||||
detections[0][id][3] / inputSize3 - y
|
||||
detections[0][id][2] / inputSize4 - x,
|
||||
detections[0][id][3] / inputSize4 - y
|
||||
];
|
||||
const box5 = [
|
||||
Math.trunc(boxRaw2[0] * outputShape[0]),
|
||||
|
@ -10504,11 +10531,11 @@ async function predict11(input, config3) {
|
|||
if (!env.kernels.includes("mod") || !env.kernels.includes("sparsetodense"))
|
||||
return last4;
|
||||
return new Promise(async (resolve) => {
|
||||
const outputSize2 = [input.shape[2], input.shape[1]];
|
||||
const resize = tf21.image.resizeBilinear(input, [inputSize3, inputSize3]);
|
||||
const objectT = config3.object.enabled ? model8 == null ? void 0 : model8.execute(resize, ["tower_0/detections"]) : null;
|
||||
const outputSize3 = [input.shape[2], input.shape[1]];
|
||||
const resize = tf21.image.resizeBilinear(input, [inputSize4, inputSize4]);
|
||||
const objectT = config3.object.enabled ? model7 == null ? void 0 : model7.execute(resize, ["tower_0/detections"]) : null;
|
||||
tf21.dispose(resize);
|
||||
const obj = await process4(objectT, outputSize2, config3);
|
||||
const obj = await process4(objectT, outputSize3, config3);
|
||||
last4 = obj;
|
||||
resolve(obj);
|
||||
});
|
||||
|
@ -10516,36 +10543,36 @@ async function predict11(input, config3) {
|
|||
|
||||
// src/segmentation/segmentation.ts
|
||||
var tf22 = __toModule(require_tfjs_esm());
|
||||
var model9;
|
||||
var model8;
|
||||
var busy = false;
|
||||
async function load12(config3) {
|
||||
if (!model9 || env.initial) {
|
||||
model9 = await tf22.loadGraphModel(join(config3.modelBasePath, config3.segmentation.modelPath || ""));
|
||||
if (!model9 || !model9["modelUrl"])
|
||||
async function load11(config3) {
|
||||
if (!model8 || env.initial) {
|
||||
model8 = await tf22.loadGraphModel(join(config3.modelBasePath, config3.segmentation.modelPath || ""));
|
||||
if (!model8 || !model8["modelUrl"])
|
||||
log("load model failed:", config3.segmentation.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model9["modelUrl"]);
|
||||
log("load model:", model8["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model9["modelUrl"]);
|
||||
return model9;
|
||||
log("cached model:", model8["modelUrl"]);
|
||||
return model8;
|
||||
}
|
||||
async function process5(input, background, config3) {
|
||||
var _a, _b;
|
||||
if (busy)
|
||||
return { data: [], canvas: null, alpha: null };
|
||||
busy = true;
|
||||
if (!model9)
|
||||
await load12(config3);
|
||||
if (!model8)
|
||||
await load11(config3);
|
||||
const inputImage = process2(input, config3);
|
||||
const width = ((_a = inputImage.canvas) == null ? void 0 : _a.width) || 0;
|
||||
const height = ((_b = inputImage.canvas) == null ? void 0 : _b.height) || 0;
|
||||
if (!inputImage.tensor)
|
||||
return { data: [], canvas: null, alpha: null };
|
||||
const t = {};
|
||||
t.resize = tf22.image.resizeBilinear(inputImage.tensor, [model9.inputs[0].shape ? model9.inputs[0].shape[1] : 0, model9.inputs[0].shape ? model9.inputs[0].shape[2] : 0], false);
|
||||
t.resize = tf22.image.resizeBilinear(inputImage.tensor, [model8.inputs[0].shape ? model8.inputs[0].shape[1] : 0, model8.inputs[0].shape ? model8.inputs[0].shape[2] : 0], false);
|
||||
tf22.dispose(inputImage.tensor);
|
||||
t.norm = tf22.div(t.resize, 255);
|
||||
t.res = model9.predict(t.norm);
|
||||
t.res = model8.predict(t.norm);
|
||||
t.squeeze = tf22.squeeze(t.res, 0);
|
||||
if (t.squeeze.shape[2] === 2) {
|
||||
t.softmax = tf22.softmax(t.squeeze);
|
||||
|
@ -10598,22 +10625,22 @@ async function process5(input, background, config3) {
|
|||
return { data, canvas: mergedCanvas || compositeCanvas, alpha: alphaCanvas };
|
||||
}
|
||||
|
||||
// src/gear/agegenderrace.ts
|
||||
// src/gear/gear-agegenderrace.ts
|
||||
var tf23 = __toModule(require_tfjs_esm());
|
||||
var model10;
|
||||
var model9;
|
||||
var skipped8 = Number.MAX_SAFE_INTEGER;
|
||||
async function load13(config3) {
|
||||
async function load12(config3) {
|
||||
if (env.initial)
|
||||
model10 = null;
|
||||
if (!model10) {
|
||||
model10 = await tf23.loadGraphModel(join(config3.modelBasePath, config3.face.agegenderrace.modelPath));
|
||||
if (!model10 || !model10["modelUrl"])
|
||||
model9 = null;
|
||||
if (!model9) {
|
||||
model9 = await tf23.loadGraphModel(join(config3.modelBasePath, config3.face.agegenderrace.modelPath));
|
||||
if (!model9 || !model9["modelUrl"])
|
||||
log("load model failed:", config3.face.agegenderrace.modelPath);
|
||||
else if (config3.debug)
|
||||
log("load model:", model10["modelUrl"]);
|
||||
log("load model:", model9["modelUrl"]);
|
||||
} else if (config3.debug)
|
||||
log("cached model:", model10["modelUrl"]);
|
||||
return model10;
|
||||
log("cached model:", model9["modelUrl"]);
|
||||
return model9;
|
||||
}
|
||||
|
||||
// src/models.ts
|
||||
|
@ -10621,6 +10648,7 @@ var Models = class {
|
|||
constructor() {
|
||||
__publicField(this, "age", null);
|
||||
__publicField(this, "agegenderrace", null);
|
||||
__publicField(this, "blazeposedetect", null);
|
||||
__publicField(this, "blazepose", null);
|
||||
__publicField(this, "centernet", null);
|
||||
__publicField(this, "efficientpose", null);
|
||||
|
@ -10641,11 +10669,11 @@ var Models = class {
|
|||
}
|
||||
};
|
||||
function reset(instance) {
|
||||
for (const model11 of Object.keys(instance.models))
|
||||
instance.models[model11] = null;
|
||||
for (const model10 of Object.keys(instance.models))
|
||||
instance.models[model10] = null;
|
||||
}
|
||||
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;
|
||||
async function load13(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, _B, _C, _D;
|
||||
if (env.initial)
|
||||
reset(instance);
|
||||
if (instance.config.face.enabled) {
|
||||
|
@ -10669,48 +10697,50 @@ async function load14(instance) {
|
|||
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 = load5(instance.config);
|
||||
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 = load8(instance.config);
|
||||
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.blazepose = load7(instance.config);
|
||||
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.efficientpose = load7(instance.config);
|
||||
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);
|
||||
if (instance.config.object.enabled && !instance.models.nanodet && ((_v = (_u = instance.config.object) == null ? void 0 : _u.modelPath) == null ? void 0 : _v.includes("nanodet")))
|
||||
instance.models.nanodet = load10(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")))
|
||||
instance.models.centernet = load11(instance.config);
|
||||
if (instance.config.face.enabled && ((_y = instance.config.face.emotion) == null ? void 0 : _y.enabled) && !instance.models.emotion)
|
||||
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.blazepose = loadPose(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.blazeposedetect && ((_q = instance.config.body.detector) == null ? void 0 : _q.modelPath) && ((_s = (_r = instance.config.body) == null ? void 0 : _r.modelPath) == null ? void 0 : _s.includes("blazepose")))
|
||||
instance.models.blazeposedetect = loadDetect2(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.efficientpose && ((_u = (_t = instance.config.body) == null ? void 0 : _t.modelPath) == null ? void 0 : _u.includes("efficientpose")))
|
||||
instance.models.efficientpose = load7(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.movenet && ((_w = (_v = instance.config.body) == null ? void 0 : _v.modelPath) == null ? void 0 : _w.includes("movenet")))
|
||||
instance.models.movenet = load8(instance.config);
|
||||
if (instance.config.object.enabled && !instance.models.nanodet && ((_y = (_x = instance.config.object) == null ? void 0 : _x.modelPath) == null ? void 0 : _y.includes("nanodet")))
|
||||
instance.models.nanodet = load9(instance.config);
|
||||
if (instance.config.object.enabled && !instance.models.centernet && ((_A = (_z = instance.config.object) == null ? void 0 : _z.modelPath) == null ? void 0 : _A.includes("centernet")))
|
||||
instance.models.centernet = load10(instance.config);
|
||||
if (instance.config.face.enabled && ((_B = instance.config.face.emotion) == null ? void 0 : _B.enabled) && !instance.models.emotion)
|
||||
instance.models.emotion = load4(instance.config);
|
||||
if (instance.config.face.enabled && ((_z = instance.config.face.description) == null ? void 0 : _z.enabled) && !instance.models.faceres)
|
||||
if (instance.config.face.enabled && ((_C = instance.config.face.description) == null ? void 0 : _C.enabled) && !instance.models.faceres)
|
||||
instance.models.faceres = load3(instance.config);
|
||||
if (instance.config.segmentation.enabled && !instance.models.segmentation)
|
||||
instance.models.segmentation = load12(instance.config);
|
||||
if (instance.config.face.enabled && ((_A = instance.config.face["agegenderrace"]) == null ? void 0 : _A.enabled) && !instance.models.agegenderrace)
|
||||
instance.models.agegenderrace = load13(instance.config);
|
||||
for await (const model11 of Object.keys(instance.models)) {
|
||||
if (instance.models[model11] && typeof instance.models[model11] !== "undefined")
|
||||
instance.models[model11] = await instance.models[model11];
|
||||
instance.models.segmentation = load11(instance.config);
|
||||
if (instance.config.face.enabled && ((_D = instance.config.face["agegenderrace"]) == null ? void 0 : _D.enabled) && !instance.models.agegenderrace)
|
||||
instance.models.agegenderrace = load12(instance.config);
|
||||
for await (const model10 of Object.keys(instance.models)) {
|
||||
if (instance.models[model10] && typeof instance.models[model10] !== "undefined")
|
||||
instance.models[model10] = await instance.models[model10];
|
||||
}
|
||||
}
|
||||
async function validate2(instance) {
|
||||
const simpleOps = ["const", "placeholder", "noop", "pad", "squeeze", "add", "sub", "mul", "div"];
|
||||
for (const defined of Object.keys(instance.models)) {
|
||||
if (instance.models[defined]) {
|
||||
let models4 = [];
|
||||
let models5 = [];
|
||||
if (Array.isArray(instance.models[defined])) {
|
||||
models4 = instance.models[defined].filter((model11) => model11 !== null).map((model11) => model11 && model11.executor ? model11 : model11.model);
|
||||
models5 = instance.models[defined].filter((model10) => model10 !== null).map((model10) => model10 && model10.executor ? model10 : model10.model);
|
||||
} else {
|
||||
models4 = [instance.models[defined]];
|
||||
models5 = [instance.models[defined]];
|
||||
}
|
||||
for (const model11 of models4) {
|
||||
if (!model11) {
|
||||
for (const model10 of models5) {
|
||||
if (!model10) {
|
||||
if (instance.config.debug)
|
||||
log("model marked as loaded but not defined:", defined);
|
||||
continue;
|
||||
}
|
||||
const ops = [];
|
||||
const executor = model11 == null ? void 0 : model11.executor;
|
||||
const executor = model10 == null ? void 0 : model10.executor;
|
||||
if (executor && executor.graph.nodes) {
|
||||
for (const kernel of Object.values(executor.graph.nodes)) {
|
||||
const op = kernel.op.toLowerCase();
|
||||
|
@ -10734,7 +10764,7 @@ async function validate2(instance) {
|
|||
}
|
||||
}
|
||||
|
||||
// src/face.ts
|
||||
// src/face/face.ts
|
||||
var tf24 = __toModule(require_tfjs_esm());
|
||||
var calculateGaze = (face5) => {
|
||||
const radians = (pt1, pt2) => Math.atan2(pt1[1] - pt2[1], pt1[0] - pt2[0]);
|
||||
|
@ -11042,7 +11072,7 @@ var hand = (res) => {
|
|||
return gestures;
|
||||
};
|
||||
|
||||
// src/draw.ts
|
||||
// src/util/draw.ts
|
||||
var options2 = {
|
||||
color: "rgba(173, 216, 230, 0.6)",
|
||||
labelColor: "rgba(173, 216, 230, 1)",
|
||||
|
@ -11588,7 +11618,7 @@ function join2(faces, bodies, hands, gestures, shape) {
|
|||
return persons2;
|
||||
}
|
||||
|
||||
// src/interpolate.ts
|
||||
// src/util/interpolate.ts
|
||||
var bufferedResult = { face: [], body: [], hand: [], gesture: [], object: [], persons: [], performance: {}, timestamp: 0 };
|
||||
function calc(newResult) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
||||
|
@ -12635,7 +12665,7 @@ var Human = class {
|
|||
async load(userConfig) {
|
||||
this.state = "load";
|
||||
const timeStamp = now();
|
||||
const count2 = Object.values(this.models).filter((model11) => model11).length;
|
||||
const count2 = Object.values(this.models).filter((model10) => model10).length;
|
||||
if (userConfig)
|
||||
this.config = mergeDeep(this.config, userConfig);
|
||||
if (env.initial) {
|
||||
|
@ -12653,11 +12683,11 @@ var Human = class {
|
|||
log("tf flags:", this.tf.ENV.flags);
|
||||
}
|
||||
}
|
||||
await load14(this);
|
||||
await load13(this);
|
||||
if (env.initial && this.config.debug)
|
||||
log("tf engine state:", this.tf.engine().state.numBytes, "bytes", this.tf.engine().state.numTensors, "tensors");
|
||||
env.initial = false;
|
||||
const loaded = Object.values(this.models).filter((model11) => model11).length;
|
||||
const loaded = Object.values(this.models).filter((model10) => model10).length;
|
||||
if (loaded !== count2) {
|
||||
await validate2(this);
|
||||
this.emit("load");
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* See `facemesh.ts` for entry point
|
||||
*/
|
||||
|
||||
import { log, join, mergeDeep } from '../util';
|
||||
import { log, join, mergeDeep } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as box from './box';
|
||||
import * as util from './util';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* - Eye Iris Details: [**MediaPipe Iris**](https://drive.google.com/file/d/1bsWbokp9AklH2ANjCfmjqEzzxO1CNbMu/view)
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as blazeface from './blazeface';
|
||||
import * as facepipeline from './facepipeline';
|
||||
|
@ -15,7 +15,7 @@ import * as coords from './coords';
|
|||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import type { FaceResult, Box } from '../result';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
let faceModels: [blazeface.BlazeFaceModel | null, GraphModel | null, GraphModel | null] = [null, null, null];
|
||||
let facePipeline;
|
||||
|
|
|
@ -9,8 +9,8 @@ import * as util from './util';
|
|||
import * as coords from './coords';
|
||||
import type { Tensor, GraphModel } from '../tfjs/types';
|
||||
import type { BlazeFaceModel } from './blazeface';
|
||||
import { env } from '../env';
|
||||
import { log } from '../util';
|
||||
import { env } from '../util/env';
|
||||
import { log } from '../util/util';
|
||||
import type { Point } from '../result';
|
||||
|
||||
const leftOutline = coords.MESH_ANNOTATIONS['leftEyeLower0'];
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
* Based on : [**BlazePose**](https://drive.google.com/file/d/10IU-DRP2ioSNjKFdiGbmmQX81xAYj88s/view)
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as annotations from './annotations';
|
||||
import type { Tensor, GraphModel } from '../tfjs/types';
|
||||
import type { BodyResult, Box, Point } from '../result';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
let model: GraphModel | null;
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
/**
|
||||
* BlazePose model implementation
|
||||
*
|
||||
* Based on : [**BlazePose**](https://github.com/google/mediapipe/blob/master/mediapipe/modules/pose_detection)
|
||||
*/
|
||||
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import type { BodyResult, Box, Point } from '../result';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../util/env';
|
||||
import * as annotations from './annotations';
|
||||
|
||||
// const boxScaleFact = 1.5; // hand finger model prefers slighly larger box
|
||||
const models: [GraphModel | null, GraphModel | null] = [null, null];
|
||||
const outputNodes = ['ld_3d', 'activation_segmentation', 'activation_heatmap', 'world_3d', 'output_poseflag'];
|
||||
|
||||
const inputSize = [[0, 0], [0, 0]];
|
||||
|
||||
// let skipped = 0;
|
||||
let outputSize: [number, number] = [0, 0];
|
||||
|
||||
type Keypoints = { score: number, part: string, position: Point, positionRaw: Point };
|
||||
|
||||
/*
|
||||
type BodyDetectResult = {
|
||||
id: number,
|
||||
score: number,
|
||||
box: Box,
|
||||
boxRaw: Box,
|
||||
label: string,
|
||||
yxBox: Box,
|
||||
}
|
||||
|
||||
const cache: {
|
||||
bodyBoxes: Array<BodyDetectResult>,
|
||||
partBoxes: Array<BodyDetectResult>
|
||||
tmpBoxes: Array<BodyDetectResult>
|
||||
} = {
|
||||
bodyBoxes: [],
|
||||
partBoxes: [],
|
||||
tmpBoxes: [],
|
||||
};
|
||||
*/
|
||||
|
||||
export async function loadDetect(config: Config): Promise<GraphModel> {
|
||||
if (env.initial) models[0] = null;
|
||||
if (!models[0]) {
|
||||
models[0] = await tf.loadGraphModel(join(config.modelBasePath, config.body.detector?.modelPath || '')) as unknown as GraphModel;
|
||||
const inputs = Object.values(models[0].modelSignature['inputs']);
|
||||
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;
|
||||
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('cached model:', models[0]['modelUrl']);
|
||||
return models[0];
|
||||
}
|
||||
|
||||
export async function loadPose(config: Config): Promise<GraphModel> {
|
||||
if (env.initial) models[1] = null;
|
||||
if (!models[1]) {
|
||||
models[1] = await tf.loadGraphModel(join(config.modelBasePath, config.body.modelPath || '')) as unknown as GraphModel;
|
||||
const inputs = Object.values(models[1].modelSignature['inputs']);
|
||||
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;
|
||||
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('cached model:', models[1]['modelUrl']);
|
||||
return models[1];
|
||||
}
|
||||
|
||||
export async function load(config: Config): Promise<[GraphModel | null, GraphModel | null]> {
|
||||
if (!models[0]) await loadDetect(config);
|
||||
if (!models[1]) await loadPose(config);
|
||||
return models;
|
||||
}
|
||||
|
||||
/*
|
||||
async function detectBody(input: Tensor, config: Config): Promise<BodyDetectResult[]> {
|
||||
if ((config.body.detector?.modelPath.length || 0) > 0 && models[0]) {
|
||||
const t: Record<string, Tensor> = {};
|
||||
t.resize = tf.image.resizeBilinear(input, [inputSize[0][0], inputSize[0][1]]);
|
||||
t.res = await models[0]?.predict(t.resize) as Tensor; // [1,2254,13]
|
||||
t.logits = tf.slice(t.res, [0, 0, 0], [1, -1, 1]);
|
||||
t.sigmoid = tf.sigmoid(t.logits);
|
||||
t.rawBoxes = tf.slice(t.res, [0, 0, 1], [1, -1, -1]);
|
||||
t.packedBoxes = tf.squeeze(t.rawBoxes); // [2254,12]
|
||||
t.scores = tf.squeeze(t.sigmoid); // [2254,1]
|
||||
// boxes need to be decoded based on anchors
|
||||
Object.keys(t).forEach((tensor) => tf.dispose(t[tensor]));
|
||||
}
|
||||
return [];
|
||||
}
|
||||
*/
|
||||
|
||||
async function detectParts(input: Tensor, config: Config): Promise<BodyResult> {
|
||||
const t: Record<string, Tensor> = {};
|
||||
t.resize = tf.image.resizeBilinear(input, [inputSize[1][0], inputSize[1][1]]);
|
||||
[t.ld/* 1,195 */, t.segmentation/* 1,256,256,1 */, t.heatmap/* 1,64,64,39 */, t.world/* 1,117 */, t.poseflag/* 1,1 */] = await models[1]?.execute(t.resize, outputNodes) as Tensor[]; // [1,2254,13]
|
||||
const points = await t.ld.data();
|
||||
const keypoints: Array<Keypoints> = [];
|
||||
const labels = points?.length === 195 ? annotations.full : annotations.upper; // full model has 39 keypoints, upper has 31 keypoints
|
||||
const depth = 5; // each points has x,y,z,visibility,presence
|
||||
for (let i = 0; i < points.length / depth; i++) {
|
||||
const score = (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 3])))) / 100; // reverse sigmoid value
|
||||
// const presence = (100 - Math.trunc(100 / (1 + Math.exp(points[depth * i + 4])))) / 100; // reverse sigmoid value
|
||||
if (score > (config.body.minConfidence || 0)) {
|
||||
keypoints.push({
|
||||
part: labels[i],
|
||||
position: [
|
||||
Math.trunc(outputSize[0] * points[depth * i + 0] / 255), // return normalized x value istead of 0..255
|
||||
Math.trunc(outputSize[1] * points[depth * i + 1] / 255), // return normalized y value istead of 0..255
|
||||
Math.trunc(points[depth * i + 2]) + 0, // fix negative zero
|
||||
],
|
||||
positionRaw: [
|
||||
points[depth * i + 0] / 255, // return x value normalized to 0..1
|
||||
points[depth * i + 1] / 255, // return y value normalized to 0..1
|
||||
points[depth * i + 2] + 0, // fix negative zero
|
||||
],
|
||||
score,
|
||||
});
|
||||
}
|
||||
}
|
||||
const x = keypoints.map((a) => a.position[0]);
|
||||
const y = keypoints.map((a) => a.position[1]);
|
||||
const box: Box = [
|
||||
Math.min(...x),
|
||||
Math.min(...y),
|
||||
Math.max(...x) - Math.min(...x),
|
||||
Math.max(...y) - Math.min(...x),
|
||||
];
|
||||
const boxRaw: Box = [0, 0, 0, 0]; // not yet implemented
|
||||
const score = keypoints.reduce((prev, curr) => (curr.score > prev ? curr.score : prev), 0);
|
||||
Object.keys(t).forEach((tensor) => tf.dispose(t[tensor]));
|
||||
return { id: 0, score, box, boxRaw, keypoints };
|
||||
}
|
||||
|
||||
export async function predict(input: Tensor, config: Config): Promise<BodyResult[]> {
|
||||
outputSize = [input.shape[2] || 0, input.shape[1] || 0];
|
||||
const bodies: Array<BodyResult> = [];
|
||||
const body = await detectParts(input, config);
|
||||
bodies.push(body);
|
||||
/*
|
||||
cache.tmpBoxes = []; // clear temp cache
|
||||
if ((skipped < (config.body.skipFrames || 0)) && config.skipFrame) { // just run part detection while reusing cached boxes
|
||||
skipped++;
|
||||
bodies = await Promise.all(cache.partBoxes.map((body) => detectParts(input, body, config))); // run from parts box cache
|
||||
} else { // calculate new boxes and run part detection
|
||||
skipped = 0;
|
||||
bodies = await Promise.all(cache.partBoxes.map((body) => detectParts(input, body, config))); // run from part box cache
|
||||
if (bodies.length !== config.body.maxDetected) { // run body detection only if we dont have enough bodies in cache
|
||||
cache.bodyBoxes = await detectBody(input, config);
|
||||
const newBodies = await Promise.all(cache.bodyBoxes.map((body) => detectParts(input, body, config)));
|
||||
bodies = bodies.concat(newBodies);
|
||||
}
|
||||
}
|
||||
cache.partBoxes = [...cache.tmpBoxes]; // repopulate cache with validated bodies
|
||||
*/
|
||||
return bodies as BodyResult[];
|
||||
}
|
|
@ -4,12 +4,12 @@
|
|||
* Based on: [**EfficientPose**](https://github.com/daniegr/EfficientPose)
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import type { BodyResult, Box } from '../result';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
let model: GraphModel | null;
|
||||
|
|
@ -4,19 +4,20 @@
|
|||
* Based on: [**MoveNet**](https://blog.tensorflow.org/2021/05/next-generation-pose-detection-with-movenet-and-tensorflowjs.html)
|
||||
*/
|
||||
|
||||
import { log, join, scaleBox } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import { scale } from '../util/box';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import type { BodyResult, Box } from '../result';
|
||||
import type { BodyResult, Box, Point } from '../result';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { fakeOps } from '../tfjs/backend';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
let model: GraphModel | null;
|
||||
let inputSize = 0;
|
||||
const cachedBoxes: Array<Box> = [];
|
||||
|
||||
type Keypoints = { score: number, part: string, position: [number, number], positionRaw: [number, number] };
|
||||
type Keypoints = { score: number, part: string, position: Point, positionRaw: Point };
|
||||
type Body = { id: number, score: number, box: Box, boxRaw: Box, keypoints: Array<Keypoints> }
|
||||
|
||||
let skipped = Number.MAX_SAFE_INTEGER;
|
||||
|
@ -157,7 +158,7 @@ export async function predict(input: Tensor, config: Config): Promise<BodyResult
|
|||
for (let i = 0; i < bodies.length; i++) {
|
||||
if (bodies[i].keypoints.length > 10) { // only update cache if we detected sufficient number of keypoints
|
||||
const kpts = bodies[i].keypoints.map((kpt) => kpt.position);
|
||||
const newBox = scaleBox(kpts, 1.5, [input.shape[2], input.shape[1]]);
|
||||
const newBox = scale(kpts, 1.5, [input.shape[2], input.shape[1]]);
|
||||
cachedBoxes.push([...newBox.yxBox]);
|
||||
}
|
||||
}
|
|
@ -70,6 +70,7 @@ export interface FaceConfig {
|
|||
* - modelPath: body pose model, can be absolute path or relative to modelBasePath
|
||||
* - minConfidence: threshold for discarding a prediction
|
||||
* - maxDetected: maximum number of people detected in the input, should be set to the minimum number for performance
|
||||
* - detector: optional body detector
|
||||
*
|
||||
* `maxDetected` is valid for `posenet` and `movenet-multipose` as other models are single-pose only
|
||||
* `maxDetected` can be set to -1 to auto-detect based on number of detected faces
|
||||
|
@ -83,6 +84,9 @@ export interface BodyConfig {
|
|||
maxDetected: number,
|
||||
minConfidence: number,
|
||||
skipFrames: number,
|
||||
detector?: {
|
||||
modelPath: string
|
||||
},
|
||||
}
|
||||
|
||||
/** Controlls and configures all hand detection specific options
|
||||
|
@ -399,6 +403,9 @@ const config: Config = {
|
|||
enabled: true,
|
||||
modelPath: 'movenet-lightning.json', // body model, can be absolute path or relative to modelBasePath
|
||||
// can be 'posenet', 'blazepose', 'efficientpose', 'movenet-lightning', 'movenet-thunder'
|
||||
detector: {
|
||||
modelPath: '', // optional body detector
|
||||
},
|
||||
maxDetected: -1, // maximum number of people detected in the input
|
||||
// should be set to the minimum number for performance
|
||||
// only valid for posenet and movenet-multipose as other models detects single pose
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* Obsolete and replaced by `faceres` that performs age/gender/descriptor analysis
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import type { Tensor, GraphModel } from '../tfjs/types';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
type DB = Array<{ name: string, source: string, embedding: number[] }>;
|
||||
let model: GraphModel | null;
|
|
@ -3,13 +3,13 @@
|
|||
* Uses FaceMesh, Emotion and FaceRes models to create a unified pipeline
|
||||
*/
|
||||
|
||||
import { log, now } from './util';
|
||||
import * as tf from '../dist/tfjs.esm.js';
|
||||
import * as facemesh from './blazeface/facemesh';
|
||||
import * as emotion from './emotion/emotion';
|
||||
import * as faceres from './faceres/faceres';
|
||||
import type { FaceResult } from './result';
|
||||
import type { Tensor } from './tfjs/types';
|
||||
import { log, now } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as facemesh from '../blazeface/facemesh';
|
||||
import * as emotion from '../gear/emotion';
|
||||
import * as faceres from './faceres';
|
||||
import type { FaceResult } from '../result';
|
||||
import type { Tensor } from '../tfjs/types';
|
||||
|
||||
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
||||
const rad2deg = (theta) => Math.round((theta * 180) / Math.PI);
|
|
@ -7,11 +7,11 @@
|
|||
* Based on: [**HSE-FaceRes**](https://github.com/HSE-asavchenko/HSE_FaceRec_tf)
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import type { Tensor, GraphModel } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
let model: GraphModel | null;
|
||||
const last: Array<{
|
|
@ -4,11 +4,11 @@
|
|||
* [**Oarriaga**](https://github.com/oarriaga/face_classification)
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import type { Config } from '../config';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
const annotations = ['angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral'];
|
||||
let model: GraphModel | null;
|
|
@ -7,11 +7,11 @@
|
|||
* Config placeholder: agegenderrace: { enabled: true, modelPath: 'gear.json' },
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import type { Config } from '../config';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
let model: GraphModel | null;
|
||||
|
|
@ -6,11 +6,11 @@
|
|||
* Obsolete and replaced by `faceres` that performs age/gender/descriptor analysis
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import type { Config } from '../config';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
let model: GraphModel | null;
|
||||
|
|
@ -6,11 +6,11 @@
|
|||
* Obsolete and replaced by `faceres` that performs age/gender/descriptor analysis
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import type { Config } from '../config';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
let model: GraphModel | null;
|
||||
let last = { gender: '' };
|
|
@ -6,12 +6,13 @@
|
|||
* - Hand Tracking: [**HandTracking**](https://github.com/victordibia/handtracking)
|
||||
*/
|
||||
|
||||
import { log, join, scaleBox } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import { scale } from '../util/box';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import type { HandResult, Box } from '../result';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
import * as fingerPose from '../fingerpose/fingerpose';
|
||||
import { fakeOps } from '../tfjs/backend';
|
||||
|
||||
|
@ -168,7 +169,7 @@ async function detectFingers(input: Tensor, h: HandDetectResult, config: Config)
|
|||
(h.box[3] * coord[1] / inputSize[1][1]) + h.box[1],
|
||||
(h.box[2] + h.box[3]) / 2 / inputSize[1][0] * coord[2],
|
||||
]);
|
||||
const updatedBox = scaleBox(hand.keypoints, boxScaleFact, outputSize); // replace detected box with box calculated around keypoints
|
||||
const updatedBox = scale(hand.keypoints, boxScaleFact, outputSize); // replace detected box with box calculated around keypoints
|
||||
h.box = updatedBox.box;
|
||||
h.boxRaw = updatedBox.boxRaw;
|
||||
h.yxBox = updatedBox.yxBox;
|
|
@ -8,7 +8,7 @@ import * as box from './box';
|
|||
import * as util from './util';
|
||||
import type * as detector from './handdetector';
|
||||
import type { Tensor, GraphModel } from '../tfjs/types';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
const palmBoxEnlargeFactor = 5; // default 3
|
||||
const handBoxEnlargeFactor = 1.65; // default 1.65
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Based on: [**MediaPipe HandPose**](https://drive.google.com/file/d/1sv4sSb9BSNVZhLzxXJ0jBv9DqD-4jnAz/view)
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as handdetector from './handdetector';
|
||||
import * as handpipeline from './handpipeline';
|
||||
|
@ -12,7 +12,7 @@ import * as fingerPose from '../fingerpose/fingerpose';
|
|||
import type { HandResult, Box, Point } from '../result';
|
||||
import type { Tensor, GraphModel } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
const meshAnnotations = {
|
||||
thumb: [1, 2, 3, 4],
|
||||
|
|
27
src/human.ts
27
src/human.ts
|
@ -2,41 +2,42 @@
|
|||
* Human main module
|
||||
*/
|
||||
|
||||
import { log, now, mergeDeep, validate } from './util';
|
||||
import { log, now, mergeDeep, validate } from './util/util';
|
||||
import { Config, defaults } from './config';
|
||||
import type { Result, FaceResult, HandResult, BodyResult, ObjectResult, GestureResult, PersonResult } from './result';
|
||||
import * as tf from '../dist/tfjs.esm.js';
|
||||
import * as models from './models';
|
||||
import * as face from './face';
|
||||
import * as face from './face/face';
|
||||
import * as facemesh from './blazeface/facemesh';
|
||||
import * as faceres from './faceres/faceres';
|
||||
import * as faceres from './face/faceres';
|
||||
import * as posenet from './posenet/posenet';
|
||||
import * as handtrack from './handtrack/handtrack';
|
||||
import * as handtrack from './hand/handtrack';
|
||||
import * as handpose from './handpose/handpose';
|
||||
import * as blazepose from './blazepose/blazepose';
|
||||
import * as efficientpose from './efficientpose/efficientpose';
|
||||
import * as movenet from './movenet/movenet';
|
||||
// import * as blazepose from './body/blazepose-v1';
|
||||
import * as blazepose from './body/blazepose';
|
||||
import * as efficientpose from './body/efficientpose';
|
||||
import * as movenet from './body/movenet';
|
||||
import * as nanodet from './object/nanodet';
|
||||
import * as centernet from './object/centernet';
|
||||
import * as segmentation from './segmentation/segmentation';
|
||||
import * as gesture from './gesture/gesture';
|
||||
import * as image from './image/image';
|
||||
import * as draw from './draw';
|
||||
import * as draw from './util/draw';
|
||||
import * as persons from './persons';
|
||||
import * as interpolate from './interpolate';
|
||||
import * as env from './env';
|
||||
import * as interpolate from './util/interpolate';
|
||||
import * as env from './util/env';
|
||||
import * as backend from './tfjs/backend';
|
||||
import * as humangl from './tfjs/humangl';
|
||||
import * as app from '../package.json';
|
||||
import * as warmups from './warmup';
|
||||
import type { Tensor } from './tfjs/types';
|
||||
import type { DrawOptions } from './draw';
|
||||
import type { DrawOptions } from './util/draw';
|
||||
|
||||
// export types
|
||||
export * from './config';
|
||||
export * from './result';
|
||||
export type { DrawOptions } from './draw';
|
||||
export { env, Env } from './env';
|
||||
export type { DrawOptions } from './util/draw';
|
||||
export { env, Env } from './util/env';
|
||||
export { Box, Point } from './result';
|
||||
export { Models } from './models';
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import * as tf from '../../dist/tfjs.esm.js';
|
|||
import * as fxImage from './imagefx';
|
||||
import type { Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { log } from '../util';
|
||||
import { env } from '../util/env';
|
||||
import { log } from '../util/util';
|
||||
|
||||
type Input = Tensor | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | typeof Image | typeof env.Canvas;
|
||||
|
||||
|
|
|
@ -2,23 +2,23 @@
|
|||
* Loader and Validator for all models used by Human
|
||||
*/
|
||||
|
||||
import { log } from './util';
|
||||
import { log } from './util/util';
|
||||
import type { GraphModel } from './tfjs/types';
|
||||
import * as facemesh from './blazeface/facemesh';
|
||||
import * as faceres from './faceres/faceres';
|
||||
import * as emotion from './emotion/emotion';
|
||||
import * as faceres from './face/faceres';
|
||||
import * as emotion from './gear/emotion';
|
||||
import * as posenet from './posenet/posenet';
|
||||
import * as handpose from './handpose/handpose';
|
||||
import * as handtrack from './handtrack/handtrack';
|
||||
import * as blazepose from './blazepose/blazepose';
|
||||
import * as efficientpose from './efficientpose/efficientpose';
|
||||
import * as movenet from './movenet/movenet';
|
||||
import * as handtrack from './hand/handtrack';
|
||||
import * as blazepose from './body/blazepose';
|
||||
import * as efficientpose from './body/efficientpose';
|
||||
import * as movenet from './body/movenet';
|
||||
import * as nanodet from './object/nanodet';
|
||||
import * as centernet from './object/centernet';
|
||||
import * as segmentation from './segmentation/segmentation';
|
||||
import type { Human } from './human';
|
||||
import { env } from './env';
|
||||
import * as agegenderrace from './gear/agegenderrace';
|
||||
import { env } from './util/env';
|
||||
import * as agegenderrace from './gear/gear-agegenderrace';
|
||||
|
||||
/** Instances of all possible TFJS Graph Models used by Human
|
||||
* - loaded as needed based on configuration
|
||||
|
@ -29,6 +29,7 @@ import * as agegenderrace from './gear/agegenderrace';
|
|||
export class Models {
|
||||
age: null | GraphModel | Promise<GraphModel> = null;
|
||||
agegenderrace: null | GraphModel | Promise<GraphModel> = null;
|
||||
blazeposedetect: null | GraphModel | Promise<GraphModel> = null;
|
||||
blazepose: null | GraphModel | Promise<GraphModel> = null;
|
||||
centernet: null | GraphModel | Promise<GraphModel> = null;
|
||||
efficientpose: null | GraphModel | Promise<GraphModel> = null;
|
||||
|
@ -69,8 +70,9 @@ export async function load(instance: Human) {
|
|||
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);
|
||||
if (instance.config.body.enabled && !instance.models.posenet && instance.config.body?.modelPath?.includes('posenet')) instance.models.posenet = posenet.load(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.efficientpose && instance.config.body?.modelPath?.includes('efficientpose')) instance.models.efficientpose = efficientpose.load(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.blazepose && instance.config.body?.modelPath?.includes('blazepose')) instance.models.blazepose = blazepose.load(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.efficientpose && instance.config.body?.modelPath?.includes('efficientpose')) instance.models.efficientpose = blazepose.load(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.blazepose && instance.config.body?.modelPath?.includes('blazepose')) instance.models.blazepose = blazepose.loadPose(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.blazeposedetect && instance.config.body.detector?.modelPath && instance.config.body?.modelPath?.includes('blazepose')) instance.models.blazeposedetect = blazepose.loadDetect(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.efficientpose && instance.config.body?.modelPath?.includes('efficientpose')) instance.models.efficientpose = efficientpose.load(instance.config);
|
||||
if (instance.config.body.enabled && !instance.models.movenet && instance.config.body?.modelPath?.includes('movenet')) instance.models.movenet = movenet.load(instance.config);
|
||||
if (instance.config.object.enabled && !instance.models.nanodet && instance.config.object?.modelPath?.includes('nanodet')) instance.models.nanodet = nanodet.load(instance.config);
|
||||
if (instance.config.object.enabled && !instance.models.centernet && instance.config.object?.modelPath?.includes('centernet')) instance.models.centernet = centernet.load(instance.config);
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
* Based on: [**NanoDet**](https://github.com/RangiLyu/nanodet)
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import { labels } from './labels';
|
||||
import type { ObjectResult, Box } from '../result';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
import { fakeOps } from '../tfjs/backend';
|
||||
|
||||
let model: GraphModel | null;
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
* Based on: [**MB3-CenterNet**](https://github.com/610265158/mobilenetv3_centernet)
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import { labels } from './labels';
|
||||
import type { ObjectResult, Box } from '../result';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
let model;
|
||||
let last: Array<ObjectResult> = [];
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
* Based on: [**PoseNet**](https://medium.com/tensorflow/real-time-human-pose-estimation-in-the-browser-with-tensorflow-js-7dd0bc881cd5)
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as poses from './poses';
|
||||
import * as util from './utils';
|
||||
import type { BodyResult } from '../result';
|
||||
import type { Tensor, GraphModel } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
let model: GraphModel;
|
||||
const poseNetOutputs = ['MobilenetV1/offset_2/BiasAdd'/* offsets */, 'MobilenetV1/heatmap_2/BiasAdd'/* heatmapScores */, 'MobilenetV1/displacement_fwd_2/BiasAdd'/* displacementFwd */, 'MobilenetV1/displacement_bwd_2/BiasAdd'/* displacementBwd */];
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
* - [**MediaPipe Selfie**](https://drive.google.com/file/d/1dCfozqknMa068vVsO2j_1FgZkW_e3VWv/preview)
|
||||
*/
|
||||
|
||||
import { log, join } from '../util';
|
||||
import { log, join } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as image from '../image/image';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
|
||||
type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/** TFJS backend initialization and customization */
|
||||
|
||||
import { log, now } from '../util';
|
||||
import { log, now } from '../util/util';
|
||||
import * as humangl from './humangl';
|
||||
import * as env from '../env';
|
||||
import * as env from '../util/env';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
|
||||
export async function check(instance, force = false) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** TFJS custom backend registration */
|
||||
|
||||
import { log } from '../util';
|
||||
import { log } from '../util/util';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as image from '../image/image';
|
||||
import * as models from '../models';
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
import type { Box } from '../result';
|
||||
|
||||
// helper function: find box around keypoints, square it and scale it
|
||||
export function scale(keypoints, boxScaleFact, outputSize) {
|
||||
const coords = [keypoints.map((pt) => pt[0]), keypoints.map((pt) => pt[1])]; // all x/y coords
|
||||
const maxmin = [Math.max(...coords[0]), Math.min(...coords[0]), Math.max(...coords[1]), Math.min(...coords[1])]; // find min/max x/y coordinates
|
||||
const center = [(maxmin[0] + maxmin[1]) / 2, (maxmin[2] + maxmin[3]) / 2]; // find center x and y coord of all fingers
|
||||
const diff = Math.max(center[0] - maxmin[1], center[1] - maxmin[3], -center[0] + maxmin[0], -center[1] + maxmin[2]) * boxScaleFact; // largest distance from center in any direction
|
||||
const box = [
|
||||
Math.trunc(center[0] - diff),
|
||||
Math.trunc(center[1] - diff),
|
||||
Math.trunc(2 * diff),
|
||||
Math.trunc(2 * diff),
|
||||
] as Box;
|
||||
const boxRaw = [ // work backwards
|
||||
box[0] / outputSize[0],
|
||||
box[1] / outputSize[1],
|
||||
box[2] / outputSize[0],
|
||||
box[3] / outputSize[1],
|
||||
] as Box;
|
||||
const yxBox = [ // work backwards
|
||||
boxRaw[1],
|
||||
boxRaw[0],
|
||||
boxRaw[3] + boxRaw[1],
|
||||
boxRaw[2] + boxRaw[0],
|
||||
] as Box;
|
||||
return { box, boxRaw, yxBox };
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
* Module that implements helper draw functions, exposed as human.draw
|
||||
*/
|
||||
|
||||
import { TRI468 as triangulation } from './blazeface/coords';
|
||||
import { TRI468 as triangulation } from '../blazeface/coords';
|
||||
import { mergeDeep, now } from './util';
|
||||
import type { Result, FaceResult, BodyResult, HandResult, ObjectResult, GestureResult, PersonResult } from './result';
|
||||
import type { Result, FaceResult, BodyResult, HandResult, ObjectResult, GestureResult, PersonResult } from '../result';
|
||||
|
||||
/**
|
||||
* Draw Options
|
|
@ -1,5 +1,5 @@
|
|||
import * as tf from '../dist/tfjs.esm.js';
|
||||
import * as image from './image/image';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as image from '../image/image';
|
||||
import { mergeDeep } from './util';
|
||||
|
||||
export type Env = {
|
|
@ -2,7 +2,7 @@
|
|||
* Results interpolation for smoothening of video detection results inbetween detected frames
|
||||
*/
|
||||
|
||||
import type { Result, FaceResult, BodyResult, HandResult, ObjectResult, GestureResult, PersonResult, Box, Point } from './result';
|
||||
import type { Result, FaceResult, BodyResult, HandResult, ObjectResult, GestureResult, PersonResult, Box, Point } from '../result';
|
||||
|
||||
const bufferedResult: Result = { face: [], body: [], hand: [], gesture: [], object: [], persons: [], performance: {}, timestamp: 0 };
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
* Simple helper functions used accross codebase
|
||||
*/
|
||||
|
||||
import type { Box } from './result';
|
||||
|
||||
// helper function: join two paths
|
||||
export function join(folder: string, file: string): string {
|
||||
const separator = folder.endsWith('/') ? '' : '/';
|
||||
|
@ -71,30 +69,3 @@ export async function wait(time) {
|
|||
const waiting = new Promise((resolve) => setTimeout(() => resolve(true), time));
|
||||
await waiting;
|
||||
}
|
||||
|
||||
// helper function: find box around keypoints, square it and scale it
|
||||
export function scaleBox(keypoints, boxScaleFact, outputSize) {
|
||||
const coords = [keypoints.map((pt) => pt[0]), keypoints.map((pt) => pt[1])]; // all x/y coords
|
||||
const maxmin = [Math.max(...coords[0]), Math.min(...coords[0]), Math.max(...coords[1]), Math.min(...coords[1])]; // find min/max x/y coordinates
|
||||
const center = [(maxmin[0] + maxmin[1]) / 2, (maxmin[2] + maxmin[3]) / 2]; // find center x and y coord of all fingers
|
||||
const diff = Math.max(center[0] - maxmin[1], center[1] - maxmin[3], -center[0] + maxmin[0], -center[1] + maxmin[2]) * boxScaleFact; // largest distance from center in any direction
|
||||
const box = [
|
||||
Math.trunc(center[0] - diff),
|
||||
Math.trunc(center[1] - diff),
|
||||
Math.trunc(2 * diff),
|
||||
Math.trunc(2 * diff),
|
||||
] as Box;
|
||||
const boxRaw = [ // work backwards
|
||||
box[0] / outputSize[0],
|
||||
box[1] / outputSize[1],
|
||||
box[2] / outputSize[0],
|
||||
box[3] / outputSize[1],
|
||||
] as Box;
|
||||
const yxBox = [ // work backwards
|
||||
boxRaw[1],
|
||||
boxRaw[0],
|
||||
boxRaw[3] + boxRaw[1],
|
||||
boxRaw[2] + boxRaw[0],
|
||||
] as Box;
|
||||
return { box, boxRaw, yxBox };
|
||||
}
|
|
@ -2,13 +2,13 @@
|
|||
* Warmup algorithm that uses embedded images to excercise loaded models for faster future inference
|
||||
*/
|
||||
|
||||
import { log, now, mergeDeep } from './util';
|
||||
import { log, now, mergeDeep } from './util/util';
|
||||
import * as sample from './sample';
|
||||
import * as tf from '../dist/tfjs.esm.js';
|
||||
import * as image from './image/image';
|
||||
import type { Config } from './config';
|
||||
import type { Result } from './result';
|
||||
import { env } from './env';
|
||||
import { env } from './util/env';
|
||||
|
||||
async function warmupBitmap(instance) {
|
||||
const b64toBlob = (base64: string, type = 'application/octet-stream') => fetch(`data:${type};base64,${base64}`).then((res) => res.blob());
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
2021-09-27 09:18:45 [36mINFO: [39m @vladmandic/human version 2.2.3
|
||||
2021-09-27 09:18:45 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.5.0
|
||||
2021-09-27 09:18:45 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"2.2.3"}
|
||||
2021-09-27 09:18:45 [36mINFO: [39m Environment: {"profile":"production","config":"build.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2021-09-27 09:18:45 [36mINFO: [39m Toolchain: {"build":"0.5.3","esbuild":"0.13.2","typescript":"4.4.3","typedoc":"0.22.4","eslint":"7.32.0"}
|
||||
2021-09-27 09:18:45 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2021-09-27 09:18:45 [35mSTATE:[39m Clean: {"locations":["dist/*","types/*","typedoc/*"]}
|
||||
2021-09-27 09:18:45 [35mSTATE:[39m 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-27 09:18:45 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":52,"inputBytes":506509,"outputBytes":422941}
|
||||
2021-09-27 09:18:45 [35mSTATE:[39m 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-27 09:18:45 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":52,"inputBytes":506517,"outputBytes":422945}
|
||||
2021-09-27 09:18:45 [35mSTATE:[39m 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-27 09:18:45 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":52,"inputBytes":506584,"outputBytes":423017}
|
||||
2021-09-27 09:18:45 [35mSTATE:[39m 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-27 09:18:45 [35mSTATE:[39m 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-27 09:18:45 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":52,"inputBytes":506027,"outputBytes":424428}
|
||||
2021-09-27 09:18:45 [35mSTATE:[39m 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-27 09:18:46 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":52,"inputBytes":2882275,"outputBytes":1418176}
|
||||
2021-09-27 09:18:46 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":52,"inputBytes":2882275,"outputBytes":2628827}
|
||||
2021-09-27 09:18:57 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types","files":98}
|
||||
2021-09-27 09:19:01 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":33,"generated":true}
|
||||
2021-09-27 09:19:20 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":85,"errors":0,"warnings":0}
|
||||
2021-09-27 09:19:20 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2021-09-27 09:19:20 [36mINFO: [39m Done...
|
||||
2021-09-27 13:56:53 [36mINFO: [39m @vladmandic/human version 2.2.3
|
||||
2021-09-27 13:56:53 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.5.0
|
||||
2021-09-27 13:56:53 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"2.2.3"}
|
||||
2021-09-27 13:56:53 [36mINFO: [39m Environment: {"profile":"production","config":"build.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2021-09-27 13:56:53 [36mINFO: [39m Toolchain: {"build":"0.5.3","esbuild":"0.13.2","typescript":"4.4.3","typedoc":"0.22.4","eslint":"7.32.0"}
|
||||
2021-09-27 13:56:53 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2021-09-27 13:56:53 [35mSTATE:[39m Clean: {"locations":["dist/*","types/*","typedoc/*"]}
|
||||
2021-09-27 13:56:53 [35mSTATE:[39m 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-27 13:56:53 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":53,"inputBytes":510889,"outputBytes":424465}
|
||||
2021-09-27 13:56:53 [35mSTATE:[39m 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-27 13:56:53 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":53,"inputBytes":510897,"outputBytes":424469}
|
||||
2021-09-27 13:56:53 [35mSTATE:[39m 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-27 13:56:53 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":53,"inputBytes":510964,"outputBytes":424541}
|
||||
2021-09-27 13:56:53 [35mSTATE:[39m 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-27 13:56:53 [35mSTATE:[39m 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-27 13:56:53 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":53,"inputBytes":510407,"outputBytes":425933}
|
||||
2021-09-27 13:56:54 [35mSTATE:[39m 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-27 13:56:54 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":53,"inputBytes":2886655,"outputBytes":1419179}
|
||||
2021-09-27 13:56:55 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":53,"inputBytes":2886655,"outputBytes":2630435}
|
||||
2021-09-27 13:57:11 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types","files":100}
|
||||
2021-09-27 13:57:16 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":33,"generated":true}
|
||||
2021-09-27 13:57:43 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":87,"errors":0,"warnings":0}
|
||||
2021-09-27 13:57:43 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2021-09-27 13:57:43 [36mINFO: [39m Done...
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -8,16 +8,16 @@
|
|||
</ul>
|
||||
</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></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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></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#L161">human.ts:161</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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></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#L162">human.ts:162</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>
|
||||
</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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></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: <a href="Human.html">Human</a></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#L87">human.ts:87</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#L88">human.ts:88</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Current configuration</p>
|
||||
<ul>
|
||||
<li>Definition: <a href="../interfaces/Config.html">Config</a></li>
|
||||
<li>Defaults: <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L292">config</a></li>
|
||||
</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#L123">human.ts:123</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#L124">human.ts:124</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>
|
||||
<ul>
|
||||
<li>options: <a href="../interfaces/DrawOptions.html">DrawOptions</a> global settings for all draw operations, can be overriden for each draw method</li>
|
||||
|
@ -27,9 +27,9 @@
|
|||
<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>
|
||||
</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#L113">human.ts:113</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#L114">human.ts:114</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<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#L141">human.ts:141</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#L142">human.ts:142</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Container for events dispatched by Human</p>
|
||||
</div><div><p>Possible events:</p>
|
||||
<ul>
|
||||
|
@ -40,31 +40,31 @@
|
|||
<li><code>warmup</code>: triggered when warmup is complete</li>
|
||||
<li><code>error</code>: triggered on some errors</li>
|
||||
</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#L143">human.ts:143</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#L144">human.ts:144</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>
|
||||
</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#L145">human.ts:145</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#L146">human.ts:146</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>
|
||||
</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"><</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">></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="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"><</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">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L153">human.ts:153</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<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"><</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">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L147">human.ts:147</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"><</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">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L148">human.ts:148</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>
|
||||
</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"><</span><span class="tsd-signature-type">Rank</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#L102">human.ts:102</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"><</span><span class="tsd-signature-type">Rank</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#L103">human.ts:103</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<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"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></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#L93">human.ts:93</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"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></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#L94">human.ts:94</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Last known result of detect run</p>
|
||||
<ul>
|
||||
<li>Can be accessed anytime after initial detection</li>
|
||||
<li>Definition: <a href="../interfaces/Result.html">Result</a></li>
|
||||
</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#L99">human.ts:99</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#L100">human.ts:100</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Current state of Human library</p>
|
||||
<ul>
|
||||
<li>Can be polled to determine operations that are currently executed</li>
|
||||
<li>Progresses through: 'config', 'check', 'backend', 'load', 'run:<model>', 'idle'</li>
|
||||
</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#L81">human.ts:81</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#L82">human.ts:82</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>
|
||||
</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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><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"><</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">></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#L388">human.ts:388</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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><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"><</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">></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#L389">human.ts:389</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Main detection method</p>
|
||||
<ul>
|
||||
<li>Analyze configuration: <a href="../interfaces/Config.html">Config</a></li>
|
||||
|
@ -73,12 +73,12 @@
|
|||
<li>Process and return result: <a href="../interfaces/Result.html">Result</a></li>
|
||||
</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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</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">></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"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></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"><</span><span class="tsd-signature-type">Rank</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#L288">human.ts:288</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"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></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"><</span><span class="tsd-signature-type">Rank</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#L289">human.ts:289</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>
|
||||
</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"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></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"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></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"><</span><span class="tsd-signature-type">Rank</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#L248">human.ts:248</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"><</span><span class="tsd-signature-type">Rank</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#L249">human.ts:249</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<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"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></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"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></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"><</span><span class="tsd-signature-type">void</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#L311">human.ts:311</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"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></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"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></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"><</span><span class="tsd-signature-type">void</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#L312">human.ts:312</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Explicit backend initialization</p>
|
||||
<ul>
|
||||
<li>Normally done implicitly during initial load phase</li>
|
||||
|
@ -86,22 +86,22 @@
|
|||
<li>Use when changing backend during runtime</li>
|
||||
</ul>
|
||||
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><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"><</span><span class="tsd-signature-type">void</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#L323">human.ts:323</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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><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"><</span><span class="tsd-signature-type">void</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#L324">human.ts:324</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Load method preloads all configured models on-demand</p>
|
||||
<ul>
|
||||
<li>Not explicitly required as any required model is load implicitly on it's first run</li>
|
||||
</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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></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#L300">human.ts:300</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#L301">human.ts:301</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>
|
||||
</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#L364">human.ts:364</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#L365">human.ts:365</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<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>
|
||||
</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#L232">human.ts:232</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#L233">human.ts:233</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<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"><</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">></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#L278">human.ts:278</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"><</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">></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>Segmentation method takes any input and returns processed canvas with body segmentation</p>
|
||||
<ul>
|
||||
<li>Optional parameter background is used to fill the background with specific input</li>
|
||||
|
@ -113,16 +113,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>alpha</code> as grayscale canvas that represents segmentation alpha values</li>
|
||||
</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"><</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">></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#L261">human.ts:261</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"><</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">></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#L262">human.ts:262</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>
|
||||
<ul>
|
||||
<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>
|
||||
</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></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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></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#L239">human.ts:239</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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></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#L240">human.ts:240</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><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"><</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">></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#L374">human.ts:374</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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></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"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><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"><</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">></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#L375">human.ts:375</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>
|
||||
<ul>
|
||||
<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
File diff suppressed because one or more lines are too long
|
@ -1,9 +1,9 @@
|
|||
<!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Config | @vladmandic/human - v2.2.3</title><meta name="description" content="Documentation for @vladmandic/human - v2.2.3"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vladmandic/human - v2.2.3</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human - v2.2.3</a></li><li><a href="Config.html">Config</a></li></ul><h1>Interface Config</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Configuration interface definition for <strong>Human</strong> library</p>
|
||||
</div><div><p>Contains all configurable parameters</p>
|
||||
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Config</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#async" class="tsd-kind-icon">async</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#backend" class="tsd-kind-icon">backend</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#body" class="tsd-kind-icon">body</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#cacheSensitivity" class="tsd-kind-icon">cache<wbr/>Sensitivity</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#debug" class="tsd-kind-icon">debug</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#face" class="tsd-kind-icon">face</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#filter" class="tsd-kind-icon">filter</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#gesture" class="tsd-kind-icon">gesture</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#hand" class="tsd-kind-icon">hand</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#modelBasePath" class="tsd-kind-icon">model<wbr/>Base<wbr/>Path</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#object" class="tsd-kind-icon">object</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#segmentation" class="tsd-kind-icon">segmentation</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#skipFrame" class="tsd-kind-icon">skip<wbr/>Frame</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#warmup" class="tsd-kind-icon">warmup</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#wasmPath" class="tsd-kind-icon">wasm<wbr/>Path</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="async" class="tsd-anchor"></a><h3>async</h3><div class="tsd-signature tsd-kind-icon">async<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L245">config.ts:245</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Config</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#async" class="tsd-kind-icon">async</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#backend" class="tsd-kind-icon">backend</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#body" class="tsd-kind-icon">body</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#cacheSensitivity" class="tsd-kind-icon">cache<wbr/>Sensitivity</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#debug" class="tsd-kind-icon">debug</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#face" class="tsd-kind-icon">face</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#filter" class="tsd-kind-icon">filter</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#gesture" class="tsd-kind-icon">gesture</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#hand" class="tsd-kind-icon">hand</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#modelBasePath" class="tsd-kind-icon">model<wbr/>Base<wbr/>Path</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#object" class="tsd-kind-icon">object</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#segmentation" class="tsd-kind-icon">segmentation</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#skipFrame" class="tsd-kind-icon">skip<wbr/>Frame</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#warmup" class="tsd-kind-icon">warmup</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Config.html#wasmPath" class="tsd-kind-icon">wasm<wbr/>Path</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="async" class="tsd-anchor"></a><h3>async</h3><div class="tsd-signature tsd-kind-icon">async<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L249">config.ts:249</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Perform model loading and inference concurrently or sequentially</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="backend" class="tsd-anchor"></a><h3>backend</h3><div class="tsd-signature tsd-kind-icon">backend<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">""</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"cpu"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"wasm"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"webgl"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"humangl"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"tensorflow"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"webgpu"</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L233">config.ts:233</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="backend" class="tsd-anchor"></a><h3>backend</h3><div class="tsd-signature tsd-kind-icon">backend<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">""</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"cpu"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"wasm"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"webgl"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"humangl"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"tensorflow"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"webgpu"</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L237">config.ts:237</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Backend used for TFJS operations
|
||||
Valid build-in backends are:</p>
|
||||
<ul>
|
||||
|
@ -15,45 +15,45 @@ Valid build-in backends are:</p>
|
|||
<li>Browser: <code>webgpu</code> - requires custom build of <code>tfjs-backend-webgpu</code></li>
|
||||
</ul>
|
||||
<p>Defaults: <code>humangl</code> for browser and <code>tensorflow</code> for nodejs</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="body" class="tsd-anchor"></a><h3>body</h3><div class="tsd-signature tsd-kind-icon">body<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="BodyConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">BodyConfig</a><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/config.ts#L281">config.ts:281</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="body" class="tsd-anchor"></a><h3>body</h3><div class="tsd-signature tsd-kind-icon">body<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="BodyConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">BodyConfig</a><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/config.ts#L285">config.ts:285</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p><a href="BodyConfig.html">BodyConfig</a></p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="cacheSensitivity" class="tsd-anchor"></a><h3>cache<wbr/>Sensitivity</h3><div class="tsd-signature tsd-kind-icon">cache<wbr/>Sensitivity<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L262">config.ts:262</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="cacheSensitivity" class="tsd-anchor"></a><h3>cache<wbr/>Sensitivity</h3><div class="tsd-signature tsd-kind-icon">cache<wbr/>Sensitivity<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L266">config.ts:266</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Cache sensitivity</p>
|
||||
<ul>
|
||||
<li>values 0..1 where 0.01 means reset cache if input changed more than 1%</li>
|
||||
<li>set to 0 to disable caching</li>
|
||||
</ul>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="debug" class="tsd-anchor"></a><h3>debug</h3><div class="tsd-signature tsd-kind-icon">debug<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L242">config.ts:242</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="debug" class="tsd-anchor"></a><h3>debug</h3><div class="tsd-signature tsd-kind-icon">debug<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L246">config.ts:246</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Print debug statements to console</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="face" class="tsd-anchor"></a><h3>face</h3><div class="tsd-signature tsd-kind-icon">face<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="FaceConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">FaceConfig</a><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/config.ts#L278">config.ts:278</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="face" class="tsd-anchor"></a><h3>face</h3><div class="tsd-signature tsd-kind-icon">face<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="FaceConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">FaceConfig</a><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/config.ts#L282">config.ts:282</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p><a href="FaceConfig.html">FaceConfig</a></p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="filter" class="tsd-anchor"></a><h3>filter</h3><div class="tsd-signature tsd-kind-icon">filter<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="FilterConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">FilterConfig</a><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/config.ts#L272">config.ts:272</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="filter" class="tsd-anchor"></a><h3>filter</h3><div class="tsd-signature tsd-kind-icon">filter<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="FilterConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">FilterConfig</a><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/config.ts#L276">config.ts:276</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Run input through image filters before inference</p>
|
||||
<ul>
|
||||
<li>image filters run with near-zero latency as they are executed on the GPU</li>
|
||||
</ul>
|
||||
</div><div><p><a href="FilterConfig.html">FilterConfig</a></p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="gesture" class="tsd-anchor"></a><h3>gesture</h3><div class="tsd-signature tsd-kind-icon">gesture<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="GestureConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">GestureConfig</a><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/config.ts#L275">config.ts:275</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="gesture" class="tsd-anchor"></a><h3>gesture</h3><div class="tsd-signature tsd-kind-icon">gesture<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="GestureConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">GestureConfig</a><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/config.ts#L279">config.ts:279</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p><a href="GestureConfig.html">GestureConfig</a></p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="hand" class="tsd-anchor"></a><h3>hand</h3><div class="tsd-signature tsd-kind-icon">hand<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="HandConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">HandConfig</a><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/config.ts#L284">config.ts:284</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="hand" class="tsd-anchor"></a><h3>hand</h3><div class="tsd-signature tsd-kind-icon">hand<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="HandConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">HandConfig</a><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/config.ts#L288">config.ts:288</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p><a href="HandConfig.html">HandConfig</a></p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="modelBasePath" class="tsd-anchor"></a><h3>model<wbr/>Base<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Base<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L256">config.ts:256</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="modelBasePath" class="tsd-anchor"></a><h3>model<wbr/>Base<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Base<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L260">config.ts:260</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Base model path (typically starting with file://, http:// or https://) for all models</p>
|
||||
<ul>
|
||||
<li>individual modelPath values are relative to this path</li>
|
||||
</ul>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="object" class="tsd-anchor"></a><h3>object</h3><div class="tsd-signature tsd-kind-icon">object<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="ObjectConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">ObjectConfig</a><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/config.ts#L287">config.ts:287</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="object" class="tsd-anchor"></a><h3>object</h3><div class="tsd-signature tsd-kind-icon">object<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="ObjectConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">ObjectConfig</a><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/config.ts#L291">config.ts:291</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p><a href="ObjectConfig.html">ObjectConfig</a></p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="segmentation" class="tsd-anchor"></a><h3>segmentation</h3><div class="tsd-signature tsd-kind-icon">segmentation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="SegmentationConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">SegmentationConfig</a><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/config.ts#L290">config.ts:290</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="segmentation" class="tsd-anchor"></a><h3>segmentation</h3><div class="tsd-signature tsd-kind-icon">segmentation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="SegmentationConfig.html" class="tsd-signature-type" data-tsd-kind="Interface">SegmentationConfig</a><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/config.ts#L294">config.ts:294</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p><a href="SegmentationConfig.html">SegmentationConfig</a></p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="skipFrame" class="tsd-anchor"></a><h3>skip<wbr/>Frame</h3><div class="tsd-signature tsd-kind-icon">skip<wbr/>Frame<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L265">config.ts:265</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="skipFrame" class="tsd-anchor"></a><h3>skip<wbr/>Frame</h3><div class="tsd-signature tsd-kind-icon">skip<wbr/>Frame<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L269">config.ts:269</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Internal Variable</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="warmup" class="tsd-anchor"></a><h3>warmup</h3><div class="tsd-signature tsd-kind-icon">warmup<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"face"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"body"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"none"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"full"</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L250">config.ts:250</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="warmup" class="tsd-anchor"></a><h3>warmup</h3><div class="tsd-signature tsd-kind-icon">warmup<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"face"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"body"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"none"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"full"</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L254">config.ts:254</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>What to use for <code>human.warmup()</code></p>
|
||||
<ul>
|
||||
<li>warmup pre-initializes all models for faster inference but can take significant time on startup</li>
|
||||
</ul>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="wasmPath" class="tsd-anchor"></a><h3>wasm<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">wasm<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L239">config.ts:239</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="wasmPath" class="tsd-anchor"></a><h3>wasm<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">wasm<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L243">config.ts:243</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Path to *.wasm files if backend is set to <code>wasm</code></p>
|
||||
<ul>
|
||||
<li>if not set, auto-detects to link to CDN <code>jsdelivr</code> when running in browser</li>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,44 +4,44 @@
|
|||
<li>available only in Browser environments</li>
|
||||
<li>image filters run with near-zero latency as they are executed on the GPU using WebGL</li>
|
||||
</ul>
|
||||
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">FilterConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#brightness" class="tsd-kind-icon">brightness</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#contrast" class="tsd-kind-icon">contrast</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#flip" class="tsd-kind-icon">flip</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#height" class="tsd-kind-icon">height</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#hue" class="tsd-kind-icon">hue</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#kodachrome" class="tsd-kind-icon">kodachrome</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#negative" class="tsd-kind-icon">negative</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#pixelate" class="tsd-kind-icon">pixelate</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#polaroid" class="tsd-kind-icon">polaroid</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#return" class="tsd-kind-icon">return</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#saturation" class="tsd-kind-icon">saturation</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#sepia" class="tsd-kind-icon">sepia</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#sharpness" class="tsd-kind-icon">sharpness</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#technicolor" class="tsd-kind-icon">technicolor</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#vintage" class="tsd-kind-icon">vintage</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#width" class="tsd-kind-icon">width</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="blur" class="tsd-anchor"></a><h3>blur</h3><div class="tsd-signature tsd-kind-icon">blur<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L188">config.ts:188</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">FilterConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#brightness" class="tsd-kind-icon">brightness</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#contrast" class="tsd-kind-icon">contrast</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#flip" class="tsd-kind-icon">flip</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#height" class="tsd-kind-icon">height</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#hue" class="tsd-kind-icon">hue</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#kodachrome" class="tsd-kind-icon">kodachrome</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#negative" class="tsd-kind-icon">negative</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#pixelate" class="tsd-kind-icon">pixelate</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#polaroid" class="tsd-kind-icon">polaroid</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#return" class="tsd-kind-icon">return</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#saturation" class="tsd-kind-icon">saturation</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#sepia" class="tsd-kind-icon">sepia</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#sharpness" class="tsd-kind-icon">sharpness</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#technicolor" class="tsd-kind-icon">technicolor</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#vintage" class="tsd-kind-icon">vintage</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="FilterConfig.html#width" class="tsd-kind-icon">width</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="blur" class="tsd-anchor"></a><h3>blur</h3><div class="tsd-signature tsd-kind-icon">blur<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L192">config.ts:192</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Range: 0 (no blur) to N (blur radius in pixels)</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="brightness" class="tsd-anchor"></a><h3>brightness</h3><div class="tsd-signature tsd-kind-icon">brightness<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L182">config.ts:182</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="brightness" class="tsd-anchor"></a><h3>brightness</h3><div class="tsd-signature tsd-kind-icon">brightness<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L186">config.ts:186</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Range: -1 (darken) to 1 (lighten)</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="contrast" class="tsd-anchor"></a><h3>contrast</h3><div class="tsd-signature tsd-kind-icon">contrast<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L184">config.ts:184</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="contrast" class="tsd-anchor"></a><h3>contrast</h3><div class="tsd-signature tsd-kind-icon">contrast<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L188">config.ts:188</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Range: -1 (reduce contrast) to 1 (increase contrast)</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L164">config.ts:164</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="flip" class="tsd-anchor"></a><h3>flip</h3><div class="tsd-signature tsd-kind-icon">flip<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L180">config.ts:180</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L168">config.ts:168</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="flip" class="tsd-anchor"></a><h3>flip</h3><div class="tsd-signature tsd-kind-icon">flip<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L184">config.ts:184</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Flip input as mirror image</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="height" class="tsd-anchor"></a><h3>height</h3><div class="tsd-signature tsd-kind-icon">height<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L176">config.ts:176</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="height" class="tsd-anchor"></a><h3>height</h3><div class="tsd-signature tsd-kind-icon">height<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L180">config.ts:180</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Resize input height</p>
|
||||
<ul>
|
||||
<li>if both width and height are set to 0, there is no resizing</li>
|
||||
<li>if just one is set, second one is scaled automatically</li>
|
||||
<li>if both are set, values are used as-is</li>
|
||||
</ul>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="hue" class="tsd-anchor"></a><h3>hue</h3><div class="tsd-signature tsd-kind-icon">hue<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L192">config.ts:192</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="hue" class="tsd-anchor"></a><h3>hue</h3><div class="tsd-signature tsd-kind-icon">hue<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L196">config.ts:196</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Range: 0 (no change) to 360 (hue rotation in degrees)</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="kodachrome" class="tsd-anchor"></a><h3>kodachrome</h3><div class="tsd-signature tsd-kind-icon">kodachrome<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L200">config.ts:200</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="kodachrome" class="tsd-anchor"></a><h3>kodachrome</h3><div class="tsd-signature tsd-kind-icon">kodachrome<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L204">config.ts:204</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Image kodachrome colors</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="negative" class="tsd-anchor"></a><h3>negative</h3><div class="tsd-signature tsd-kind-icon">negative<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L194">config.ts:194</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="negative" class="tsd-anchor"></a><h3>negative</h3><div class="tsd-signature tsd-kind-icon">negative<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L198">config.ts:198</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Image negative</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="pixelate" class="tsd-anchor"></a><h3>pixelate</h3><div class="tsd-signature tsd-kind-icon">pixelate<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L206">config.ts:206</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="pixelate" class="tsd-anchor"></a><h3>pixelate</h3><div class="tsd-signature tsd-kind-icon">pixelate<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L210">config.ts:210</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Range: 0 (no pixelate) to N (number of pixels to pixelate)</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="polaroid" class="tsd-anchor"></a><h3>polaroid</h3><div class="tsd-signature tsd-kind-icon">polaroid<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L204">config.ts:204</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="polaroid" class="tsd-anchor"></a><h3>polaroid</h3><div class="tsd-signature tsd-kind-icon">polaroid<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L208">config.ts:208</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Image polaroid camera effect</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="return" class="tsd-anchor"></a><h3>return</h3><div class="tsd-signature tsd-kind-icon">return<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L178">config.ts:178</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="return" class="tsd-anchor"></a><h3>return</h3><div class="tsd-signature tsd-kind-icon">return<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L182">config.ts:182</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Return processed canvas imagedata in result</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="saturation" class="tsd-anchor"></a><h3>saturation</h3><div class="tsd-signature tsd-kind-icon">saturation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L190">config.ts:190</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="saturation" class="tsd-anchor"></a><h3>saturation</h3><div class="tsd-signature tsd-kind-icon">saturation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L194">config.ts:194</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Range: -1 (reduce saturation) to 1 (increase saturation)</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="sepia" class="tsd-anchor"></a><h3>sepia</h3><div class="tsd-signature tsd-kind-icon">sepia<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L196">config.ts:196</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="sepia" class="tsd-anchor"></a><h3>sepia</h3><div class="tsd-signature tsd-kind-icon">sepia<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L200">config.ts:200</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Image sepia colors</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="sharpness" class="tsd-anchor"></a><h3>sharpness</h3><div class="tsd-signature tsd-kind-icon">sharpness<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L186">config.ts:186</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="sharpness" class="tsd-anchor"></a><h3>sharpness</h3><div class="tsd-signature tsd-kind-icon">sharpness<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L190">config.ts:190</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Range: 0 (no sharpening) to 1 (maximum sharpening)</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="technicolor" class="tsd-anchor"></a><h3>technicolor</h3><div class="tsd-signature tsd-kind-icon">technicolor<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L202">config.ts:202</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="technicolor" class="tsd-anchor"></a><h3>technicolor</h3><div class="tsd-signature tsd-kind-icon">technicolor<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L206">config.ts:206</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Image technicolor colors</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="vintage" class="tsd-anchor"></a><h3>vintage</h3><div class="tsd-signature tsd-kind-icon">vintage<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L198">config.ts:198</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="vintage" class="tsd-anchor"></a><h3>vintage</h3><div class="tsd-signature tsd-kind-icon">vintage<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L202">config.ts:202</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Image vintage colors</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="width" class="tsd-anchor"></a><h3>width</h3><div class="tsd-signature tsd-kind-icon">width<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L170">config.ts:170</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="width" class="tsd-anchor"></a><h3>width</h3><div class="tsd-signature tsd-kind-icon">width<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L174">config.ts:174</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Resize input width</p>
|
||||
<ul>
|
||||
<li>if both width and height are set to 0, there is no resizing</li>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>GestureConfig | @vladmandic/human - v2.2.3</title><meta name="description" content="Documentation for @vladmandic/human - v2.2.3"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vladmandic/human - v2.2.3</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human - v2.2.3</a></li><li><a href="GestureConfig.html">GestureConfig</a></li></ul><h1>Interface GestureConfig</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Controlls gesture detection</p>
|
||||
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">GestureConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GestureConfig.html#enabled" class="tsd-kind-icon">enabled</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L211">config.ts:211</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="GestureConfig.html" class="tsd-kind-icon">Gesture<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GestureConfig.html#enabled" class="tsd-kind-icon">enabled</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
||||
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">GestureConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GestureConfig.html#enabled" class="tsd-kind-icon">enabled</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L215">config.ts:215</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="GestureConfig.html" class="tsd-kind-icon">Gesture<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GestureConfig.html#enabled" class="tsd-kind-icon">enabled</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -11,4 +11,4 @@ remove background or replace it with user-provided background</p>
|
|||
</ul>
|
||||
<p>Changing <code>modelPath</code> will change module responsible for hand detection and tracking
|
||||
Allowed values are <code>selfie.json</code> and <code>meet.json</code></p>
|
||||
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">SegmentationConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="blur" class="tsd-anchor"></a><h3>blur</h3><div class="tsd-signature tsd-kind-icon">blur<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L156">config.ts:156</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L154">config.ts:154</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="modelPath" class="tsd-anchor"></a><h3>model<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L155">config.ts:155</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="SegmentationConfig.html" class="tsd-kind-icon">Segmentation<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
||||
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">SegmentationConfig</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="blur" class="tsd-anchor"></a><h3>blur</h3><div class="tsd-signature tsd-kind-icon">blur<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L160">config.ts:160</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="enabled" class="tsd-anchor"></a><h3>enabled</h3><div class="tsd-signature tsd-kind-icon">enabled<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L158">config.ts:158</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="modelPath" class="tsd-anchor"></a><h3>model<wbr/>Path</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L159">config.ts:159</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="SegmentationConfig.html" class="tsd-kind-icon">Segmentation<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#blur" class="tsd-kind-icon">blur</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#enabled" class="tsd-kind-icon">enabled</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="SegmentationConfig.html#modelPath" class="tsd-kind-icon">model<wbr/>Path</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../../src/blazepose/annotations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,IAAI,UAwChB,CAAC;AAEF,eAAO,MAAM,KAAK,UAgCjB,CAAC"}
|
|
@ -1,11 +0,0 @@
|
|||
/**
|
||||
* BlazePose model implementation
|
||||
*
|
||||
* Based on : [**BlazePose**](https://drive.google.com/file/d/10IU-DRP2ioSNjKFdiGbmmQX81xAYj88s/view)
|
||||
*/
|
||||
import type { Tensor, GraphModel } from '../tfjs/types';
|
||||
import type { BodyResult } from '../result';
|
||||
import type { Config } from '../config';
|
||||
export declare function load(config: Config): Promise<GraphModel>;
|
||||
export declare function predict(image: Tensor, config: Config): Promise<BodyResult[]>;
|
||||
//# sourceMappingURL=blazepose.d.ts.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"blazepose.d.ts","sourceRoot":"","sources":["../../../src/blazepose/blazepose.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAKxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAU9D;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA4ClF"}
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../../src/body/annotations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,IAAI,UAwChB,CAAC;AAEF,eAAO,MAAM,KAAK,UAgCjB,CAAC"}
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* BlazePose model implementation
|
||||
*
|
||||
* Based on : [**BlazePose**](https://github.com/google/mediapipe/blob/master/mediapipe/modules/pose_detection)
|
||||
*/
|
||||
import type { BodyResult } from '../result';
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
export declare function loadDetect(config: Config): Promise<GraphModel>;
|
||||
export declare function loadPose(config: Config): Promise<GraphModel>;
|
||||
export declare function load(config: Config): Promise<[GraphModel | null, GraphModel | null]>;
|
||||
export declare function predict(input: Tensor, config: Config): Promise<BodyResult[]>;
|
||||
//# sourceMappingURL=blazepose.d.ts.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"blazepose.d.ts","sourceRoot":"","sources":["../../../src/body/blazepose.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAoCxC,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAWpE;AAED,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAWlE;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,CAI1F;AA8DD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAsBlF"}
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"efficientpose.d.ts","sourceRoot":"","sources":["../../../src/body/efficientpose.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAO,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAexC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ9D;AAmBD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAkElF"}
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"movenet.d.ts","sourceRoot":"","sources":["../../../src/body/movenet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAgBxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAW9D;AAsFD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA2ClF"}
|
|
@ -61,6 +61,7 @@ export interface FaceConfig {
|
|||
* - modelPath: body pose model, can be absolute path or relative to modelBasePath
|
||||
* - minConfidence: threshold for discarding a prediction
|
||||
* - maxDetected: maximum number of people detected in the input, should be set to the minimum number for performance
|
||||
* - detector: optional body detector
|
||||
*
|
||||
* `maxDetected` is valid for `posenet` and `movenet-multipose` as other models are single-pose only
|
||||
* `maxDetected` can be set to -1 to auto-detect based on number of detected faces
|
||||
|
@ -74,6 +75,9 @@ export interface BodyConfig {
|
|||
maxDetected: number;
|
||||
minConfidence: number;
|
||||
skipFrames: number;
|
||||
detector?: {
|
||||
modelPath: string;
|
||||
};
|
||||
}
|
||||
/** Controlls and configures all hand detection specific options
|
||||
*
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAGA,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;EAWE;AACF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACtC,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9B,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC5C,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;;EAaE;AACF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;EAeE;AACF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,QAAQ,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;;;;;;;;EASE;AACF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;EAaE;AACF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;EAGE;AACF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB;;;;MAIE;IACF,KAAK,EAAE,MAAM,CAAC;IACd;;;;MAIE;IACF,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAA;IACZ,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,qBAAqB;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,yBAAyB;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,2BAA2B;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,+BAA+B;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,mCAAmC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,kCAAkC;AAClC,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,MAAM;IACrB;;;;;;;;;MASE;IACF,OAAO,EAAE,EAAE,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;IAG7E;;MAEE;IACF,QAAQ,EAAE,MAAM,CAAC;IAEjB,wCAAwC;IACxC,KAAK,EAAE,OAAO,CAAC;IAEf,uEAAuE;IACvE,KAAK,EAAE,OAAO,CAAC;IAEf;;MAEE;IACF,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAG1C;;MAEE;IACF,aAAa,EAAE,MAAM,CAAC;IAEtB;;;MAGE;IACF,gBAAgB,EAAE,MAAM,CAAC;IAEzB,wBAAwB;IACxB,SAAS,EAAE,OAAO,CAAC;IAEnB;;;;MAIE;IACF,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9B,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhC,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,2BAA2B;IAC3B,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9B,iCAAiC;IACjC,YAAY,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,QAAA,MAAM,MAAM,EAAE,MAgKb,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,CAAC"}
|
||||
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAGA,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;EAWE;AACF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACtC,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9B,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC5C,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;;;EAcE;AACF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QACT,SAAS,EAAE,MAAM,CAAA;KAClB,CAAC;CACH;AAED;;;;;;;;;;;;;;;EAeE;AACF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,QAAQ,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;;;;;;;;EASE;AACF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;EAaE;AACF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;EAGE;AACF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB;;;;MAIE;IACF,KAAK,EAAE,MAAM,CAAC;IACd;;;;MAIE;IACF,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAA;IACZ,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,qBAAqB;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,yBAAyB;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,2BAA2B;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,+BAA+B;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,mCAAmC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,kCAAkC;AAClC,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,MAAM;IACrB;;;;;;;;;MASE;IACF,OAAO,EAAE,EAAE,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;IAG7E;;MAEE;IACF,QAAQ,EAAE,MAAM,CAAC;IAEjB,wCAAwC;IACxC,KAAK,EAAE,OAAO,CAAC;IAEf,uEAAuE;IACvE,KAAK,EAAE,OAAO,CAAC;IAEf;;MAEE;IACF,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAG1C;;MAEE;IACF,aAAa,EAAE,MAAM,CAAC;IAEtB;;;MAGE;IACF,gBAAgB,EAAE,MAAM,CAAC;IAEzB,wBAAwB;IACxB,SAAS,EAAE,OAAO,CAAC;IAEnB;;;;MAIE;IACF,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9B,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhC,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,2BAA2B;IAC3B,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9B,iCAAiC;IACjC,YAAY,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,QAAA,MAAM,MAAM,EAAE,MAmKb,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,CAAC"}
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../src/draw.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEtH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,OAAO,EAAE,WAkBrB,CAAC;AA2EF,wBAAsB,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,eAAe,EAAE,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,iBAuB5I;AAED,wBAAsB,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,eAAe,EAAE,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,iBAoGtI;AAED,wBAAsB,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,eAAe,EAAE,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,iBA4GtI;AAED,wBAAsB,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,eAAe,EAAE,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,iBA+DtI;AAED,wBAAsB,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,eAAe,EAAE,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,iBAuB1I;AAED,wBAAsB,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,eAAe,EAAE,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,iBAwB1I;AAED,wBAAsB,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,EAAE,MAAM,EAAE,iBAAiB,iBAI1J;AAED,wBAAsB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,GAAG,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,kDAc1H"}
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"efficientpose.d.ts","sourceRoot":"","sources":["../../../src/efficientpose/efficientpose.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAO,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAexC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ9D;AAmBD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAkElF"}
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"emotion.d.ts","sourceRoot":"","sources":["../../../src/emotion/emotion.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAcxD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ9D;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBAuCtE"}
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAIA,oBAAY,GAAG,GAAG;IAChB,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC;IAC7B,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC;IAC7B,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE;QACJ,OAAO,EAAE,SAAS,GAAG,MAAM,CAAC;KAC7B,CAAC;IACF,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC;IAC/B,IAAI,EAAE;QACJ,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC;QAC/B,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC;QAC7B,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;QAC1B,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC;KAClC,CAAC;IACF,KAAK,EAAE;QACL,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC;QAC/B,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC;QAC7B,OAAO,EAAE,SAAS,GAAG,MAAM,CAAC;QAC5B,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC;KAC9B,CAAC;IACF,MAAM,EAAE;QACN,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC;QAC/B,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC;QAC7B,OAAO,EAAE,SAAS,GAAG,MAAM,CAAC;KAC7B,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAA;AAGD,eAAO,IAAI,GAAG,EAAE,GAiCf,CAAC;AAEF,wBAAsB,OAAO,kBAmB5B;AAED,wBAAsB,WAAW,kBA8BhC;AAED,wBAAsB,GAAG,kBA2BxB;AAED,wBAAsB,GAAG,CAAC,GAAG,KAAA,iBAE5B"}
|
|
@ -1 +0,0 @@
|
|||
{"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"}
|
|
@ -2,7 +2,7 @@
|
|||
* Face algorithm implementation
|
||||
* Uses FaceMesh, Emotion and FaceRes models to create a unified pipeline
|
||||
*/
|
||||
import type { FaceResult } from './result';
|
||||
import type { Tensor } from './tfjs/types';
|
||||
import type { FaceResult } from '../result';
|
||||
import type { Tensor } from '../tfjs/types';
|
||||
export declare const detectFace: (parent: any, input: Tensor) => Promise<FaceResult[]>;
|
||||
//# sourceMappingURL=face.d.ts.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"face.d.ts","sourceRoot":"","sources":["../../../src/face/face.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAwI5C,eAAO,MAAM,UAAU,uBAAiD,MAAM,KAAG,QAAQ,UAAU,EAAE,CAoHpG,CAAC"}
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"faceres.d.ts","sourceRoot":"","sources":["../../../src/face/faceres.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAcxC,aAAK,EAAE,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC;AAEvE,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAS9D;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,SAAI,GAAG,MAAM,CAWlG;AAED,wBAAgB,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,SAAI;;;;;EAUpE;AAED,wBAAgB,OAAO,CAAC,KAAK,KAAA,GAAG,MAAM,CAmDrC;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBA8CtE"}
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"faceres.d.ts","sourceRoot":"","sources":["../../../src/faceres/faceres.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAcxC,aAAK,EAAE,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC;AAEvE,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAS9D;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,SAAI,GAAG,MAAM,CAWlG;AAED,wBAAgB,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,SAAI;;;;;EAUpE;AAED,wBAAgB,OAAO,CAAC,KAAK,KAAA,GAAG,MAAM,CAmDrC;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBA8CtE"}
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"agegenderrace.d.ts","sourceRoot":"","sources":["../../../src/gear/agegenderrace.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AASxD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,uBAQ9C;AAGD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBA0C1D"}
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"emotion.d.ts","sourceRoot":"","sources":["../../../src/gear/emotion.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAcxD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ9D;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBAuCtE"}
|
|
@ -10,4 +10,4 @@ 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
|
||||
//# sourceMappingURL=gear-agegenderrace.d.ts.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"gear-agegenderrace.d.ts","sourceRoot":"","sources":["../../../src/gear/gear-agegenderrace.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AASxD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,uBAQ9C;AAGD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBA0C1D"}
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"handtrack.d.ts","sourceRoot":"","sources":["../../../src/hand/handtrack.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAO,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA4CxC,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAepE;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAWtE;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,CAI1F;AAgGD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAmBlF"}
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"handtrack.d.ts","sourceRoot":"","sources":["../../../src/handtrack/handtrack.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAO,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA4CxC,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAepE;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAWtE;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,CAI1F;AAgGD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAmBlF"}
|
|
@ -6,13 +6,13 @@ import type { Result } from './result';
|
|||
import * as tf from '../dist/tfjs.esm.js';
|
||||
import * as models from './models';
|
||||
import * as facemesh from './blazeface/facemesh';
|
||||
import * as env from './env';
|
||||
import * as env from './util/env';
|
||||
import type { Tensor } from './tfjs/types';
|
||||
import type { DrawOptions } from './draw';
|
||||
import type { DrawOptions } from './util/draw';
|
||||
export * from './config';
|
||||
export * from './result';
|
||||
export type { DrawOptions } from './draw';
|
||||
export { env, Env } from './env';
|
||||
export type { DrawOptions } from './util/draw';
|
||||
export { env, Env } from './util/env';
|
||||
export { Box, Point } from './result';
|
||||
export { Models } from './models';
|
||||
/** Defines all possible input types for **Human** detection
|
||||
|
|
|
@ -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;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,GAAG,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,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;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;MAGE;IACF,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;;;;;OAKG;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;;;MAGE;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;IA8CxC,cAAc;IACd,OAAO,WAAY,MAAM,EAAE,UAO1B;IAgBD,4CAA4C;IAC5C,KAAK;IAML,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;;;;;IAIrC;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,KAAK;;;;IAIlB;;;;;;;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;CAkKlF;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;AAiBjD,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAKlC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,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;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;MAGE;IACF,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;;;;;OAKG;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;;;MAGE;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;IA8CxC,cAAc;IACd,OAAO,WAAY,MAAM,EAAE,UAO1B;IAgBD,4CAA4C;IAC5C,KAAK;IAML,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;;;;;IAIrC;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,KAAK;;;;IAIlB;;;;;;;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;CAkKlF;AAED,oCAAoC;AACpC,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,CAAC"}
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import type { Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../env';
|
||||
import { env } from '../util/env';
|
||||
declare type Input = Tensor | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | typeof Image | typeof env.Canvas;
|
||||
export declare function canvas(width: any, height: any): HTMLCanvasElement | OffscreenCanvas;
|
||||
export declare function process(input: Input, config: Config): {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/image/image.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAG7B,aAAK,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,GAAG,OAAO,KAAK,GAAG,OAAO,GAAG,CAAC,MAAM,CAAC;AAShL,wBAAgB,MAAM,CAAC,KAAK,KAAA,EAAE,MAAM,KAAA,GAAG,iBAAiB,GAAG,eAAe,CAiBzE;AAKD,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,GAAG,IAAI,CAAA;CAAE,CAsLnI;AAID,wBAAsB,IAAI,CAAC,MAAM,KAAA,EAAE,KAAK,EAAE,MAAM,oBA2B/C"}
|
||||
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/image/image.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,aAAK,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,GAAG,OAAO,KAAK,GAAG,OAAO,GAAG,CAAC,MAAM,CAAC;AAShL,wBAAgB,MAAM,CAAC,KAAK,KAAA,EAAE,MAAM,KAAA,GAAG,iBAAiB,GAAG,eAAe,CAiBzE;AAKD,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,GAAG,IAAI,CAAA;CAAE,CAsLnI;AAID,wBAAsB,IAAI,CAAC,MAAM,KAAA,EAAE,KAAK,EAAE,MAAM,oBA2B/C"}
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"interpolate.d.ts","sourceRoot":"","sources":["../../src/interpolate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAA6F,MAAM,UAAU,CAAC;AAIlI,wBAAgB,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAmI9C"}
|
|
@ -12,6 +12,7 @@ import type { Human } from './human';
|
|||
export declare class Models {
|
||||
age: null | GraphModel | Promise<GraphModel>;
|
||||
agegenderrace: null | GraphModel | Promise<GraphModel>;
|
||||
blazeposedetect: null | GraphModel | Promise<GraphModel>;
|
||||
blazepose: null | GraphModel | Promise<GraphModel>;
|
||||
centernet: null | GraphModel | Promise<GraphModel>;
|
||||
efficientpose: null | GraphModel | Promise<GraphModel>;
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,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"}
|
||||
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,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,eAAe,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAChE,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,iBA8BzC;AAED,wBAAsB,QAAQ,CAAC,QAAQ,KAAA,iBA4CtC"}
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"movenet.d.ts","sourceRoot":"","sources":["../../../src/movenet/movenet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAO,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAgBxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAW9D;AAsFD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA2ClF"}
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAGpC,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMzD;AAGD,wBAAgB,GAAG,CAAC,GAAG,GAAG,OAAA,GAAG,IAAI,CAKhC;AAGD,eAAO,MAAM,GAAG,cAGf,CAAC;AAGF,wBAAgB,QAAQ,CAAC,QAAQ,KAAA,EAAE,MAAM,KAAA,EAAE,MAAM,SAAW,EAAE,IAAI,GAAE,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAM;YAAhD,MAAM;WAAS,MAAM;eAAa,MAAM;IAc3H;AAGD,wBAAgB,SAAS,CAAC,GAAG,OAAO,OAAA,OAYnC;AAGD,eAAO,MAAM,MAAM,SAAU,MAAM,MAAM,CAAC,aAIpC,CAAC;AAGP,wBAAsB,IAAI,CAAC,IAAI,KAAA,iBAG9B;AAGD,wBAAgB,QAAQ,CAAC,SAAS,KAAA,EAAE,YAAY,KAAA,EAAE,UAAU,KAAA;;;;EAwB3D"}
|
|
@ -0,0 +1,7 @@
|
|||
import type { Box } from '../result';
|
||||
export declare function scale(keypoints: any, boxScaleFact: any, outputSize: any): {
|
||||
box: Box;
|
||||
boxRaw: Box;
|
||||
yxBox: Box;
|
||||
};
|
||||
//# sourceMappingURL=box.d.ts.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../src/util/box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGrC,wBAAgB,KAAK,CAAC,SAAS,KAAA,EAAE,YAAY,KAAA,EAAE,UAAU,KAAA;;;;EAwBxD"}
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Module that implements helper draw functions, exposed as human.draw
|
||||
*/
|
||||
import type { Result, FaceResult, BodyResult, HandResult, ObjectResult, GestureResult, PersonResult } from './result';
|
||||
import type { Result, FaceResult, BodyResult, HandResult, ObjectResult, GestureResult, PersonResult } from '../result';
|
||||
/**
|
||||
* Draw Options
|
||||
* Accessed via `human.draw.options` or provided per each draw method as the drawOptions optional parameter
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue