mirror of https://github.com/vladmandic/human
restructure results strong typing
parent
92d3333e52
commit
1811e1c621
|
@ -9,11 +9,12 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2021/05/21 mandic00@live.com
|
||||
|
||||
|
||||
### **1.9.1** 2021/05/21 mandic00@live.com
|
||||
|
||||
|
||||
### **origin/main** 2021/05/20 mandic00@live.com
|
||||
|
||||
- caching improvements
|
||||
- sanitize server input
|
||||
- remove nanodet weights from default distribution
|
||||
- add experimental mb3-centernet object detection
|
||||
|
|
|
@ -10,7 +10,6 @@ let human;
|
|||
|
||||
const userConfig = {
|
||||
warmup: 'none',
|
||||
/*
|
||||
backend: 'webgl',
|
||||
async: false,
|
||||
cacheSensitivity: 0,
|
||||
|
@ -27,10 +26,9 @@ const userConfig = {
|
|||
},
|
||||
hand: { enabled: false },
|
||||
gesture: { enabled: false },
|
||||
body: { enabled: false, modelPath: 'posenet.json' },
|
||||
body: { enabled: true, modelPath: 'posenet.json' },
|
||||
// body: { enabled: true, modelPath: 'blazepose.json' },
|
||||
object: { enabled: false },
|
||||
*/
|
||||
};
|
||||
|
||||
// ui options
|
||||
|
@ -46,6 +44,7 @@ const ui = {
|
|||
maxFPSframes: 10, // keep fps history for how many frames
|
||||
modelsPreload: true, // preload human models on startup
|
||||
modelsWarmup: true, // warmup human models on startup
|
||||
buffered: true, // should output be buffered between frames
|
||||
|
||||
// internal variables
|
||||
busy: false, // internal camera busy flag
|
||||
|
@ -54,7 +53,6 @@ const ui = {
|
|||
camera: {}, // internal, holds details of webcam details
|
||||
detectFPS: [], // internal, holds fps values for detection performance
|
||||
drawFPS: [], // internal, holds fps values for draw performance
|
||||
buffered: false, // should output be buffered between frames
|
||||
drawWarmup: false, // debug only, should warmup image processing be displayed on startup
|
||||
drawThread: null, // internl, perform draw operations in a separate thread
|
||||
detectThread: null, // internl, perform detect operations in a separate thread
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -4452,6 +4452,7 @@ var detectFace = async (parent, input) => {
|
|||
}
|
||||
const irisSize = ((_e = faces[i].annotations) == null ? void 0 : _e.leftEyeIris) && ((_f = faces[i].annotations) == null ? void 0 : _f.rightEyeIris) ? 11.7 * Math.max(Math.abs(faces[i].annotations.leftEyeIris[3][0] - faces[i].annotations.leftEyeIris[1][0]), Math.abs(faces[i].annotations.rightEyeIris[4][1] - faces[i].annotations.rightEyeIris[2][1])) : 0;
|
||||
faceRes.push({
|
||||
id: i,
|
||||
...faces[i],
|
||||
age: descRes.age,
|
||||
gender: descRes.gender,
|
||||
|
@ -4562,8 +4563,11 @@ function getBoundingBox(keypoints) {
|
|||
return [coord.minX, coord.minY, coord.maxX - coord.minX, coord.maxY - coord.minY];
|
||||
}
|
||||
function scalePoses(poses2, [height, width], [inputResolutionHeight, inputResolutionWidth]) {
|
||||
const scalePose = (pose, scaleY, scaleX) => ({
|
||||
const scaleY = height / inputResolutionHeight;
|
||||
const scaleX = width / inputResolutionWidth;
|
||||
const scalePose = (pose) => ({
|
||||
score: pose.score,
|
||||
bowRaw: [pose.box[0] / inputResolutionWidth, pose.box[1] / inputResolutionHeight, pose.box[2] / inputResolutionWidth, pose.box[3] / inputResolutionHeight],
|
||||
box: [Math.trunc(pose.box[0] * scaleX), Math.trunc(pose.box[1] * scaleY), Math.trunc(pose.box[2] * scaleX), Math.trunc(pose.box[3] * scaleY)],
|
||||
keypoints: pose.keypoints.map(({ score, part, position }) => ({
|
||||
score,
|
||||
|
@ -4571,7 +4575,7 @@ function scalePoses(poses2, [height, width], [inputResolutionHeight, inputResolu
|
|||
position: { x: Math.trunc(position.x * scaleX), y: Math.trunc(position.y * scaleY) }
|
||||
}))
|
||||
});
|
||||
const scaledPoses = poses2.map((pose) => scalePose(pose, height / inputResolutionHeight, width / inputResolutionWidth));
|
||||
const scaledPoses = poses2.map((pose) => scalePose(pose));
|
||||
return scaledPoses;
|
||||
}
|
||||
var MaxHeap = class {
|
||||
|
@ -16952,26 +16956,26 @@ async function predict5(input, config3) {
|
|||
if (!predictions)
|
||||
return [];
|
||||
const hands = [];
|
||||
for (const prediction of predictions) {
|
||||
for (let i = 0; i < predictions.length; i++) {
|
||||
const annotations3 = {};
|
||||
if (prediction.landmarks) {
|
||||
if (predictions[i].landmarks) {
|
||||
for (const key of Object.keys(meshAnnotations)) {
|
||||
annotations3[key] = meshAnnotations[key].map((index) => prediction.landmarks[index]);
|
||||
annotations3[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);
|
||||
}
|
||||
}
|
||||
const box4 = prediction.box ? [
|
||||
Math.max(0, prediction.box.topLeft[0]),
|
||||
Math.max(0, prediction.box.topLeft[1]),
|
||||
Math.min(input.shape[2], prediction.box.bottomRight[0]) - Math.max(0, prediction.box.topLeft[0]),
|
||||
Math.min(input.shape[1], prediction.box.bottomRight[1]) - Math.max(0, prediction.box.topLeft[1])
|
||||
] : [];
|
||||
const box4 = predictions[i].box ? [
|
||||
Math.max(0, predictions[i].box.topLeft[0]),
|
||||
Math.max(0, predictions[i].box.topLeft[1]),
|
||||
Math.min(input.shape[2], predictions[i].box.bottomRight[0]) - Math.max(0, predictions[i].box.topLeft[0]),
|
||||
Math.min(input.shape[1], predictions[i].box.bottomRight[1]) - Math.max(0, predictions[i].box.topLeft[1])
|
||||
] : [0, 0, 0, 0];
|
||||
const boxRaw = [
|
||||
prediction.box.topLeft[0] / input.shape[2],
|
||||
prediction.box.topLeft[1] / input.shape[1],
|
||||
(prediction.box.bottomRight[0] - prediction.box.topLeft[0]) / input.shape[2],
|
||||
(prediction.box.bottomRight[1] - prediction.box.topLeft[1]) / input.shape[1]
|
||||
predictions[i].box.topLeft[0] / input.shape[2],
|
||||
predictions[i].box.topLeft[1] / input.shape[1],
|
||||
(predictions[i].box.bottomRight[0] - predictions[i].box.topLeft[0]) / input.shape[2],
|
||||
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / input.shape[1]
|
||||
];
|
||||
hands.push({ confidence: Math.round(100 * prediction.confidence) / 100, box: box4, boxRaw, landmarks: prediction.landmarks, annotations: annotations3 });
|
||||
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box4, boxRaw, landmarks: predictions[i].landmarks, annotations: annotations3 });
|
||||
}
|
||||
return hands;
|
||||
}
|
||||
|
@ -17311,8 +17315,6 @@ async function process2(res, inputSize, outputShape, config3) {
|
|||
return results;
|
||||
}
|
||||
async function predict7(image13, config3) {
|
||||
if (!model5)
|
||||
return null;
|
||||
if (skipped3 < config3.object.skipFrames && config3.skipFrame && last3.length > 0) {
|
||||
skipped3++;
|
||||
return last3;
|
||||
|
@ -17399,8 +17401,6 @@ async function process3(res, inputSize, outputShape, config3) {
|
|||
return results;
|
||||
}
|
||||
async function predict8(image13, config3) {
|
||||
if (!model6)
|
||||
return null;
|
||||
if (skipped4 < config3.object.skipFrames && config3.skipFrame && last4.length > 0) {
|
||||
skipped4++;
|
||||
return last4;
|
||||
|
@ -18400,7 +18400,7 @@ var options = {
|
|||
fillPolygons: false,
|
||||
useDepth: true,
|
||||
useCurves: false,
|
||||
bufferedOutput: false,
|
||||
bufferedOutput: true,
|
||||
useRawBoxes: false,
|
||||
calculateHandBox: true
|
||||
};
|
||||
|
@ -18439,7 +18439,7 @@ function lines(ctx, points = [], localOptions) {
|
|||
for (const pt of points) {
|
||||
ctx.strokeStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.3)` : localOptions.color;
|
||||
ctx.fillStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.3)` : localOptions.color;
|
||||
ctx.lineTo(pt[0], parseInt(pt[1]));
|
||||
ctx.lineTo(pt[0], Math.round(pt[1]));
|
||||
}
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
|
@ -18558,24 +18558,24 @@ async function face2(inCanvas2, result, drawOptions) {
|
|||
].map((index) => f.mesh[index]);
|
||||
lines(ctx, points, localOptions);
|
||||
}
|
||||
if (f.annotations && f.annotations.leftEyeIris) {
|
||||
if (f.annotations && f.annotations["leftEyeIris"]) {
|
||||
ctx.strokeStyle = localOptions.useDepth ? "rgba(255, 200, 255, 0.3)" : localOptions.color;
|
||||
ctx.beginPath();
|
||||
const sizeX = Math.abs(f.annotations.leftEyeIris[3][0] - f.annotations.leftEyeIris[1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations.leftEyeIris[4][1] - f.annotations.leftEyeIris[2][1]) / 2;
|
||||
ctx.ellipse(f.annotations.leftEyeIris[0][0], f.annotations.leftEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
const sizeX = Math.abs(f.annotations["leftEyeIris"][3][0] - f.annotations["leftEyeIris"][1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations["leftEyeIris"][4][1] - f.annotations["leftEyeIris"][2][1]) / 2;
|
||||
ctx.ellipse(f.annotations["leftEyeIris"][0][0], f.annotations["leftEyeIris"][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
ctx.fillStyle = localOptions.useDepth ? "rgba(255, 255, 200, 0.3)" : localOptions.color;
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
if (f.annotations && f.annotations.rightEyeIris) {
|
||||
if (f.annotations && f.annotations["rightEyeIris"]) {
|
||||
ctx.strokeStyle = localOptions.useDepth ? "rgba(255, 200, 255, 0.3)" : localOptions.color;
|
||||
ctx.beginPath();
|
||||
const sizeX = Math.abs(f.annotations.rightEyeIris[3][0] - f.annotations.rightEyeIris[1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations.rightEyeIris[4][1] - f.annotations.rightEyeIris[2][1]) / 2;
|
||||
ctx.ellipse(f.annotations.rightEyeIris[0][0], f.annotations.rightEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
const sizeX = Math.abs(f.annotations["rightEyeIris"][3][0] - f.annotations["rightEyeIris"][1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations["rightEyeIris"][4][1] - f.annotations["rightEyeIris"][2][1]) / 2;
|
||||
ctx.ellipse(f.annotations["rightEyeIris"][0][0], f.annotations["rightEyeIris"][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
ctx.fillStyle = localOptions.useDepth ? "rgba(255, 255, 200, 0.3)" : localOptions.color;
|
||||
|
@ -18588,6 +18588,7 @@ async function face2(inCanvas2, result, drawOptions) {
|
|||
}
|
||||
var lastDrawnPose = [];
|
||||
async function body2(inCanvas2, result, drawOptions) {
|
||||
var _a;
|
||||
const localOptions = mergeDeep(options, drawOptions);
|
||||
if (!result || !inCanvas2)
|
||||
return;
|
||||
|
@ -18604,7 +18605,7 @@ async function body2(inCanvas2, result, drawOptions) {
|
|||
ctx.fillStyle = localOptions.color;
|
||||
ctx.lineWidth = localOptions.lineWidth;
|
||||
ctx.font = localOptions.font;
|
||||
if (localOptions.drawBoxes) {
|
||||
if (localOptions.drawBoxes && result[i].box && ((_a = result[i].box) == null ? void 0 : _a.length) === 4) {
|
||||
rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);
|
||||
if (localOptions.drawLabels) {
|
||||
if (localOptions.shadowColor && localOptions.shadowColor !== "") {
|
||||
|
@ -18790,12 +18791,12 @@ async function hand2(inCanvas2, result, drawOptions) {
|
|||
ctx.fillText(title, part[part.length - 1][0] + 4, part[part.length - 1][1] + 4);
|
||||
};
|
||||
ctx.font = localOptions.font;
|
||||
addHandLabel(h.annotations.indexFinger, "index");
|
||||
addHandLabel(h.annotations.middleFinger, "middle");
|
||||
addHandLabel(h.annotations.ringFinger, "ring");
|
||||
addHandLabel(h.annotations.pinky, "pinky");
|
||||
addHandLabel(h.annotations.thumb, "thumb");
|
||||
addHandLabel(h.annotations.palmBase, "palm");
|
||||
addHandLabel(h.annotations["indexFinger"], "index");
|
||||
addHandLabel(h.annotations["middleFinger"], "middle");
|
||||
addHandLabel(h.annotations["ringFinger"], "ring");
|
||||
addHandLabel(h.annotations["pinky"], "pinky");
|
||||
addHandLabel(h.annotations["thumb"], "thumb");
|
||||
addHandLabel(h.annotations["palmBase"], "palm");
|
||||
}
|
||||
if (localOptions.drawPolygons) {
|
||||
const addHandLine = (part) => {
|
||||
|
@ -18810,11 +18811,11 @@ async function hand2(inCanvas2, result, drawOptions) {
|
|||
}
|
||||
};
|
||||
ctx.lineWidth = localOptions.lineWidth;
|
||||
addHandLine(h.annotations.indexFinger);
|
||||
addHandLine(h.annotations.middleFinger);
|
||||
addHandLine(h.annotations.ringFinger);
|
||||
addHandLine(h.annotations.pinky);
|
||||
addHandLine(h.annotations.thumb);
|
||||
addHandLine(h.annotations["indexFinger"]);
|
||||
addHandLine(h.annotations["middleFinger"]);
|
||||
addHandLine(h.annotations["ringFinger"]);
|
||||
addHandLine(h.annotations["pinky"]);
|
||||
addHandLine(h.annotations["thumb"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20013,7 +20014,7 @@ var Human = class {
|
|||
}
|
||||
this.perf.total = Math.trunc(now() - timeStart);
|
||||
this.state = "idle";
|
||||
const result = {
|
||||
const res = {
|
||||
face: faceRes,
|
||||
body: bodyRes,
|
||||
hand: handRes,
|
||||
|
@ -20022,7 +20023,7 @@ var Human = class {
|
|||
performance: this.perf,
|
||||
canvas: process5.canvas
|
||||
};
|
||||
resolve(result);
|
||||
resolve(res);
|
||||
});
|
||||
}
|
||||
async warmup(userConfig = {}) {
|
||||
|
|
|
@ -4453,6 +4453,7 @@ var detectFace = async (parent, input) => {
|
|||
}
|
||||
const irisSize = ((_e = faces[i].annotations) == null ? void 0 : _e.leftEyeIris) && ((_f = faces[i].annotations) == null ? void 0 : _f.rightEyeIris) ? 11.7 * Math.max(Math.abs(faces[i].annotations.leftEyeIris[3][0] - faces[i].annotations.leftEyeIris[1][0]), Math.abs(faces[i].annotations.rightEyeIris[4][1] - faces[i].annotations.rightEyeIris[2][1])) : 0;
|
||||
faceRes.push({
|
||||
id: i,
|
||||
...faces[i],
|
||||
age: descRes.age,
|
||||
gender: descRes.gender,
|
||||
|
@ -4563,8 +4564,11 @@ function getBoundingBox(keypoints) {
|
|||
return [coord.minX, coord.minY, coord.maxX - coord.minX, coord.maxY - coord.minY];
|
||||
}
|
||||
function scalePoses(poses2, [height, width], [inputResolutionHeight, inputResolutionWidth]) {
|
||||
const scalePose = (pose, scaleY, scaleX) => ({
|
||||
const scaleY = height / inputResolutionHeight;
|
||||
const scaleX = width / inputResolutionWidth;
|
||||
const scalePose = (pose) => ({
|
||||
score: pose.score,
|
||||
bowRaw: [pose.box[0] / inputResolutionWidth, pose.box[1] / inputResolutionHeight, pose.box[2] / inputResolutionWidth, pose.box[3] / inputResolutionHeight],
|
||||
box: [Math.trunc(pose.box[0] * scaleX), Math.trunc(pose.box[1] * scaleY), Math.trunc(pose.box[2] * scaleX), Math.trunc(pose.box[3] * scaleY)],
|
||||
keypoints: pose.keypoints.map(({ score, part, position }) => ({
|
||||
score,
|
||||
|
@ -4572,7 +4576,7 @@ function scalePoses(poses2, [height, width], [inputResolutionHeight, inputResolu
|
|||
position: { x: Math.trunc(position.x * scaleX), y: Math.trunc(position.y * scaleY) }
|
||||
}))
|
||||
});
|
||||
const scaledPoses = poses2.map((pose) => scalePose(pose, height / inputResolutionHeight, width / inputResolutionWidth));
|
||||
const scaledPoses = poses2.map((pose) => scalePose(pose));
|
||||
return scaledPoses;
|
||||
}
|
||||
var MaxHeap = class {
|
||||
|
@ -16953,26 +16957,26 @@ async function predict5(input, config3) {
|
|||
if (!predictions)
|
||||
return [];
|
||||
const hands = [];
|
||||
for (const prediction of predictions) {
|
||||
for (let i = 0; i < predictions.length; i++) {
|
||||
const annotations3 = {};
|
||||
if (prediction.landmarks) {
|
||||
if (predictions[i].landmarks) {
|
||||
for (const key of Object.keys(meshAnnotations)) {
|
||||
annotations3[key] = meshAnnotations[key].map((index) => prediction.landmarks[index]);
|
||||
annotations3[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);
|
||||
}
|
||||
}
|
||||
const box4 = prediction.box ? [
|
||||
Math.max(0, prediction.box.topLeft[0]),
|
||||
Math.max(0, prediction.box.topLeft[1]),
|
||||
Math.min(input.shape[2], prediction.box.bottomRight[0]) - Math.max(0, prediction.box.topLeft[0]),
|
||||
Math.min(input.shape[1], prediction.box.bottomRight[1]) - Math.max(0, prediction.box.topLeft[1])
|
||||
] : [];
|
||||
const box4 = predictions[i].box ? [
|
||||
Math.max(0, predictions[i].box.topLeft[0]),
|
||||
Math.max(0, predictions[i].box.topLeft[1]),
|
||||
Math.min(input.shape[2], predictions[i].box.bottomRight[0]) - Math.max(0, predictions[i].box.topLeft[0]),
|
||||
Math.min(input.shape[1], predictions[i].box.bottomRight[1]) - Math.max(0, predictions[i].box.topLeft[1])
|
||||
] : [0, 0, 0, 0];
|
||||
const boxRaw = [
|
||||
prediction.box.topLeft[0] / input.shape[2],
|
||||
prediction.box.topLeft[1] / input.shape[1],
|
||||
(prediction.box.bottomRight[0] - prediction.box.topLeft[0]) / input.shape[2],
|
||||
(prediction.box.bottomRight[1] - prediction.box.topLeft[1]) / input.shape[1]
|
||||
predictions[i].box.topLeft[0] / input.shape[2],
|
||||
predictions[i].box.topLeft[1] / input.shape[1],
|
||||
(predictions[i].box.bottomRight[0] - predictions[i].box.topLeft[0]) / input.shape[2],
|
||||
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / input.shape[1]
|
||||
];
|
||||
hands.push({ confidence: Math.round(100 * prediction.confidence) / 100, box: box4, boxRaw, landmarks: prediction.landmarks, annotations: annotations3 });
|
||||
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box4, boxRaw, landmarks: predictions[i].landmarks, annotations: annotations3 });
|
||||
}
|
||||
return hands;
|
||||
}
|
||||
|
@ -17312,8 +17316,6 @@ async function process2(res, inputSize, outputShape, config3) {
|
|||
return results;
|
||||
}
|
||||
async function predict7(image13, config3) {
|
||||
if (!model5)
|
||||
return null;
|
||||
if (skipped3 < config3.object.skipFrames && config3.skipFrame && last3.length > 0) {
|
||||
skipped3++;
|
||||
return last3;
|
||||
|
@ -17400,8 +17402,6 @@ async function process3(res, inputSize, outputShape, config3) {
|
|||
return results;
|
||||
}
|
||||
async function predict8(image13, config3) {
|
||||
if (!model6)
|
||||
return null;
|
||||
if (skipped4 < config3.object.skipFrames && config3.skipFrame && last4.length > 0) {
|
||||
skipped4++;
|
||||
return last4;
|
||||
|
@ -18401,7 +18401,7 @@ var options = {
|
|||
fillPolygons: false,
|
||||
useDepth: true,
|
||||
useCurves: false,
|
||||
bufferedOutput: false,
|
||||
bufferedOutput: true,
|
||||
useRawBoxes: false,
|
||||
calculateHandBox: true
|
||||
};
|
||||
|
@ -18440,7 +18440,7 @@ function lines(ctx, points = [], localOptions) {
|
|||
for (const pt of points) {
|
||||
ctx.strokeStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.3)` : localOptions.color;
|
||||
ctx.fillStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.3)` : localOptions.color;
|
||||
ctx.lineTo(pt[0], parseInt(pt[1]));
|
||||
ctx.lineTo(pt[0], Math.round(pt[1]));
|
||||
}
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
|
@ -18559,24 +18559,24 @@ async function face2(inCanvas2, result, drawOptions) {
|
|||
].map((index) => f.mesh[index]);
|
||||
lines(ctx, points, localOptions);
|
||||
}
|
||||
if (f.annotations && f.annotations.leftEyeIris) {
|
||||
if (f.annotations && f.annotations["leftEyeIris"]) {
|
||||
ctx.strokeStyle = localOptions.useDepth ? "rgba(255, 200, 255, 0.3)" : localOptions.color;
|
||||
ctx.beginPath();
|
||||
const sizeX = Math.abs(f.annotations.leftEyeIris[3][0] - f.annotations.leftEyeIris[1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations.leftEyeIris[4][1] - f.annotations.leftEyeIris[2][1]) / 2;
|
||||
ctx.ellipse(f.annotations.leftEyeIris[0][0], f.annotations.leftEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
const sizeX = Math.abs(f.annotations["leftEyeIris"][3][0] - f.annotations["leftEyeIris"][1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations["leftEyeIris"][4][1] - f.annotations["leftEyeIris"][2][1]) / 2;
|
||||
ctx.ellipse(f.annotations["leftEyeIris"][0][0], f.annotations["leftEyeIris"][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
ctx.fillStyle = localOptions.useDepth ? "rgba(255, 255, 200, 0.3)" : localOptions.color;
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
if (f.annotations && f.annotations.rightEyeIris) {
|
||||
if (f.annotations && f.annotations["rightEyeIris"]) {
|
||||
ctx.strokeStyle = localOptions.useDepth ? "rgba(255, 200, 255, 0.3)" : localOptions.color;
|
||||
ctx.beginPath();
|
||||
const sizeX = Math.abs(f.annotations.rightEyeIris[3][0] - f.annotations.rightEyeIris[1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations.rightEyeIris[4][1] - f.annotations.rightEyeIris[2][1]) / 2;
|
||||
ctx.ellipse(f.annotations.rightEyeIris[0][0], f.annotations.rightEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
const sizeX = Math.abs(f.annotations["rightEyeIris"][3][0] - f.annotations["rightEyeIris"][1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations["rightEyeIris"][4][1] - f.annotations["rightEyeIris"][2][1]) / 2;
|
||||
ctx.ellipse(f.annotations["rightEyeIris"][0][0], f.annotations["rightEyeIris"][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
ctx.fillStyle = localOptions.useDepth ? "rgba(255, 255, 200, 0.3)" : localOptions.color;
|
||||
|
@ -18589,6 +18589,7 @@ async function face2(inCanvas2, result, drawOptions) {
|
|||
}
|
||||
var lastDrawnPose = [];
|
||||
async function body2(inCanvas2, result, drawOptions) {
|
||||
var _a;
|
||||
const localOptions = mergeDeep(options, drawOptions);
|
||||
if (!result || !inCanvas2)
|
||||
return;
|
||||
|
@ -18605,7 +18606,7 @@ async function body2(inCanvas2, result, drawOptions) {
|
|||
ctx.fillStyle = localOptions.color;
|
||||
ctx.lineWidth = localOptions.lineWidth;
|
||||
ctx.font = localOptions.font;
|
||||
if (localOptions.drawBoxes) {
|
||||
if (localOptions.drawBoxes && result[i].box && ((_a = result[i].box) == null ? void 0 : _a.length) === 4) {
|
||||
rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);
|
||||
if (localOptions.drawLabels) {
|
||||
if (localOptions.shadowColor && localOptions.shadowColor !== "") {
|
||||
|
@ -18791,12 +18792,12 @@ async function hand2(inCanvas2, result, drawOptions) {
|
|||
ctx.fillText(title, part[part.length - 1][0] + 4, part[part.length - 1][1] + 4);
|
||||
};
|
||||
ctx.font = localOptions.font;
|
||||
addHandLabel(h.annotations.indexFinger, "index");
|
||||
addHandLabel(h.annotations.middleFinger, "middle");
|
||||
addHandLabel(h.annotations.ringFinger, "ring");
|
||||
addHandLabel(h.annotations.pinky, "pinky");
|
||||
addHandLabel(h.annotations.thumb, "thumb");
|
||||
addHandLabel(h.annotations.palmBase, "palm");
|
||||
addHandLabel(h.annotations["indexFinger"], "index");
|
||||
addHandLabel(h.annotations["middleFinger"], "middle");
|
||||
addHandLabel(h.annotations["ringFinger"], "ring");
|
||||
addHandLabel(h.annotations["pinky"], "pinky");
|
||||
addHandLabel(h.annotations["thumb"], "thumb");
|
||||
addHandLabel(h.annotations["palmBase"], "palm");
|
||||
}
|
||||
if (localOptions.drawPolygons) {
|
||||
const addHandLine = (part) => {
|
||||
|
@ -18811,11 +18812,11 @@ async function hand2(inCanvas2, result, drawOptions) {
|
|||
}
|
||||
};
|
||||
ctx.lineWidth = localOptions.lineWidth;
|
||||
addHandLine(h.annotations.indexFinger);
|
||||
addHandLine(h.annotations.middleFinger);
|
||||
addHandLine(h.annotations.ringFinger);
|
||||
addHandLine(h.annotations.pinky);
|
||||
addHandLine(h.annotations.thumb);
|
||||
addHandLine(h.annotations["indexFinger"]);
|
||||
addHandLine(h.annotations["middleFinger"]);
|
||||
addHandLine(h.annotations["ringFinger"]);
|
||||
addHandLine(h.annotations["pinky"]);
|
||||
addHandLine(h.annotations["thumb"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20014,7 +20015,7 @@ var Human = class {
|
|||
}
|
||||
this.perf.total = Math.trunc(now() - timeStart);
|
||||
this.state = "idle";
|
||||
const result = {
|
||||
const res = {
|
||||
face: faceRes,
|
||||
body: bodyRes,
|
||||
hand: handRes,
|
||||
|
@ -20023,7 +20024,7 @@ var Human = class {
|
|||
performance: this.perf,
|
||||
canvas: process5.canvas
|
||||
};
|
||||
resolve(result);
|
||||
resolve(res);
|
||||
});
|
||||
}
|
||||
async warmup(userConfig = {}) {
|
||||
|
|
|
@ -4452,6 +4452,7 @@ var detectFace = async (parent, input) => {
|
|||
}
|
||||
const irisSize = ((_e = faces[i].annotations) == null ? void 0 : _e.leftEyeIris) && ((_f = faces[i].annotations) == null ? void 0 : _f.rightEyeIris) ? 11.7 * Math.max(Math.abs(faces[i].annotations.leftEyeIris[3][0] - faces[i].annotations.leftEyeIris[1][0]), Math.abs(faces[i].annotations.rightEyeIris[4][1] - faces[i].annotations.rightEyeIris[2][1])) : 0;
|
||||
faceRes.push({
|
||||
id: i,
|
||||
...faces[i],
|
||||
age: descRes.age,
|
||||
gender: descRes.gender,
|
||||
|
@ -4562,8 +4563,11 @@ function getBoundingBox(keypoints) {
|
|||
return [coord.minX, coord.minY, coord.maxX - coord.minX, coord.maxY - coord.minY];
|
||||
}
|
||||
function scalePoses(poses2, [height, width], [inputResolutionHeight, inputResolutionWidth]) {
|
||||
const scalePose = (pose, scaleY, scaleX) => ({
|
||||
const scaleY = height / inputResolutionHeight;
|
||||
const scaleX = width / inputResolutionWidth;
|
||||
const scalePose = (pose) => ({
|
||||
score: pose.score,
|
||||
bowRaw: [pose.box[0] / inputResolutionWidth, pose.box[1] / inputResolutionHeight, pose.box[2] / inputResolutionWidth, pose.box[3] / inputResolutionHeight],
|
||||
box: [Math.trunc(pose.box[0] * scaleX), Math.trunc(pose.box[1] * scaleY), Math.trunc(pose.box[2] * scaleX), Math.trunc(pose.box[3] * scaleY)],
|
||||
keypoints: pose.keypoints.map(({ score, part, position }) => ({
|
||||
score,
|
||||
|
@ -4571,7 +4575,7 @@ function scalePoses(poses2, [height, width], [inputResolutionHeight, inputResolu
|
|||
position: { x: Math.trunc(position.x * scaleX), y: Math.trunc(position.y * scaleY) }
|
||||
}))
|
||||
});
|
||||
const scaledPoses = poses2.map((pose) => scalePose(pose, height / inputResolutionHeight, width / inputResolutionWidth));
|
||||
const scaledPoses = poses2.map((pose) => scalePose(pose));
|
||||
return scaledPoses;
|
||||
}
|
||||
var MaxHeap = class {
|
||||
|
@ -16952,26 +16956,26 @@ async function predict5(input, config3) {
|
|||
if (!predictions)
|
||||
return [];
|
||||
const hands = [];
|
||||
for (const prediction of predictions) {
|
||||
for (let i = 0; i < predictions.length; i++) {
|
||||
const annotations3 = {};
|
||||
if (prediction.landmarks) {
|
||||
if (predictions[i].landmarks) {
|
||||
for (const key of Object.keys(meshAnnotations)) {
|
||||
annotations3[key] = meshAnnotations[key].map((index) => prediction.landmarks[index]);
|
||||
annotations3[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);
|
||||
}
|
||||
}
|
||||
const box4 = prediction.box ? [
|
||||
Math.max(0, prediction.box.topLeft[0]),
|
||||
Math.max(0, prediction.box.topLeft[1]),
|
||||
Math.min(input.shape[2], prediction.box.bottomRight[0]) - Math.max(0, prediction.box.topLeft[0]),
|
||||
Math.min(input.shape[1], prediction.box.bottomRight[1]) - Math.max(0, prediction.box.topLeft[1])
|
||||
] : [];
|
||||
const box4 = predictions[i].box ? [
|
||||
Math.max(0, predictions[i].box.topLeft[0]),
|
||||
Math.max(0, predictions[i].box.topLeft[1]),
|
||||
Math.min(input.shape[2], predictions[i].box.bottomRight[0]) - Math.max(0, predictions[i].box.topLeft[0]),
|
||||
Math.min(input.shape[1], predictions[i].box.bottomRight[1]) - Math.max(0, predictions[i].box.topLeft[1])
|
||||
] : [0, 0, 0, 0];
|
||||
const boxRaw = [
|
||||
prediction.box.topLeft[0] / input.shape[2],
|
||||
prediction.box.topLeft[1] / input.shape[1],
|
||||
(prediction.box.bottomRight[0] - prediction.box.topLeft[0]) / input.shape[2],
|
||||
(prediction.box.bottomRight[1] - prediction.box.topLeft[1]) / input.shape[1]
|
||||
predictions[i].box.topLeft[0] / input.shape[2],
|
||||
predictions[i].box.topLeft[1] / input.shape[1],
|
||||
(predictions[i].box.bottomRight[0] - predictions[i].box.topLeft[0]) / input.shape[2],
|
||||
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / input.shape[1]
|
||||
];
|
||||
hands.push({ confidence: Math.round(100 * prediction.confidence) / 100, box: box4, boxRaw, landmarks: prediction.landmarks, annotations: annotations3 });
|
||||
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box4, boxRaw, landmarks: predictions[i].landmarks, annotations: annotations3 });
|
||||
}
|
||||
return hands;
|
||||
}
|
||||
|
@ -17311,8 +17315,6 @@ async function process2(res, inputSize, outputShape, config3) {
|
|||
return results;
|
||||
}
|
||||
async function predict7(image13, config3) {
|
||||
if (!model5)
|
||||
return null;
|
||||
if (skipped3 < config3.object.skipFrames && config3.skipFrame && last3.length > 0) {
|
||||
skipped3++;
|
||||
return last3;
|
||||
|
@ -17399,8 +17401,6 @@ async function process3(res, inputSize, outputShape, config3) {
|
|||
return results;
|
||||
}
|
||||
async function predict8(image13, config3) {
|
||||
if (!model6)
|
||||
return null;
|
||||
if (skipped4 < config3.object.skipFrames && config3.skipFrame && last4.length > 0) {
|
||||
skipped4++;
|
||||
return last4;
|
||||
|
@ -18400,7 +18400,7 @@ var options = {
|
|||
fillPolygons: false,
|
||||
useDepth: true,
|
||||
useCurves: false,
|
||||
bufferedOutput: false,
|
||||
bufferedOutput: true,
|
||||
useRawBoxes: false,
|
||||
calculateHandBox: true
|
||||
};
|
||||
|
@ -18439,7 +18439,7 @@ function lines(ctx, points = [], localOptions) {
|
|||
for (const pt of points) {
|
||||
ctx.strokeStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.3)` : localOptions.color;
|
||||
ctx.fillStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.3)` : localOptions.color;
|
||||
ctx.lineTo(pt[0], parseInt(pt[1]));
|
||||
ctx.lineTo(pt[0], Math.round(pt[1]));
|
||||
}
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
|
@ -18558,24 +18558,24 @@ async function face2(inCanvas2, result, drawOptions) {
|
|||
].map((index) => f.mesh[index]);
|
||||
lines(ctx, points, localOptions);
|
||||
}
|
||||
if (f.annotations && f.annotations.leftEyeIris) {
|
||||
if (f.annotations && f.annotations["leftEyeIris"]) {
|
||||
ctx.strokeStyle = localOptions.useDepth ? "rgba(255, 200, 255, 0.3)" : localOptions.color;
|
||||
ctx.beginPath();
|
||||
const sizeX = Math.abs(f.annotations.leftEyeIris[3][0] - f.annotations.leftEyeIris[1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations.leftEyeIris[4][1] - f.annotations.leftEyeIris[2][1]) / 2;
|
||||
ctx.ellipse(f.annotations.leftEyeIris[0][0], f.annotations.leftEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
const sizeX = Math.abs(f.annotations["leftEyeIris"][3][0] - f.annotations["leftEyeIris"][1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations["leftEyeIris"][4][1] - f.annotations["leftEyeIris"][2][1]) / 2;
|
||||
ctx.ellipse(f.annotations["leftEyeIris"][0][0], f.annotations["leftEyeIris"][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
ctx.fillStyle = localOptions.useDepth ? "rgba(255, 255, 200, 0.3)" : localOptions.color;
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
if (f.annotations && f.annotations.rightEyeIris) {
|
||||
if (f.annotations && f.annotations["rightEyeIris"]) {
|
||||
ctx.strokeStyle = localOptions.useDepth ? "rgba(255, 200, 255, 0.3)" : localOptions.color;
|
||||
ctx.beginPath();
|
||||
const sizeX = Math.abs(f.annotations.rightEyeIris[3][0] - f.annotations.rightEyeIris[1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations.rightEyeIris[4][1] - f.annotations.rightEyeIris[2][1]) / 2;
|
||||
ctx.ellipse(f.annotations.rightEyeIris[0][0], f.annotations.rightEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
const sizeX = Math.abs(f.annotations["rightEyeIris"][3][0] - f.annotations["rightEyeIris"][1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations["rightEyeIris"][4][1] - f.annotations["rightEyeIris"][2][1]) / 2;
|
||||
ctx.ellipse(f.annotations["rightEyeIris"][0][0], f.annotations["rightEyeIris"][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
ctx.fillStyle = localOptions.useDepth ? "rgba(255, 255, 200, 0.3)" : localOptions.color;
|
||||
|
@ -18588,6 +18588,7 @@ async function face2(inCanvas2, result, drawOptions) {
|
|||
}
|
||||
var lastDrawnPose = [];
|
||||
async function body2(inCanvas2, result, drawOptions) {
|
||||
var _a;
|
||||
const localOptions = mergeDeep(options, drawOptions);
|
||||
if (!result || !inCanvas2)
|
||||
return;
|
||||
|
@ -18604,7 +18605,7 @@ async function body2(inCanvas2, result, drawOptions) {
|
|||
ctx.fillStyle = localOptions.color;
|
||||
ctx.lineWidth = localOptions.lineWidth;
|
||||
ctx.font = localOptions.font;
|
||||
if (localOptions.drawBoxes) {
|
||||
if (localOptions.drawBoxes && result[i].box && ((_a = result[i].box) == null ? void 0 : _a.length) === 4) {
|
||||
rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);
|
||||
if (localOptions.drawLabels) {
|
||||
if (localOptions.shadowColor && localOptions.shadowColor !== "") {
|
||||
|
@ -18790,12 +18791,12 @@ async function hand2(inCanvas2, result, drawOptions) {
|
|||
ctx.fillText(title, part[part.length - 1][0] + 4, part[part.length - 1][1] + 4);
|
||||
};
|
||||
ctx.font = localOptions.font;
|
||||
addHandLabel(h.annotations.indexFinger, "index");
|
||||
addHandLabel(h.annotations.middleFinger, "middle");
|
||||
addHandLabel(h.annotations.ringFinger, "ring");
|
||||
addHandLabel(h.annotations.pinky, "pinky");
|
||||
addHandLabel(h.annotations.thumb, "thumb");
|
||||
addHandLabel(h.annotations.palmBase, "palm");
|
||||
addHandLabel(h.annotations["indexFinger"], "index");
|
||||
addHandLabel(h.annotations["middleFinger"], "middle");
|
||||
addHandLabel(h.annotations["ringFinger"], "ring");
|
||||
addHandLabel(h.annotations["pinky"], "pinky");
|
||||
addHandLabel(h.annotations["thumb"], "thumb");
|
||||
addHandLabel(h.annotations["palmBase"], "palm");
|
||||
}
|
||||
if (localOptions.drawPolygons) {
|
||||
const addHandLine = (part) => {
|
||||
|
@ -18810,11 +18811,11 @@ async function hand2(inCanvas2, result, drawOptions) {
|
|||
}
|
||||
};
|
||||
ctx.lineWidth = localOptions.lineWidth;
|
||||
addHandLine(h.annotations.indexFinger);
|
||||
addHandLine(h.annotations.middleFinger);
|
||||
addHandLine(h.annotations.ringFinger);
|
||||
addHandLine(h.annotations.pinky);
|
||||
addHandLine(h.annotations.thumb);
|
||||
addHandLine(h.annotations["indexFinger"]);
|
||||
addHandLine(h.annotations["middleFinger"]);
|
||||
addHandLine(h.annotations["ringFinger"]);
|
||||
addHandLine(h.annotations["pinky"]);
|
||||
addHandLine(h.annotations["thumb"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20013,7 +20014,7 @@ var Human = class {
|
|||
}
|
||||
this.perf.total = Math.trunc(now() - timeStart);
|
||||
this.state = "idle";
|
||||
const result = {
|
||||
const res = {
|
||||
face: faceRes,
|
||||
body: bodyRes,
|
||||
hand: handRes,
|
||||
|
@ -20022,7 +20023,7 @@ var Human = class {
|
|||
performance: this.perf,
|
||||
canvas: process5.canvas
|
||||
};
|
||||
resolve(result);
|
||||
resolve(res);
|
||||
});
|
||||
}
|
||||
async warmup(userConfig = {}) {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -15,3 +15,71 @@
|
|||
2021-05-21 06:52:08 [36mINFO: [39m Generate types: ["src/human.ts"]
|
||||
2021-05-21 06:52:13 [36mINFO: [39m Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-05-21 06:52:13 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"]
|
||||
2021-05-22 11:04:54 [36mINFO: [39m @vladmandic/human version 1.9.1
|
||||
2021-05-22 11:04:54 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.0.0
|
||||
2021-05-22 11:04:54 [36mINFO: [39m Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
|
||||
2021-05-22 11:04:54 [35mSTATE:[39m Build for: node type: tfjs: {"imports":1,"importBytes":39,"outputBytes":1292,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:04:54 [35mSTATE:[39m Build for: node type: node: {"imports":36,"importBytes":418552,"outputBytes":377897,"outputFiles":"dist/human.node.js"}
|
||||
2021-05-22 11:04:54 [35mSTATE:[39m Build for: nodeGPU type: tfjs: {"imports":1,"importBytes":43,"outputBytes":1300,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:04:54 [35mSTATE:[39m Build for: nodeGPU type: node: {"imports":36,"importBytes":418560,"outputBytes":377901,"outputFiles":"dist/human.node-gpu.js"}
|
||||
2021-05-22 11:04:54 [35mSTATE:[39m Build for: nodeWASM type: tfjs: {"imports":1,"importBytes":81,"outputBytes":1367,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:04:54 [35mSTATE:[39m Build for: nodeWASM type: node: {"imports":36,"importBytes":418627,"outputBytes":377973,"outputFiles":"dist/human.node-wasm.js"}
|
||||
2021-05-22 11:04:54 [35mSTATE:[39m Build for: browserNoBundle type: tfjs: {"imports":1,"importBytes":2488,"outputBytes":1394,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:04:54 [35mSTATE:[39m Build for: browserNoBundle type: esm: {"imports":36,"importBytes":418654,"outputBytes":232241,"outputFiles":"dist/human.esm-nobundle.js"}
|
||||
2021-05-22 11:04:55 [35mSTATE:[39m Build for: browserBundle type: tfjs: {"modules":1274,"moduleBytes":4114813,"imports":7,"importBytes":2488,"outputBytes":1111414,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:04:56 [35mSTATE:[39m Build for: browserBundle type: iife: {"imports":36,"importBytes":1528674,"outputBytes":1340102,"outputFiles":"dist/human.js"}
|
||||
2021-05-22 11:04:56 [35mSTATE:[39m Build for: browserBundle type: esm: {"imports":36,"importBytes":1528674,"outputBytes":1340094,"outputFiles":"dist/human.esm.js"}
|
||||
2021-05-22 11:04:56 [36mINFO: [39m Generate types: ["src/human.ts"]
|
||||
2021-05-22 11:05:02 [36mINFO: [39m Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-05-22 11:05:02 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"]
|
||||
2021-05-22 11:08:48 [36mINFO: [39m @vladmandic/human version 1.9.1
|
||||
2021-05-22 11:08:48 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.0.0
|
||||
2021-05-22 11:08:48 [36mINFO: [39m Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
|
||||
2021-05-22 11:08:48 [35mSTATE:[39m Build for: node type: tfjs: {"imports":1,"importBytes":39,"outputBytes":1292,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:08:48 [35mSTATE:[39m Build for: node type: node: {"imports":36,"importBytes":418552,"outputBytes":377897,"outputFiles":"dist/human.node.js"}
|
||||
2021-05-22 11:08:48 [35mSTATE:[39m Build for: nodeGPU type: tfjs: {"imports":1,"importBytes":43,"outputBytes":1300,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:08:48 [35mSTATE:[39m Build for: nodeGPU type: node: {"imports":36,"importBytes":418560,"outputBytes":377901,"outputFiles":"dist/human.node-gpu.js"}
|
||||
2021-05-22 11:08:48 [35mSTATE:[39m Build for: nodeWASM type: tfjs: {"imports":1,"importBytes":81,"outputBytes":1367,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:08:48 [35mSTATE:[39m Build for: nodeWASM type: node: {"imports":36,"importBytes":418627,"outputBytes":377973,"outputFiles":"dist/human.node-wasm.js"}
|
||||
2021-05-22 11:08:48 [35mSTATE:[39m Build for: browserNoBundle type: tfjs: {"imports":1,"importBytes":2488,"outputBytes":1394,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:08:48 [35mSTATE:[39m Build for: browserNoBundle type: esm: {"imports":36,"importBytes":418654,"outputBytes":232241,"outputFiles":"dist/human.esm-nobundle.js"}
|
||||
2021-05-22 11:08:49 [35mSTATE:[39m Build for: browserBundle type: tfjs: {"modules":1274,"moduleBytes":4114813,"imports":7,"importBytes":2488,"outputBytes":1111414,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:08:49 [35mSTATE:[39m Build for: browserBundle type: iife: {"imports":36,"importBytes":1528674,"outputBytes":1340102,"outputFiles":"dist/human.js"}
|
||||
2021-05-22 11:08:50 [35mSTATE:[39m Build for: browserBundle type: esm: {"imports":36,"importBytes":1528674,"outputBytes":1340094,"outputFiles":"dist/human.esm.js"}
|
||||
2021-05-22 11:08:50 [36mINFO: [39m Generate types: ["src/human.ts"]
|
||||
2021-05-22 11:08:56 [36mINFO: [39m Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-05-22 11:08:56 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"]
|
||||
2021-05-22 11:09:59 [36mINFO: [39m @vladmandic/human version 1.9.1
|
||||
2021-05-22 11:09:59 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.0.0
|
||||
2021-05-22 11:09:59 [36mINFO: [39m Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
|
||||
2021-05-22 11:09:59 [35mSTATE:[39m Build for: node type: tfjs: {"imports":1,"importBytes":39,"outputBytes":1292,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:09:59 [35mSTATE:[39m Build for: node type: node: {"imports":36,"importBytes":418552,"outputBytes":377897,"outputFiles":"dist/human.node.js"}
|
||||
2021-05-22 11:09:59 [35mSTATE:[39m Build for: nodeGPU type: tfjs: {"imports":1,"importBytes":43,"outputBytes":1300,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:09:59 [35mSTATE:[39m Build for: nodeGPU type: node: {"imports":36,"importBytes":418560,"outputBytes":377901,"outputFiles":"dist/human.node-gpu.js"}
|
||||
2021-05-22 11:10:00 [35mSTATE:[39m Build for: nodeWASM type: tfjs: {"imports":1,"importBytes":81,"outputBytes":1367,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:10:00 [35mSTATE:[39m Build for: nodeWASM type: node: {"imports":36,"importBytes":418627,"outputBytes":377973,"outputFiles":"dist/human.node-wasm.js"}
|
||||
2021-05-22 11:10:00 [35mSTATE:[39m Build for: browserNoBundle type: tfjs: {"imports":1,"importBytes":2488,"outputBytes":1394,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:10:00 [35mSTATE:[39m Build for: browserNoBundle type: esm: {"imports":36,"importBytes":418654,"outputBytes":232241,"outputFiles":"dist/human.esm-nobundle.js"}
|
||||
2021-05-22 11:10:00 [35mSTATE:[39m Build for: browserBundle type: tfjs: {"modules":1274,"moduleBytes":4114813,"imports":7,"importBytes":2488,"outputBytes":1111414,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:10:01 [35mSTATE:[39m Build for: browserBundle type: iife: {"imports":36,"importBytes":1528674,"outputBytes":1340102,"outputFiles":"dist/human.js"}
|
||||
2021-05-22 11:10:01 [35mSTATE:[39m Build for: browserBundle type: esm: {"imports":36,"importBytes":1528674,"outputBytes":1340094,"outputFiles":"dist/human.esm.js"}
|
||||
2021-05-22 11:10:01 [36mINFO: [39m Generate types: ["src/human.ts"]
|
||||
2021-05-22 11:10:07 [36mINFO: [39m Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-05-22 11:10:07 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"]
|
||||
2021-05-22 11:27:28 [36mINFO: [39m @vladmandic/human version 1.9.1
|
||||
2021-05-22 11:27:28 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.0.0
|
||||
2021-05-22 11:27:28 [36mINFO: [39m Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
|
||||
2021-05-22 11:27:28 [35mSTATE:[39m Build for: node type: tfjs: {"imports":1,"importBytes":39,"outputBytes":1292,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:27:28 [35mSTATE:[39m Build for: node type: node: {"imports":36,"importBytes":418710,"outputBytes":377974,"outputFiles":"dist/human.node.js"}
|
||||
2021-05-22 11:27:28 [35mSTATE:[39m Build for: nodeGPU type: tfjs: {"imports":1,"importBytes":43,"outputBytes":1300,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:27:28 [35mSTATE:[39m Build for: nodeGPU type: node: {"imports":36,"importBytes":418718,"outputBytes":377978,"outputFiles":"dist/human.node-gpu.js"}
|
||||
2021-05-22 11:27:28 [35mSTATE:[39m Build for: nodeWASM type: tfjs: {"imports":1,"importBytes":81,"outputBytes":1367,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:27:28 [35mSTATE:[39m Build for: nodeWASM type: node: {"imports":36,"importBytes":418785,"outputBytes":378050,"outputFiles":"dist/human.node-wasm.js"}
|
||||
2021-05-22 11:27:28 [35mSTATE:[39m Build for: browserNoBundle type: tfjs: {"imports":1,"importBytes":2488,"outputBytes":1394,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:27:28 [35mSTATE:[39m Build for: browserNoBundle type: esm: {"imports":36,"importBytes":418812,"outputBytes":232243,"outputFiles":"dist/human.esm-nobundle.js"}
|
||||
2021-05-22 11:27:29 [35mSTATE:[39m Build for: browserBundle type: tfjs: {"modules":1274,"moduleBytes":4114813,"imports":7,"importBytes":2488,"outputBytes":1111414,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-05-22 11:27:29 [35mSTATE:[39m Build for: browserBundle type: iife: {"imports":36,"importBytes":1528832,"outputBytes":1340104,"outputFiles":"dist/human.js"}
|
||||
2021-05-22 11:27:30 [35mSTATE:[39m Build for: browserBundle type: esm: {"imports":36,"importBytes":1528832,"outputBytes":1340096,"outputFiles":"dist/human.esm.js"}
|
||||
2021-05-22 11:27:30 [36mINFO: [39m Generate types: ["src/human.ts"]
|
||||
2021-05-22 11:27:35 [36mINFO: [39m Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-05-22 11:27:35 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { TRI468 as triangulation } from '../blazeface/coords';
|
||||
import { mergeDeep } from '../helpers';
|
||||
import type { Result, Face, Body, Hand, Item, Gesture } from '../result';
|
||||
|
||||
/**
|
||||
* Draw Options
|
||||
|
@ -59,7 +60,7 @@ export const options: DrawOptions = {
|
|||
fillPolygons: <Boolean>false,
|
||||
useDepth: <Boolean>true,
|
||||
useCurves: <Boolean>false,
|
||||
bufferedOutput: <Boolean>false,
|
||||
bufferedOutput: <Boolean>true,
|
||||
useRawBoxes: <Boolean>false,
|
||||
calculateHandBox: <Boolean>true,
|
||||
};
|
||||
|
@ -93,14 +94,14 @@ function rect(ctx, x, y, width, height, localOptions) {
|
|||
ctx.stroke();
|
||||
}
|
||||
|
||||
function lines(ctx, points: number[] = [], localOptions) {
|
||||
function lines(ctx, points: [number, number, number][] = [], localOptions) {
|
||||
if (points === undefined || points.length === 0) return;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(points[0][0], points[0][1]);
|
||||
for (const pt of points) {
|
||||
ctx.strokeStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + (2 * pt[2])}, ${127.5 - (2 * pt[2])}, 255, 0.3)` : localOptions.color;
|
||||
ctx.fillStyle = localOptions.useDepth && pt[2] ? `rgba(${127.5 + (2 * pt[2])}, ${127.5 - (2 * pt[2])}, 255, 0.3)` : localOptions.color;
|
||||
ctx.lineTo(pt[0], parseInt(pt[1]));
|
||||
ctx.lineTo(pt[0], Math.round(pt[1]));
|
||||
}
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
|
@ -109,7 +110,7 @@ function lines(ctx, points: number[] = [], localOptions) {
|
|||
}
|
||||
}
|
||||
|
||||
function curves(ctx, points: number[] = [], localOptions) {
|
||||
function curves(ctx, points: [number, number, number][] = [], localOptions) {
|
||||
if (points === undefined || points.length === 0) return;
|
||||
if (!localOptions.useCurves || points.length <= 2) {
|
||||
lines(ctx, points, localOptions);
|
||||
|
@ -129,7 +130,7 @@ function curves(ctx, points: number[] = [], localOptions) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function gesture(inCanvas: HTMLCanvasElement, result: Array<any>, drawOptions?: DrawOptions) {
|
||||
export async function gesture(inCanvas: HTMLCanvasElement, result: Array<Gesture>, drawOptions?: DrawOptions) {
|
||||
const localOptions = mergeDeep(options, drawOptions);
|
||||
if (!result || !inCanvas) return;
|
||||
if (!(inCanvas instanceof HTMLCanvasElement)) return;
|
||||
|
@ -156,7 +157,7 @@ export async function gesture(inCanvas: HTMLCanvasElement, result: Array<any>, d
|
|||
}
|
||||
}
|
||||
|
||||
export async function face(inCanvas: HTMLCanvasElement, result: Array<any>, drawOptions?: DrawOptions) {
|
||||
export async function face(inCanvas: HTMLCanvasElement, result: Array<Face>, drawOptions?: DrawOptions) {
|
||||
const localOptions = mergeDeep(options, drawOptions);
|
||||
if (!result || !inCanvas) return;
|
||||
if (!(inCanvas instanceof HTMLCanvasElement)) return;
|
||||
|
@ -211,24 +212,24 @@ export async function face(inCanvas: HTMLCanvasElement, result: Array<any>, draw
|
|||
lines(ctx, points, localOptions);
|
||||
}
|
||||
// iris: array[center, left, top, right, bottom]
|
||||
if (f.annotations && f.annotations.leftEyeIris) {
|
||||
if (f.annotations && f.annotations['leftEyeIris']) {
|
||||
ctx.strokeStyle = localOptions.useDepth ? 'rgba(255, 200, 255, 0.3)' : localOptions.color;
|
||||
ctx.beginPath();
|
||||
const sizeX = Math.abs(f.annotations.leftEyeIris[3][0] - f.annotations.leftEyeIris[1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations.leftEyeIris[4][1] - f.annotations.leftEyeIris[2][1]) / 2;
|
||||
ctx.ellipse(f.annotations.leftEyeIris[0][0], f.annotations.leftEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
const sizeX = Math.abs(f.annotations['leftEyeIris'][3][0] - f.annotations['leftEyeIris'][1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations['leftEyeIris'][4][1] - f.annotations['leftEyeIris'][2][1]) / 2;
|
||||
ctx.ellipse(f.annotations['leftEyeIris'][0][0], f.annotations['leftEyeIris'][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
ctx.fillStyle = localOptions.useDepth ? 'rgba(255, 255, 200, 0.3)' : localOptions.color;
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
if (f.annotations && f.annotations.rightEyeIris) {
|
||||
if (f.annotations && f.annotations['rightEyeIris']) {
|
||||
ctx.strokeStyle = localOptions.useDepth ? 'rgba(255, 200, 255, 0.3)' : localOptions.color;
|
||||
ctx.beginPath();
|
||||
const sizeX = Math.abs(f.annotations.rightEyeIris[3][0] - f.annotations.rightEyeIris[1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations.rightEyeIris[4][1] - f.annotations.rightEyeIris[2][1]) / 2;
|
||||
ctx.ellipse(f.annotations.rightEyeIris[0][0], f.annotations.rightEyeIris[0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
const sizeX = Math.abs(f.annotations['rightEyeIris'][3][0] - f.annotations['rightEyeIris'][1][0]) / 2;
|
||||
const sizeY = Math.abs(f.annotations['rightEyeIris'][4][1] - f.annotations['rightEyeIris'][2][1]) / 2;
|
||||
ctx.ellipse(f.annotations['rightEyeIris'][0][0], f.annotations['rightEyeIris'][0][1], sizeX, sizeY, 0, 0, 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
if (localOptions.fillPolygons) {
|
||||
ctx.fillStyle = localOptions.useDepth ? 'rgba(255, 255, 200, 0.3)' : localOptions.color;
|
||||
|
@ -241,7 +242,7 @@ export async function face(inCanvas: HTMLCanvasElement, result: Array<any>, draw
|
|||
}
|
||||
|
||||
const lastDrawnPose:any[] = [];
|
||||
export async function body(inCanvas: HTMLCanvasElement, result: Array<any>, drawOptions?: DrawOptions) {
|
||||
export async function body(inCanvas: HTMLCanvasElement, result: Array<Body>, drawOptions?: DrawOptions) {
|
||||
const localOptions = mergeDeep(options, drawOptions);
|
||||
if (!result || !inCanvas) return;
|
||||
if (!(inCanvas instanceof HTMLCanvasElement)) return;
|
||||
|
@ -249,20 +250,22 @@ export async function body(inCanvas: HTMLCanvasElement, result: Array<any>, draw
|
|||
if (!ctx) return;
|
||||
ctx.lineJoin = 'round';
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
// result[i].keypoints = result[i].keypoints.filter((a) => a.score > 0.5);
|
||||
if (!lastDrawnPose[i] && localOptions.bufferedOutput) lastDrawnPose[i] = { ...result[i] };
|
||||
ctx.strokeStyle = localOptions.color;
|
||||
ctx.fillStyle = localOptions.color;
|
||||
ctx.lineWidth = localOptions.lineWidth;
|
||||
ctx.font = localOptions.font;
|
||||
if (localOptions.drawBoxes) {
|
||||
if (localOptions.drawBoxes && result[i].box && result[i].box?.length === 4) {
|
||||
// @ts-ignore box may not exist
|
||||
rect(ctx, result[i].box[0], result[i].box[1], result[i].box[2], result[i].box[3], localOptions);
|
||||
if (localOptions.drawLabels) {
|
||||
if (localOptions.shadowColor && localOptions.shadowColor !== '') {
|
||||
ctx.fillStyle = localOptions.shadowColor;
|
||||
// @ts-ignore box may not exist
|
||||
ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 3, 1 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);
|
||||
}
|
||||
ctx.fillStyle = localOptions.labelColor;
|
||||
// @ts-ignore box may not exist
|
||||
ctx.fillText(`body ${100 * result[i].score}%`, result[i].box[0] + 2, 0 + result[i].box[1] + localOptions.lineHeight, result[i].box[2]);
|
||||
}
|
||||
}
|
||||
|
@ -361,7 +364,7 @@ export async function body(inCanvas: HTMLCanvasElement, result: Array<any>, draw
|
|||
}
|
||||
}
|
||||
|
||||
export async function hand(inCanvas: HTMLCanvasElement, result: Array<any>, drawOptions?: DrawOptions) {
|
||||
export async function hand(inCanvas: HTMLCanvasElement, result: Array<Hand>, drawOptions?: DrawOptions) {
|
||||
const localOptions = mergeDeep(options, drawOptions);
|
||||
if (!result || !inCanvas) return;
|
||||
if (!(inCanvas instanceof HTMLCanvasElement)) return;
|
||||
|
@ -415,12 +418,12 @@ export async function hand(inCanvas: HTMLCanvasElement, result: Array<any>, draw
|
|||
ctx.fillText(title, part[part.length - 1][0] + 4, part[part.length - 1][1] + 4);
|
||||
};
|
||||
ctx.font = localOptions.font;
|
||||
addHandLabel(h.annotations.indexFinger, 'index');
|
||||
addHandLabel(h.annotations.middleFinger, 'middle');
|
||||
addHandLabel(h.annotations.ringFinger, 'ring');
|
||||
addHandLabel(h.annotations.pinky, 'pinky');
|
||||
addHandLabel(h.annotations.thumb, 'thumb');
|
||||
addHandLabel(h.annotations.palmBase, 'palm');
|
||||
addHandLabel(h.annotations['indexFinger'], 'index');
|
||||
addHandLabel(h.annotations['middleFinger'], 'middle');
|
||||
addHandLabel(h.annotations['ringFinger'], 'ring');
|
||||
addHandLabel(h.annotations['pinky'], 'pinky');
|
||||
addHandLabel(h.annotations['thumb'], 'thumb');
|
||||
addHandLabel(h.annotations['palmBase'], 'palm');
|
||||
}
|
||||
if (localOptions.drawPolygons) {
|
||||
const addHandLine = (part) => {
|
||||
|
@ -434,17 +437,17 @@ export async function hand(inCanvas: HTMLCanvasElement, result: Array<any>, draw
|
|||
}
|
||||
};
|
||||
ctx.lineWidth = localOptions.lineWidth;
|
||||
addHandLine(h.annotations.indexFinger);
|
||||
addHandLine(h.annotations.middleFinger);
|
||||
addHandLine(h.annotations.ringFinger);
|
||||
addHandLine(h.annotations.pinky);
|
||||
addHandLine(h.annotations.thumb);
|
||||
addHandLine(h.annotations['indexFinger']);
|
||||
addHandLine(h.annotations['middleFinger']);
|
||||
addHandLine(h.annotations['ringFinger']);
|
||||
addHandLine(h.annotations['pinky']);
|
||||
addHandLine(h.annotations['thumb']);
|
||||
// addPart(h.annotations.palmBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function object(inCanvas: HTMLCanvasElement, result: Array<any>, drawOptions?: DrawOptions) {
|
||||
export async function object(inCanvas: HTMLCanvasElement, result: Array<Item>, drawOptions?: DrawOptions) {
|
||||
const localOptions = mergeDeep(options, drawOptions);
|
||||
if (!result || !inCanvas) return;
|
||||
if (!(inCanvas instanceof HTMLCanvasElement)) return;
|
||||
|
@ -479,7 +482,7 @@ export async function canvas(inCanvas: HTMLCanvasElement, outCanvas: HTMLCanvasE
|
|||
outCtx?.drawImage(inCanvas, 0, 0);
|
||||
}
|
||||
|
||||
export async function all(inCanvas: HTMLCanvasElement, result:any, drawOptions?: DrawOptions) {
|
||||
export async function all(inCanvas: HTMLCanvasElement, result: Result, drawOptions?: DrawOptions) {
|
||||
const localOptions = mergeDeep(options, drawOptions);
|
||||
if (!result || !inCanvas) return;
|
||||
if (!(inCanvas instanceof HTMLCanvasElement)) return;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { log, join } from '../helpers';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import { Body } from '../result';
|
||||
|
||||
let model;
|
||||
let keypoints: Array<any> = [];
|
||||
|
@ -37,8 +38,7 @@ function max2d(inputs, minScore) {
|
|||
});
|
||||
}
|
||||
|
||||
export async function predict(image, config) {
|
||||
if (!model) return null;
|
||||
export async function predict(image, config): Promise<Body[]> {
|
||||
if ((skipped < config.body.skipFrames) && config.skipFrame && Object.keys(keypoints).length > 0) {
|
||||
skipped++;
|
||||
return keypoints;
|
||||
|
@ -87,6 +87,6 @@ export async function predict(image, config) {
|
|||
keypoints = parts;
|
||||
}
|
||||
const score = keypoints.reduce((prev, curr) => (curr.score > prev ? curr.score : prev), 0);
|
||||
resolve([{ score, keypoints }]);
|
||||
resolve([{ id: 0, score, keypoints }]);
|
||||
});
|
||||
}
|
||||
|
|
27
src/face.ts
27
src/face.ts
|
@ -1,10 +1,8 @@
|
|||
import { log, now } from './helpers';
|
||||
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';
|
||||
|
||||
type Tensor = typeof tf.Tensor;
|
||||
import { Face } from './result';
|
||||
|
||||
const calculateFaceAngle = (face, image_size): { angle: { pitch: number, yaw: number, roll: number }, matrix: [number, number, number, number, number, number, number, number, number] } => {
|
||||
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
||||
|
@ -107,27 +105,7 @@ export const detectFace = async (parent, input): Promise<any> => {
|
|||
let emotionRes;
|
||||
let embeddingRes;
|
||||
let descRes;
|
||||
const faceRes: Array<{
|
||||
confidence: number,
|
||||
boxConfidence: number,
|
||||
faceConfidence: number,
|
||||
box: [number, number, number, number],
|
||||
mesh: Array<[number, number, number]>
|
||||
meshRaw: Array<[number, number, number]>
|
||||
boxRaw: [number, number, number, number],
|
||||
annotations: Array<{ part: string, points: Array<[number, number, number]>[] }>,
|
||||
age: number,
|
||||
gender: string,
|
||||
genderConfidence: number,
|
||||
emotion: string,
|
||||
embedding: number[],
|
||||
iris: number,
|
||||
rotation: {
|
||||
angle: { pitch: number, yaw: number, roll: number },
|
||||
matrix: [number, number, number, number, number, number, number, number, number]
|
||||
},
|
||||
tensor: Tensor,
|
||||
}> = [];
|
||||
const faceRes: Array<Face> = [];
|
||||
parent.state = 'run:face';
|
||||
timeStamp = now();
|
||||
const faces = await facemesh.predict(input, parent.config);
|
||||
|
@ -189,6 +167,7 @@ export const detectFace = async (parent, input): Promise<any> => {
|
|||
|
||||
// combine results
|
||||
faceRes.push({
|
||||
id: i,
|
||||
...faces[i],
|
||||
age: descRes.age,
|
||||
gender: descRes.gender,
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
export const body = (res) => {
|
||||
import { Gesture } from '../result';
|
||||
|
||||
export const body = (res): Gesture[] => {
|
||||
if (!res) return [];
|
||||
const gestures: Array<{ body: number, gesture: string }> = [];
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
|
@ -18,7 +20,7 @@ export const body = (res) => {
|
|||
return gestures;
|
||||
};
|
||||
|
||||
export const face = (res) => {
|
||||
export const face = (res): Gesture[] => {
|
||||
if (!res) return [];
|
||||
const gestures: Array<{ face: number, gesture: string }> = [];
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
|
@ -39,7 +41,7 @@ export const face = (res) => {
|
|||
return gestures;
|
||||
};
|
||||
|
||||
export const iris = (res) => {
|
||||
export const iris = (res): Gesture[] => {
|
||||
if (!res) return [];
|
||||
const gestures: Array<{ iris: number, gesture: string }> = [];
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
|
@ -77,7 +79,7 @@ export const iris = (res) => {
|
|||
return gestures;
|
||||
};
|
||||
|
||||
export const hand = (res) => {
|
||||
export const hand = (res): Gesture[] => {
|
||||
if (!res) return [];
|
||||
const gestures: Array<{ hand: number, gesture: string }> = [];
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
|
|
|
@ -2,6 +2,7 @@ import { log, join } from '../helpers';
|
|||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as handdetector from './handdetector';
|
||||
import * as handpipeline from './handpipeline';
|
||||
import { Hand } from '../result';
|
||||
|
||||
const meshAnnotations = {
|
||||
thumb: [1, 2, 3, 4],
|
||||
|
@ -16,30 +17,30 @@ let handDetectorModel;
|
|||
let handPoseModel;
|
||||
let handPipeline;
|
||||
|
||||
export async function predict(input, config) {
|
||||
export async function predict(input, config): Promise<Hand[]> {
|
||||
const predictions = await handPipeline.estimateHands(input, config);
|
||||
if (!predictions) return [];
|
||||
const hands: Array<{ confidence: number, box: any, boxRaw: any, landmarks: any, annotations: any }> = [];
|
||||
for (const prediction of predictions) {
|
||||
const hands: Array<Hand> = [];
|
||||
for (let i = 0; i < predictions.length; i++) {
|
||||
const annotations = {};
|
||||
if (prediction.landmarks) {
|
||||
if (predictions[i].landmarks) {
|
||||
for (const key of Object.keys(meshAnnotations)) {
|
||||
annotations[key] = meshAnnotations[key].map((index) => prediction.landmarks[index]);
|
||||
annotations[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);
|
||||
}
|
||||
}
|
||||
const box = prediction.box ? [
|
||||
Math.max(0, prediction.box.topLeft[0]),
|
||||
Math.max(0, prediction.box.topLeft[1]),
|
||||
Math.min(input.shape[2], prediction.box.bottomRight[0]) - Math.max(0, prediction.box.topLeft[0]),
|
||||
Math.min(input.shape[1], prediction.box.bottomRight[1]) - Math.max(0, prediction.box.topLeft[1]),
|
||||
] : [];
|
||||
const boxRaw = [
|
||||
(prediction.box.topLeft[0]) / input.shape[2],
|
||||
(prediction.box.topLeft[1]) / input.shape[1],
|
||||
(prediction.box.bottomRight[0] - prediction.box.topLeft[0]) / input.shape[2],
|
||||
(prediction.box.bottomRight[1] - prediction.box.topLeft[1]) / input.shape[1],
|
||||
const box: [number, number, number, number] = predictions[i].box ? [
|
||||
Math.max(0, predictions[i].box.topLeft[0]),
|
||||
Math.max(0, predictions[i].box.topLeft[1]),
|
||||
Math.min(input.shape[2], predictions[i].box.bottomRight[0]) - Math.max(0, predictions[i].box.topLeft[0]),
|
||||
Math.min(input.shape[1], predictions[i].box.bottomRight[1]) - Math.max(0, predictions[i].box.topLeft[1]),
|
||||
] : [0, 0, 0, 0];
|
||||
const boxRaw: [number, number, number, number] = [
|
||||
(predictions[i].box.topLeft[0]) / input.shape[2],
|
||||
(predictions[i].box.topLeft[1]) / input.shape[1],
|
||||
(predictions[i].box.bottomRight[0] - predictions[i].box.topLeft[0]) / input.shape[2],
|
||||
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / input.shape[1],
|
||||
];
|
||||
hands.push({ confidence: Math.round(100 * prediction.confidence) / 100, box, boxRaw, landmarks: prediction.landmarks, annotations });
|
||||
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box, boxRaw, landmarks: predictions[i].landmarks, annotations });
|
||||
}
|
||||
return hands;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import * as app from '../package.json';
|
|||
export type Tensor = typeof tf.Tensor;
|
||||
|
||||
export type { Config } from './config';
|
||||
export type { Result } from './result';
|
||||
export type { Result, Face, Hand, Body, Item, Gesture } from './result';
|
||||
export type { DrawOptions } from './draw/draw';
|
||||
|
||||
/** Defines all possible input types for **Human** detection */
|
||||
|
@ -530,7 +530,7 @@ export class Human {
|
|||
|
||||
this.perf.total = Math.trunc(now() - timeStart);
|
||||
this.state = 'idle';
|
||||
const result = {
|
||||
const res = {
|
||||
face: faceRes,
|
||||
body: bodyRes,
|
||||
hand: handRes,
|
||||
|
@ -540,7 +540,7 @@ export class Human {
|
|||
canvas: process.canvas,
|
||||
};
|
||||
// log('Result:', result);
|
||||
resolve(result);
|
||||
resolve(res);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { log, join } from '../helpers';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import { labels } from './labels';
|
||||
import { Item } from '../result';
|
||||
|
||||
let model;
|
||||
let last: Array<{}> = [];
|
||||
let last: Item[] = [];
|
||||
let skipped = Number.MAX_SAFE_INTEGER;
|
||||
|
||||
export async function load(config) {
|
||||
|
@ -58,8 +59,7 @@ async function process(res, inputSize, outputShape, config) {
|
|||
return results;
|
||||
}
|
||||
|
||||
export async function predict(image, config) {
|
||||
if (!model) return null;
|
||||
export async function predict(image, config): Promise<Item[]> {
|
||||
if ((skipped < config.object.skipFrames) && config.skipFrame && (last.length > 0)) {
|
||||
skipped++;
|
||||
return last;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { log, join } from '../helpers';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import { labels } from './labels';
|
||||
import { Item } from '../result';
|
||||
|
||||
let model;
|
||||
let last: Array<{}> = [];
|
||||
let last: Array<Item> = [];
|
||||
let skipped = Number.MAX_SAFE_INTEGER;
|
||||
|
||||
const scaleBox = 2.5; // increase box size
|
||||
|
@ -95,8 +96,7 @@ async function process(res, inputSize, outputShape, config) {
|
|||
return results;
|
||||
}
|
||||
|
||||
export async function predict(image, config) {
|
||||
if (!model) return null;
|
||||
export async function predict(image, config): Promise<Item[]> {
|
||||
if ((skipped < config.object.skipFrames) && config.skipFrame && (last.length > 0)) {
|
||||
skipped++;
|
||||
return last;
|
||||
|
|
|
@ -2,11 +2,12 @@ import { log, join } from '../helpers';
|
|||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as poses from './poses';
|
||||
import * as util from './utils';
|
||||
import { Body } from '../result';
|
||||
|
||||
let model;
|
||||
const poseNetOutputs = ['MobilenetV1/offset_2/BiasAdd'/* offsets */, 'MobilenetV1/heatmap_2/BiasAdd'/* heatmapScores */, 'MobilenetV1/displacement_fwd_2/BiasAdd'/* displacementFwd */, 'MobilenetV1/displacement_bwd_2/BiasAdd'/* displacementBwd */];
|
||||
|
||||
export async function predict(input, config) {
|
||||
export async function predict(input, config): Promise<Body[]> {
|
||||
const res = tf.tidy(() => {
|
||||
const resized = input.resizeBilinear([model.inputs[0].shape[2], model.inputs[0].shape[1]]);
|
||||
const normalized = resized.toFloat().div(127.5).sub(1.0);
|
||||
|
@ -20,7 +21,7 @@ export async function predict(input, config) {
|
|||
for (const t of res) t.dispose();
|
||||
|
||||
const decoded = await poses.decode(buffers[0], buffers[1], buffers[2], buffers[3], config.body.maxDetected, config.body.minConfidence);
|
||||
const scaled = util.scalePoses(decoded, [input.shape[1], input.shape[2]], [model.inputs[0].shape[2], model.inputs[0].shape[1]]);
|
||||
const scaled = util.scalePoses(decoded, [input.shape[1], input.shape[2]], [model.inputs[0].shape[2], model.inputs[0].shape[1]]) as Body[];
|
||||
return scaled;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,11 @@ export function getBoundingBox(keypoints) {
|
|||
}
|
||||
|
||||
export function scalePoses(poses, [height, width], [inputResolutionHeight, inputResolutionWidth]) {
|
||||
const scalePose = (pose, scaleY, scaleX) => ({
|
||||
const scaleY = height / inputResolutionHeight;
|
||||
const scaleX = width / inputResolutionWidth;
|
||||
const scalePose = (pose) => ({
|
||||
score: pose.score,
|
||||
bowRaw: [pose.box[0] / inputResolutionWidth, pose.box[1] / inputResolutionHeight, pose.box[2] / inputResolutionWidth, pose.box[3] / inputResolutionHeight],
|
||||
box: [Math.trunc(pose.box[0] * scaleX), Math.trunc(pose.box[1] * scaleY), Math.trunc(pose.box[2] * scaleX), Math.trunc(pose.box[3] * scaleY)],
|
||||
keypoints: pose.keypoints.map(({ score, part, position }) => ({
|
||||
score,
|
||||
|
@ -39,7 +42,7 @@ export function scalePoses(poses, [height, width], [inputResolutionHeight, input
|
|||
position: { x: Math.trunc(position.x * scaleX), y: Math.trunc(position.y * scaleY) },
|
||||
})),
|
||||
});
|
||||
const scaledPoses = poses.map((pose) => scalePose(pose, height / inputResolutionHeight, width / inputResolutionWidth));
|
||||
const scaledPoses = poses.map((pose) => scalePose(pose));
|
||||
return scaledPoses;
|
||||
}
|
||||
|
||||
|
|
247
src/result.ts
247
src/result.ts
|
@ -3,114 +3,151 @@
|
|||
*
|
||||
* Contains all possible detection results
|
||||
*/
|
||||
export interface Result {
|
||||
/** Face results
|
||||
* Combined results of face detector, face mesh, age, gender, emotion, embedding, iris models
|
||||
* Some values may be null if specific model is not enabled
|
||||
*
|
||||
* Array of individual results with one object per detected face
|
||||
* Each result has:
|
||||
* - overal detection confidence value
|
||||
* - box detection confidence value
|
||||
* - mesh detection confidence value
|
||||
* - box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw as array of [x, y, width, height], normalized to range 0..1
|
||||
* - mesh as array of [x, y, z] points of face mesh, normalized to image resolution
|
||||
* - meshRaw as array of [x, y, z] points of face mesh, normalized to range 0..1
|
||||
* - annotations as array of annotated face mesh points
|
||||
* - age as value
|
||||
* - gender as value
|
||||
* - genderConfidence as value
|
||||
* - emotion as array of possible emotions with their individual scores
|
||||
* - iris as distance value
|
||||
* - angle as object with values for roll, yaw and pitch angles
|
||||
* - tensor as Tensor object which contains detected face
|
||||
*/
|
||||
face: Array<{
|
||||
confidence: number,
|
||||
boxConfidence: number,
|
||||
faceConfidence: number,
|
||||
box: [number, number, number, number],
|
||||
boxRaw: [number, number, number, number],
|
||||
mesh: Array<[number, number, number]>
|
||||
meshRaw: Array<[number, number, number]>
|
||||
annotations: Array<{ part: string, points: Array<[number, number, number]>[] }>,
|
||||
age: number,
|
||||
gender: string,
|
||||
genderConfidence: number,
|
||||
emotion: Array<{ score: number, emotion: string }>,
|
||||
embedding: Array<number>,
|
||||
iris: number,
|
||||
rotation: {
|
||||
angle: { roll: number, yaw: number, pitch: number },
|
||||
matrix: Array<[number, number, number, number, number, number, number, number, number]>
|
||||
}
|
||||
tensor: any,
|
||||
}>,
|
||||
/** Body results
|
||||
*
|
||||
* Array of individual results with one object per detected body
|
||||
* Each results has:
|
||||
* - body id number
|
||||
* - body part name
|
||||
* - part position with x,y,z coordinates
|
||||
* - body part score value
|
||||
* - body part presence value
|
||||
*/
|
||||
body: Array<{
|
||||
id: number,
|
||||
|
||||
/** Face results
|
||||
* Combined results of face detector, face mesh, age, gender, emotion, embedding, iris models
|
||||
* Some values may be null if specific model is not enabled
|
||||
*
|
||||
* Array of individual results with one object per detected face
|
||||
* Each result has:
|
||||
* - id: face number
|
||||
* - confidence: overal detection confidence value
|
||||
* - boxConfidence: face box detection confidence value
|
||||
* - faceConfidence: face keypoints detection confidence value
|
||||
* - box: face bounding box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw: face bounding box as array of [x, y, width, height], normalized to range 0..1
|
||||
* - mesh: face keypoints as array of [x, y, z] points of face mesh, normalized to image resolution
|
||||
* - meshRaw: face keypoints as array of [x, y, z] points of face mesh, normalized to range 0..1
|
||||
* - annotations: annotated face keypoints as array of annotated face mesh points
|
||||
* - age: age as value
|
||||
* - gender: gender as value
|
||||
* - genderConfidence: gender detection confidence as value
|
||||
* - emotion: emotions as array of possible emotions with their individual scores
|
||||
* - embedding: facial descriptor as array of numerical elements
|
||||
* - iris: iris distance from current viewpoint as distance value
|
||||
* - rotation: face rotiation that contains both angles and matrix used for 3d transformations
|
||||
* - angle: face angle as object with values for roll, yaw and pitch angles
|
||||
* - matrix: 3d transofrmation matrix as array of numeric values
|
||||
* - tensor: face tensor as Tensor object which contains detected face
|
||||
*/
|
||||
export interface Face {
|
||||
id: number
|
||||
confidence: number,
|
||||
boxConfidence: number,
|
||||
faceConfidence: number,
|
||||
box: [number, number, number, number],
|
||||
boxRaw: [number, number, number, number],
|
||||
mesh: Array<[number, number, number]>
|
||||
meshRaw: Array<[number, number, number]>
|
||||
annotations: Array<{ part: string, points: Array<[number, number, number]>[] }>,
|
||||
age: number,
|
||||
gender: string,
|
||||
genderConfidence: number,
|
||||
emotion: Array<{ score: number, emotion: string }>,
|
||||
embedding: Array<number>,
|
||||
iris: number,
|
||||
rotation: {
|
||||
angle: { roll: number, yaw: number, pitch: number },
|
||||
matrix: [number, number, number, number, number, number, number, number, number],
|
||||
}
|
||||
tensor: any,
|
||||
}
|
||||
|
||||
/** Body results
|
||||
*
|
||||
* Array of individual results with one object per detected body
|
||||
* Each results has:
|
||||
* - id:body id number
|
||||
* - score: overall detection score
|
||||
* - box: bounding box: x, y, width, height normalized to input image resolution
|
||||
* - boxRaw: bounding box: x, y, width, height normalized to 0..1
|
||||
* - keypoints: array of keypoints
|
||||
* - part: body part name
|
||||
* - position: body part position with x,y,z coordinates
|
||||
* - score: body part score value
|
||||
* - presence: body part presence value
|
||||
*/
|
||||
|
||||
export interface Body {
|
||||
id: number,
|
||||
score: number,
|
||||
box?: [x: number, y: number, width: number, height: number],
|
||||
boxRaw?: [x: number, y: number, width: number, height: number],
|
||||
keypoints: Array<{
|
||||
part: string,
|
||||
position: { x: number, y: number, z: number },
|
||||
score: number,
|
||||
presence: number }>,
|
||||
/** Hand results
|
||||
*
|
||||
* Array of individual results with one object per detected hand
|
||||
* Each result has:
|
||||
* - confidence as value
|
||||
* - box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw as array of [x, y, width, height], normalized to range 0..1
|
||||
* - landmarks as array of [x, y, z] points of hand, normalized to image resolution
|
||||
* - annotations as array of annotated face landmark points
|
||||
*/
|
||||
hand: Array<{
|
||||
confidence: number,
|
||||
box: [number, number, number, number],
|
||||
boxRaw: [number, number, number, number],
|
||||
landmarks: Array<[number, number, number]>,
|
||||
annotations: Array<{ part: string, points: Array<[number, number, number]>[] }>,
|
||||
}>,
|
||||
/** Gesture results
|
||||
*
|
||||
* Array of individual results with one object per detected gesture
|
||||
* Each result has:
|
||||
* - part: part name and number where gesture was detected: face, iris, body, hand
|
||||
* - gesture: gesture detected
|
||||
*/
|
||||
gesture: Array<
|
||||
{ 'face': number, gesture: string } | { 'iris': number, gesture: string } | { 'body': number, gesture: string } | { 'hand': number, gesture: string }
|
||||
>,
|
||||
/** Object results
|
||||
*
|
||||
* Array of individual results with one object per detected gesture
|
||||
* Each result has:
|
||||
* - score as value
|
||||
* - label as detected class name
|
||||
* - center as array of [x, y], normalized to image resolution
|
||||
* - centerRaw as array of [x, y], normalized to range 0..1
|
||||
* - box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw as array of [x, y, width, height], normalized to range 0..1
|
||||
*/
|
||||
object: Array<{
|
||||
score: number,
|
||||
strideSize: number,
|
||||
class: number,
|
||||
label: string,
|
||||
center: number[],
|
||||
centerRaw: number[],
|
||||
box: number[],
|
||||
boxRaw: number[],
|
||||
}>,
|
||||
presence: number,
|
||||
}>
|
||||
}
|
||||
|
||||
/** Hand results
|
||||
*
|
||||
* Array of individual results with one object per detected hand
|
||||
* Each result has:
|
||||
* - confidence as value
|
||||
* - box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw as array of [x, y, width, height], normalized to range 0..1
|
||||
* - landmarks as array of [x, y, z] points of hand, normalized to image resolution
|
||||
* - annotations as array of annotated face landmark points
|
||||
*/
|
||||
export interface Hand {
|
||||
id: number,
|
||||
confidence: number,
|
||||
box: [number, number, number, number],
|
||||
boxRaw: [number, number, number, number],
|
||||
landmarks: Array<[number, number, number]>,
|
||||
// annotations: Array<{ part: string, points: Array<[number, number, number]> }>,
|
||||
// annotations: Annotations,
|
||||
annotations: Record<string, Array<{ part: string, points: Array<[number, number, number]> }>>,
|
||||
}
|
||||
|
||||
/** Object results
|
||||
*
|
||||
* Array of individual results with one object per detected gesture
|
||||
* Each result has:
|
||||
* - score as value
|
||||
* - label as detected class name
|
||||
* - center as array of [x, y], normalized to image resolution
|
||||
* - centerRaw as array of [x, y], normalized to range 0..1
|
||||
* - box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw as array of [x, y, width, height], normalized to range 0..1
|
||||
*/
|
||||
export interface Item {
|
||||
score: number,
|
||||
strideSize?: number,
|
||||
class: number,
|
||||
label: string,
|
||||
center?: number[],
|
||||
centerRaw?: number[],
|
||||
box: number[],
|
||||
boxRaw: number[],
|
||||
}
|
||||
|
||||
/** Gesture results
|
||||
*
|
||||
* Array of individual results with one object per detected gesture
|
||||
* Each result has:
|
||||
* - part: part name and number where gesture was detected: face, iris, body, hand
|
||||
* - gesture: gesture detected
|
||||
*/
|
||||
export type Gesture =
|
||||
{ 'face': number, gesture: string }
|
||||
| { 'iris': number, gesture: string }
|
||||
| { 'body': number, gesture: string }
|
||||
| { 'hand': number, gesture: string }
|
||||
|
||||
export interface Result {
|
||||
/** {@link Face}: detection & analysis results */
|
||||
face: Array<Face>,
|
||||
/** {@link Body}: detection & analysis results */
|
||||
body: Array<Body>,
|
||||
/** {@link Hand}: detection & analysis results */
|
||||
hand: Array<Hand>,
|
||||
/** {@link Gesture}: detection & analysis results */
|
||||
gesture: Array<Gesture>,
|
||||
/** {@link Object}: detection & analysis results */
|
||||
object: Array<Item>
|
||||
performance: { any },
|
||||
canvas: OffscreenCanvas | HTMLCanvasElement,
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -74,8 +74,12 @@
|
|||
<section class="tsd-index-section ">
|
||||
<h3>Interfaces</h3>
|
||||
<ul class="tsd-index-list">
|
||||
<li class="tsd-kind-interface"><a href="interfaces/body.html" class="tsd-kind-icon">Body</a></li>
|
||||
<li class="tsd-kind-interface"><a href="interfaces/config.html" class="tsd-kind-icon">Config</a></li>
|
||||
<li class="tsd-kind-interface"><a href="interfaces/drawoptions.html" class="tsd-kind-icon">Draw<wbr>Options</a></li>
|
||||
<li class="tsd-kind-interface"><a href="interfaces/face.html" class="tsd-kind-icon">Face</a></li>
|
||||
<li class="tsd-kind-interface"><a href="interfaces/hand.html" class="tsd-kind-icon">Hand</a></li>
|
||||
<li class="tsd-kind-interface"><a href="interfaces/object.html" class="tsd-kind-icon">Object</a></li>
|
||||
<li class="tsd-kind-interface"><a href="interfaces/result.html" class="tsd-kind-icon">Result</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
|
@ -83,6 +87,7 @@
|
|||
<h3>Type aliases</h3>
|
||||
<ul class="tsd-index-list">
|
||||
<li class="tsd-kind-type-alias"><a href="index.html#error" class="tsd-kind-icon">Error</a></li>
|
||||
<li class="tsd-kind-type-alias"><a href="index.html#gesture" class="tsd-kind-icon">Gesture</a></li>
|
||||
<li class="tsd-kind-type-alias"><a href="index.html#input" class="tsd-kind-icon">Input</a></li>
|
||||
<li class="tsd-kind-type-alias"><a href="index.html#tensor" class="tsd-kind-icon">Tensor</a></li>
|
||||
<li class="tsd-kind-type-alias"><a href="index.html#tensorflow" class="tsd-kind-icon">Tensor<wbr>Flow</a></li>
|
||||
|
@ -121,6 +126,24 @@
|
|||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-type-alias">
|
||||
<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-symbol">{ </span>face<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>gesture<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><span class="tsd-signature-symbol">{ </span>gesture<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>iris<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>body<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>gesture<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><span class="tsd-signature-symbol">{ </span>gesture<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>hand<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
<div class="lead">
|
||||
<p>Gesture results</p>
|
||||
</div>
|
||||
<p>Array of individual results with one object per detected gesture
|
||||
Each result has:</p>
|
||||
<ul>
|
||||
<li>part: part name and number where gesture was detected: face, iris, body, hand</li>
|
||||
<li>gesture: gesture detected</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-type-alias">
|
||||
<a name="input" class="tsd-anchor"></a>
|
||||
<h3>Input</h3>
|
||||
|
@ -175,18 +198,33 @@
|
|||
<li class=" tsd-kind-class">
|
||||
<a href="classes/human.html" class="tsd-kind-icon">Human</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="interfaces/body.html" class="tsd-kind-icon">Body</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="interfaces/config.html" class="tsd-kind-icon">Config</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="interfaces/drawoptions.html" class="tsd-kind-icon">Draw<wbr>Options</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="interfaces/face.html" class="tsd-kind-icon">Face</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="interfaces/hand.html" class="tsd-kind-icon">Hand</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="interfaces/object.html" class="tsd-kind-icon">Object</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="interfaces/result.html" class="tsd-kind-icon">Result</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="index.html#error" class="tsd-kind-icon">Error</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="index.html#gesture" class="tsd-kind-icon">Gesture</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="index.html#input" class="tsd-kind-icon">Input</a>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,234 @@
|
|||
<!doctype html>
|
||||
<html class="default no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Body | @vladmandic/human</title>
|
||||
<meta name="description" content="Documentation for @vladmandic/human">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="../assets/css/main.css">
|
||||
<script async src="../assets/js/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-index="../assets/js/search.json" data-base="..">
|
||||
<div class="field">
|
||||
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
|
||||
<input id="tsd-search-field" type="text" />
|
||||
</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</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</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="body.html">Body</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h1>Interface Body</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>Body results</p>
|
||||
</div>
|
||||
<p>Array of individual results with one object per detected body
|
||||
Each results has:</p>
|
||||
<ul>
|
||||
<li>body id number</li>
|
||||
<li>score: overall detection score</li>
|
||||
<li>box bounding box: x, y, width, height</li>
|
||||
<li>keypoints: array of keypoints</li>
|
||||
<li>part: body part name</li>
|
||||
<li>position: body part position with x,y,z coordinates</li>
|
||||
<li>score: body part score value</li>
|
||||
<li>presence: body part presence value</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-hierarchy">
|
||||
<h3>Hierarchy</h3>
|
||||
<ul class="tsd-hierarchy">
|
||||
<li>
|
||||
<span class="target">Body</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="body.html#box" class="tsd-kind-icon">box</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="body.html#id" class="tsd-kind-icon">id</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="body.html#keypoints" class="tsd-kind-icon">keypoints</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="body.html#score" class="tsd-kind-icon">score</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="box" class="tsd-anchor"></a>
|
||||
<h3>box</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">box<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span>x<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span>y<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span>width<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span>height<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="id" class="tsd-anchor"></a>
|
||||
<h3>id</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="keypoints" class="tsd-anchor"></a>
|
||||
<h3>keypoints</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">keypoints<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>part<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>position<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>x<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>y<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>z<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>presence<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>score<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">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="score" class="tsd-anchor"></a>
|
||||
<h3>score</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">score<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</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 class="before-current">
|
||||
<li class=" tsd-kind-reference">
|
||||
<a href="../index.html#default" class="tsd-kind-icon">default</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-class">
|
||||
<a href="../classes/human.html" class="tsd-kind-icon">Human</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="current">
|
||||
<li class="current tsd-kind-interface">
|
||||
<a href="body.html" class="tsd-kind-icon">Body</a>
|
||||
<ul>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="body.html#box" class="tsd-kind-icon">box</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="body.html#id" class="tsd-kind-icon">id</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="body.html#keypoints" class="tsd-kind-icon">keypoints</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="body.html#score" class="tsd-kind-icon">score</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="after-current">
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="config.html" class="tsd-kind-icon">Config</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="drawoptions.html" class="tsd-kind-icon">Draw<wbr>Options</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="face.html" class="tsd-kind-icon">Face</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="hand.html" class="tsd-kind-icon">Hand</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="object.html" class="tsd-kind-icon">Object</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="result.html" class="tsd-kind-icon">Result</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#error" class="tsd-kind-icon">Error</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#gesture" class="tsd-kind-icon">Gesture</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#input" class="tsd-kind-icon">Input</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#tensor" class="tsd-kind-icon">Tensor</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#tensorflow" class="tsd-kind-icon">Tensor<wbr>Flow</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<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>
|
||||
</div>
|
||||
</footer>
|
||||
<div class="overlay"></div>
|
||||
<script src="../assets/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -661,6 +661,9 @@
|
|||
<li class=" tsd-kind-class">
|
||||
<a href="../classes/human.html" class="tsd-kind-icon">Human</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="body.html" class="tsd-kind-icon">Body</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="current">
|
||||
<li class="current tsd-kind-interface">
|
||||
|
@ -712,12 +715,24 @@
|
|||
<li class=" tsd-kind-interface">
|
||||
<a href="drawoptions.html" class="tsd-kind-icon">Draw<wbr>Options</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="face.html" class="tsd-kind-icon">Face</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="hand.html" class="tsd-kind-icon">Hand</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="object.html" class="tsd-kind-icon">Object</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="result.html" class="tsd-kind-icon">Result</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#error" class="tsd-kind-icon">Error</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#gesture" class="tsd-kind-icon">Gesture</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#input" class="tsd-kind-icon">Input</a>
|
||||
</li>
|
||||
|
|
|
@ -272,6 +272,9 @@
|
|||
<li class=" tsd-kind-class">
|
||||
<a href="../classes/human.html" class="tsd-kind-icon">Human</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="body.html" class="tsd-kind-icon">Body</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="config.html" class="tsd-kind-icon">Config</a>
|
||||
</li>
|
||||
|
@ -338,12 +341,24 @@
|
|||
</li>
|
||||
</ul>
|
||||
<ul class="after-current">
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="face.html" class="tsd-kind-icon">Face</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="hand.html" class="tsd-kind-icon">Hand</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="object.html" class="tsd-kind-icon">Object</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="result.html" class="tsd-kind-icon">Result</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#error" class="tsd-kind-icon">Error</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#gesture" class="tsd-kind-icon">Gesture</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#input" class="tsd-kind-icon">Input</a>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,397 @@
|
|||
<!doctype html>
|
||||
<html class="default no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Face | @vladmandic/human</title>
|
||||
<meta name="description" content="Documentation for @vladmandic/human">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="../assets/css/main.css">
|
||||
<script async src="../assets/js/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-index="../assets/js/search.json" data-base="..">
|
||||
<div class="field">
|
||||
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
|
||||
<input id="tsd-search-field" type="text" />
|
||||
</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</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</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="face.html">Face</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h1>Interface Face</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>Face results
|
||||
Combined results of face detector, face mesh, age, gender, emotion, embedding, iris models
|
||||
Some values may be null if specific model is not enabled</p>
|
||||
</div>
|
||||
<p>Array of individual results with one object per detected face
|
||||
Each result has:</p>
|
||||
<ul>
|
||||
<li>overal detection confidence value</li>
|
||||
<li>box detection confidence value</li>
|
||||
<li>mesh detection confidence value</li>
|
||||
<li>box as array of [x, y, width, height], normalized to image resolution</li>
|
||||
<li>boxRaw as array of [x, y, width, height], normalized to range 0..1</li>
|
||||
<li>mesh as array of [x, y, z] points of face mesh, normalized to image resolution</li>
|
||||
<li>meshRaw as array of [x, y, z] points of face mesh, normalized to range 0..1</li>
|
||||
<li>annotations as array of annotated face mesh points</li>
|
||||
<li>age as value</li>
|
||||
<li>gender as value</li>
|
||||
<li>genderConfidence as value</li>
|
||||
<li>emotion as array of possible emotions with their individual scores</li>
|
||||
<li>iris as distance value</li>
|
||||
<li>angle as object with values for roll, yaw and pitch angles</li>
|
||||
<li>tensor as Tensor object which contains detected face</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-hierarchy">
|
||||
<h3>Hierarchy</h3>
|
||||
<ul class="tsd-hierarchy">
|
||||
<li>
|
||||
<span class="target">Face</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="face.html#age" class="tsd-kind-icon">age</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#annotations" class="tsd-kind-icon">annotations</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#box" class="tsd-kind-icon">box</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#boxconfidence" class="tsd-kind-icon">box<wbr>Confidence</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#boxraw" class="tsd-kind-icon">box<wbr>Raw</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#confidence" class="tsd-kind-icon">confidence</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#embedding" class="tsd-kind-icon">embedding</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#emotion" class="tsd-kind-icon">emotion</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#faceconfidence" class="tsd-kind-icon">face<wbr>Confidence</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#gender" class="tsd-kind-icon">gender</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#genderconfidence" class="tsd-kind-icon">gender<wbr>Confidence</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#iris" class="tsd-kind-icon">iris</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#mesh" class="tsd-kind-icon">mesh</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#meshraw" class="tsd-kind-icon">mesh<wbr>Raw</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#rotation" class="tsd-kind-icon">rotation</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="face.html#tensor" class="tsd-kind-icon">tensor</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="age" class="tsd-anchor"></a>
|
||||
<h3>age</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">age<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="annotations" class="tsd-anchor"></a>
|
||||
<h3>annotations</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">annotations<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>part<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>points<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><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-symbol"> }</span><span class="tsd-signature-symbol">[]</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="box" class="tsd-anchor"></a>
|
||||
<h3>box</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">box<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</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">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="boxconfidence" class="tsd-anchor"></a>
|
||||
<h3>box<wbr>Confidence</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">box<wbr>Confidence<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="boxraw" class="tsd-anchor"></a>
|
||||
<h3>box<wbr>Raw</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">box<wbr>Raw<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</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">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="confidence" class="tsd-anchor"></a>
|
||||
<h3>confidence</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">confidence<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="embedding" class="tsd-anchor"></a>
|
||||
<h3>embedding</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">embedding<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="emotion" class="tsd-anchor"></a>
|
||||
<h3>emotion</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">emotion<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>emotion<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>score<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">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="faceconfidence" class="tsd-anchor"></a>
|
||||
<h3>face<wbr>Confidence</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">face<wbr>Confidence<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="gender" class="tsd-anchor"></a>
|
||||
<h3>gender</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">gender<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="genderconfidence" class="tsd-anchor"></a>
|
||||
<h3>gender<wbr>Confidence</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">gender<wbr>Confidence<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="iris" class="tsd-anchor"></a>
|
||||
<h3>iris</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">iris<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="mesh" class="tsd-anchor"></a>
|
||||
<h3>mesh</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">mesh<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><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">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="meshraw" class="tsd-anchor"></a>
|
||||
<h3>mesh<wbr>Raw</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">mesh<wbr>Raw<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><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">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="rotation" class="tsd-anchor"></a>
|
||||
<h3>rotation</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">rotation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>angle<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>pitch<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>roll<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>yaw<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>matrix<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><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></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
<div class="tsd-type-declaration">
|
||||
<h4>Type declaration</h4>
|
||||
<ul class="tsd-parameters">
|
||||
<li class="tsd-parameter">
|
||||
<h5>angle<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>pitch<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>roll<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>yaw<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span></h5>
|
||||
<ul class="tsd-parameters">
|
||||
<li class="tsd-parameter">
|
||||
<h5>pitch<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5>
|
||||
</li>
|
||||
<li class="tsd-parameter">
|
||||
<h5>roll<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5>
|
||||
</li>
|
||||
<li class="tsd-parameter">
|
||||
<h5>yaw<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="tsd-parameter">
|
||||
<h5>matrix<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><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></h5>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="tensor" class="tsd-anchor"></a>
|
||||
<h3>tensor</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">tensor<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</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 class="before-current">
|
||||
<li class=" tsd-kind-reference">
|
||||
<a href="../index.html#default" class="tsd-kind-icon">default</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-class">
|
||||
<a href="../classes/human.html" class="tsd-kind-icon">Human</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="body.html" class="tsd-kind-icon">Body</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="config.html" class="tsd-kind-icon">Config</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="drawoptions.html" class="tsd-kind-icon">Draw<wbr>Options</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="current">
|
||||
<li class="current tsd-kind-interface">
|
||||
<a href="face.html" class="tsd-kind-icon">Face</a>
|
||||
<ul>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#age" class="tsd-kind-icon">age</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#annotations" class="tsd-kind-icon">annotations</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#box" class="tsd-kind-icon">box</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#boxconfidence" class="tsd-kind-icon">box<wbr>Confidence</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#boxraw" class="tsd-kind-icon">box<wbr>Raw</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#confidence" class="tsd-kind-icon">confidence</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#embedding" class="tsd-kind-icon">embedding</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#emotion" class="tsd-kind-icon">emotion</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#faceconfidence" class="tsd-kind-icon">face<wbr>Confidence</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#gender" class="tsd-kind-icon">gender</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#genderconfidence" class="tsd-kind-icon">gender<wbr>Confidence</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#iris" class="tsd-kind-icon">iris</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#mesh" class="tsd-kind-icon">mesh</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#meshraw" class="tsd-kind-icon">mesh<wbr>Raw</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#rotation" class="tsd-kind-icon">rotation</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="face.html#tensor" class="tsd-kind-icon">tensor</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="after-current">
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="hand.html" class="tsd-kind-icon">Hand</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="object.html" class="tsd-kind-icon">Object</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="result.html" class="tsd-kind-icon">Result</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#error" class="tsd-kind-icon">Error</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#gesture" class="tsd-kind-icon">Gesture</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#input" class="tsd-kind-icon">Input</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#tensor" class="tsd-kind-icon">Tensor</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#tensorflow" class="tsd-kind-icon">Tensor<wbr>Flow</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<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>
|
||||
</div>
|
||||
</footer>
|
||||
<div class="overlay"></div>
|
||||
<script src="../assets/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,242 @@
|
|||
<!doctype html>
|
||||
<html class="default no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Hand | @vladmandic/human</title>
|
||||
<meta name="description" content="Documentation for @vladmandic/human">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="../assets/css/main.css">
|
||||
<script async src="../assets/js/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-index="../assets/js/search.json" data-base="..">
|
||||
<div class="field">
|
||||
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
|
||||
<input id="tsd-search-field" type="text" />
|
||||
</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</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</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="hand.html">Hand</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h1>Interface Hand</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>Hand results</p>
|
||||
</div>
|
||||
<p>Array of individual results with one object per detected hand
|
||||
Each result has:</p>
|
||||
<ul>
|
||||
<li>confidence as value</li>
|
||||
<li>box as array of [x, y, width, height], normalized to image resolution</li>
|
||||
<li>boxRaw as array of [x, y, width, height], normalized to range 0..1</li>
|
||||
<li>landmarks as array of [x, y, z] points of hand, normalized to image resolution</li>
|
||||
<li>annotations as array of annotated face landmark points</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-hierarchy">
|
||||
<h3>Hierarchy</h3>
|
||||
<ul class="tsd-hierarchy">
|
||||
<li>
|
||||
<span class="target">Hand</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="hand.html#annotations" class="tsd-kind-icon">annotations</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="hand.html#box" class="tsd-kind-icon">box</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="hand.html#boxraw" class="tsd-kind-icon">box<wbr>Raw</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="hand.html#confidence" class="tsd-kind-icon">confidence</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="hand.html#landmarks" class="tsd-kind-icon">landmarks</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="annotations" class="tsd-anchor"></a>
|
||||
<h3>annotations</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">annotations<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>part<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>points<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><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-symbol"> }</span><span class="tsd-signature-symbol">[]</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="box" class="tsd-anchor"></a>
|
||||
<h3>box</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">box<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</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">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="boxraw" class="tsd-anchor"></a>
|
||||
<h3>box<wbr>Raw</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">box<wbr>Raw<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</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">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="confidence" class="tsd-anchor"></a>
|
||||
<h3>confidence</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">confidence<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="landmarks" class="tsd-anchor"></a>
|
||||
<h3>landmarks</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">landmarks<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><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">
|
||||
</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 class="before-current">
|
||||
<li class=" tsd-kind-reference">
|
||||
<a href="../index.html#default" class="tsd-kind-icon">default</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-class">
|
||||
<a href="../classes/human.html" class="tsd-kind-icon">Human</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="body.html" class="tsd-kind-icon">Body</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="config.html" class="tsd-kind-icon">Config</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="drawoptions.html" class="tsd-kind-icon">Draw<wbr>Options</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="face.html" class="tsd-kind-icon">Face</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="current">
|
||||
<li class="current tsd-kind-interface">
|
||||
<a href="hand.html" class="tsd-kind-icon">Hand</a>
|
||||
<ul>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="hand.html#annotations" class="tsd-kind-icon">annotations</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="hand.html#box" class="tsd-kind-icon">box</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="hand.html#boxraw" class="tsd-kind-icon">box<wbr>Raw</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="hand.html#confidence" class="tsd-kind-icon">confidence</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="hand.html#landmarks" class="tsd-kind-icon">landmarks</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="after-current">
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="object.html" class="tsd-kind-icon">Object</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="result.html" class="tsd-kind-icon">Result</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#error" class="tsd-kind-icon">Error</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#gesture" class="tsd-kind-icon">Gesture</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#input" class="tsd-kind-icon">Input</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#tensor" class="tsd-kind-icon">Tensor</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#tensorflow" class="tsd-kind-icon">Tensor<wbr>Flow</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<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>
|
||||
</div>
|
||||
</footer>
|
||||
<div class="overlay"></div>
|
||||
<script src="../assets/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,276 @@
|
|||
<!doctype html>
|
||||
<html class="default no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Object | @vladmandic/human</title>
|
||||
<meta name="description" content="Documentation for @vladmandic/human">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="../assets/css/main.css">
|
||||
<script async src="../assets/js/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-index="../assets/js/search.json" data-base="..">
|
||||
<div class="field">
|
||||
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
|
||||
<input id="tsd-search-field" type="text" />
|
||||
</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</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</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="object.html">Object</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h1>Interface Object</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>Object results</p>
|
||||
</div>
|
||||
<p>Array of individual results with one object per detected gesture
|
||||
Each result has:</p>
|
||||
<ul>
|
||||
<li>score as value</li>
|
||||
<li>label as detected class name</li>
|
||||
<li>center as array of [x, y], normalized to image resolution</li>
|
||||
<li>centerRaw as array of [x, y], normalized to range 0..1</li>
|
||||
<li>box as array of [x, y, width, height], normalized to image resolution</li>
|
||||
<li>boxRaw as array of [x, y, width, height], normalized to range 0..1</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-hierarchy">
|
||||
<h3>Hierarchy</h3>
|
||||
<ul class="tsd-hierarchy">
|
||||
<li>
|
||||
<span class="target">Object</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="object.html#box" class="tsd-kind-icon">box</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="object.html#boxraw" class="tsd-kind-icon">box<wbr>Raw</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="object.html#center" class="tsd-kind-icon">center</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="object.html#centerraw" class="tsd-kind-icon">center<wbr>Raw</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="object.html#class" class="tsd-kind-icon">class</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="object.html#label" class="tsd-kind-icon">label</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="object.html#score" class="tsd-kind-icon">score</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="object.html#stridesize" class="tsd-kind-icon">stride<wbr>Size</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="box" class="tsd-anchor"></a>
|
||||
<h3>box</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">box<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="boxraw" class="tsd-anchor"></a>
|
||||
<h3>box<wbr>Raw</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">box<wbr>Raw<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="center" class="tsd-anchor"></a>
|
||||
<h3>center</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">center<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="centerraw" class="tsd-anchor"></a>
|
||||
<h3>center<wbr>Raw</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">center<wbr>Raw<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="class" class="tsd-anchor"></a>
|
||||
<h3>class</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">class<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="label" class="tsd-anchor"></a>
|
||||
<h3>label</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">label<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="score" class="tsd-anchor"></a>
|
||||
<h3>score</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">score<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="stridesize" class="tsd-anchor"></a>
|
||||
<h3>stride<wbr>Size</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">stride<wbr>Size<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</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 class="before-current">
|
||||
<li class=" tsd-kind-reference">
|
||||
<a href="../index.html#default" class="tsd-kind-icon">default</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-class">
|
||||
<a href="../classes/human.html" class="tsd-kind-icon">Human</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="body.html" class="tsd-kind-icon">Body</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="config.html" class="tsd-kind-icon">Config</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="drawoptions.html" class="tsd-kind-icon">Draw<wbr>Options</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="face.html" class="tsd-kind-icon">Face</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="hand.html" class="tsd-kind-icon">Hand</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="current">
|
||||
<li class="current tsd-kind-interface">
|
||||
<a href="object.html" class="tsd-kind-icon">Object</a>
|
||||
<ul>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="object.html#box" class="tsd-kind-icon">box</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="object.html#boxraw" class="tsd-kind-icon">box<wbr>Raw</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="object.html#center" class="tsd-kind-icon">center</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="object.html#centerraw" class="tsd-kind-icon">center<wbr>Raw</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="object.html#class" class="tsd-kind-icon">class</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="object.html#label" class="tsd-kind-icon">label</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="object.html#score" class="tsd-kind-icon">score</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="object.html#stridesize" class="tsd-kind-icon">stride<wbr>Size</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="after-current">
|
||||
<li class=" tsd-kind-interface">
|
||||
<a href="result.html" class="tsd-kind-icon">Result</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#error" class="tsd-kind-icon">Error</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#gesture" class="tsd-kind-icon">Gesture</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#input" class="tsd-kind-icon">Input</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#tensor" class="tsd-kind-icon">Tensor</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-type-alias">
|
||||
<a href="../index.html#tensorflow" class="tsd-kind-icon">Tensor<wbr>Flow</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<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>
|
||||
</div>
|
||||
</footer>
|
||||
<div class="overlay"></div>
|
||||
<script src="../assets/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,4 @@
|
|||
import type { Result, Face, Body, Hand, Object, Gesture } from '../result';
|
||||
/**
|
||||
* Draw Options
|
||||
* Accessed via `human.draw.options` or provided per each draw method as the drawOptions optional parameter
|
||||
|
@ -40,10 +41,10 @@ export interface DrawOptions {
|
|||
calculateHandBox: Boolean;
|
||||
}
|
||||
export declare const options: DrawOptions;
|
||||
export declare function gesture(inCanvas: HTMLCanvasElement, result: Array<any>, drawOptions?: DrawOptions): Promise<void>;
|
||||
export declare function face(inCanvas: HTMLCanvasElement, result: Array<any>, drawOptions?: DrawOptions): Promise<void>;
|
||||
export declare function body(inCanvas: HTMLCanvasElement, result: Array<any>, drawOptions?: DrawOptions): Promise<void>;
|
||||
export declare function hand(inCanvas: HTMLCanvasElement, result: Array<any>, drawOptions?: DrawOptions): Promise<void>;
|
||||
export declare function object(inCanvas: HTMLCanvasElement, result: Array<any>, drawOptions?: DrawOptions): Promise<void>;
|
||||
export declare function gesture(inCanvas: HTMLCanvasElement, result: Array<Gesture>, drawOptions?: DrawOptions): Promise<void>;
|
||||
export declare function face(inCanvas: HTMLCanvasElement, result: Array<Face>, drawOptions?: DrawOptions): Promise<void>;
|
||||
export declare function body(inCanvas: HTMLCanvasElement, result: Array<Body>, drawOptions?: DrawOptions): Promise<void>;
|
||||
export declare function hand(inCanvas: HTMLCanvasElement, result: Array<Hand>, drawOptions?: DrawOptions): Promise<void>;
|
||||
export declare function object(inCanvas: HTMLCanvasElement, result: Array<Object>, drawOptions?: DrawOptions): Promise<void>;
|
||||
export declare function canvas(inCanvas: HTMLCanvasElement, outCanvas: HTMLCanvasElement): Promise<void>;
|
||||
export declare function all(inCanvas: HTMLCanvasElement, result: any, drawOptions?: DrawOptions): Promise<void>;
|
||||
export declare function all(inCanvas: HTMLCanvasElement, result: Result, drawOptions?: DrawOptions): Promise<void>;
|
||||
|
|
|
@ -13,7 +13,7 @@ import * as draw from './draw/draw';
|
|||
/** Generic Tensor object type */
|
||||
export declare type Tensor = typeof tf.Tensor;
|
||||
export type { Config } from './config';
|
||||
export type { Result } from './result';
|
||||
export type { Result, Face, Hand, Body, Object, Gesture } from './result';
|
||||
export type { DrawOptions } from './draw/draw';
|
||||
/** Defines all possible input types for **Human** detection */
|
||||
export declare type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;
|
||||
|
|
|
@ -3,72 +3,77 @@
|
|||
*
|
||||
* Contains all possible detection results
|
||||
*/
|
||||
export interface Result {
|
||||
/** Face results
|
||||
* Combined results of face detector, face mesh, age, gender, emotion, embedding, iris models
|
||||
* Some values may be null if specific model is not enabled
|
||||
*
|
||||
* Array of individual results with one object per detected face
|
||||
* Each result has:
|
||||
* - overal detection confidence value
|
||||
* - box detection confidence value
|
||||
* - mesh detection confidence value
|
||||
* - box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw as array of [x, y, width, height], normalized to range 0..1
|
||||
* - mesh as array of [x, y, z] points of face mesh, normalized to image resolution
|
||||
* - meshRaw as array of [x, y, z] points of face mesh, normalized to range 0..1
|
||||
* - annotations as array of annotated face mesh points
|
||||
* - age as value
|
||||
* - gender as value
|
||||
* - genderConfidence as value
|
||||
* - emotion as array of possible emotions with their individual scores
|
||||
* - iris as distance value
|
||||
* - angle as object with values for roll, yaw and pitch angles
|
||||
* - tensor as Tensor object which contains detected face
|
||||
*/
|
||||
face: Array<{
|
||||
confidence: number;
|
||||
boxConfidence: number;
|
||||
faceConfidence: number;
|
||||
box: [number, number, number, number];
|
||||
boxRaw: [number, number, number, number];
|
||||
mesh: Array<[number, number, number]>;
|
||||
meshRaw: Array<[number, number, number]>;
|
||||
annotations: Array<{
|
||||
part: string;
|
||||
points: Array<[number, number, number]>[];
|
||||
}>;
|
||||
age: number;
|
||||
gender: string;
|
||||
genderConfidence: number;
|
||||
emotion: Array<{
|
||||
score: number;
|
||||
emotion: string;
|
||||
}>;
|
||||
embedding: Array<number>;
|
||||
iris: number;
|
||||
rotation: {
|
||||
angle: {
|
||||
roll: number;
|
||||
yaw: number;
|
||||
pitch: number;
|
||||
};
|
||||
matrix: Array<[number, number, number, number, number, number, number, number, number]>;
|
||||
};
|
||||
tensor: any;
|
||||
/** Face results
|
||||
* Combined results of face detector, face mesh, age, gender, emotion, embedding, iris models
|
||||
* Some values may be null if specific model is not enabled
|
||||
*
|
||||
* Array of individual results with one object per detected face
|
||||
* Each result has:
|
||||
* - overal detection confidence value
|
||||
* - box detection confidence value
|
||||
* - mesh detection confidence value
|
||||
* - box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw as array of [x, y, width, height], normalized to range 0..1
|
||||
* - mesh as array of [x, y, z] points of face mesh, normalized to image resolution
|
||||
* - meshRaw as array of [x, y, z] points of face mesh, normalized to range 0..1
|
||||
* - annotations as array of annotated face mesh points
|
||||
* - age as value
|
||||
* - gender as value
|
||||
* - genderConfidence as value
|
||||
* - emotion as array of possible emotions with their individual scores
|
||||
* - iris as distance value
|
||||
* - angle as object with values for roll, yaw and pitch angles
|
||||
* - tensor as Tensor object which contains detected face
|
||||
*/
|
||||
export interface Face {
|
||||
confidence: number;
|
||||
boxConfidence: number;
|
||||
faceConfidence: number;
|
||||
box: [number, number, number, number];
|
||||
boxRaw: [number, number, number, number];
|
||||
mesh: Array<[number, number, number]>;
|
||||
meshRaw: Array<[number, number, number]>;
|
||||
annotations: Array<{
|
||||
part: string;
|
||||
points: Array<[number, number, number]>[];
|
||||
}>;
|
||||
/** Body results
|
||||
*
|
||||
* Array of individual results with one object per detected body
|
||||
* Each results has:
|
||||
* - body id number
|
||||
* - body part name
|
||||
* - part position with x,y,z coordinates
|
||||
* - body part score value
|
||||
* - body part presence value
|
||||
*/
|
||||
body: Array<{
|
||||
id: number;
|
||||
age: number;
|
||||
gender: string;
|
||||
genderConfidence: number;
|
||||
emotion: Array<{
|
||||
score: number;
|
||||
emotion: string;
|
||||
}>;
|
||||
embedding: Array<number>;
|
||||
iris: number;
|
||||
rotation: {
|
||||
angle: {
|
||||
roll: number;
|
||||
yaw: number;
|
||||
pitch: number;
|
||||
};
|
||||
matrix: Array<[number, number, number, number, number, number, number, number, number]>;
|
||||
};
|
||||
tensor: any;
|
||||
}
|
||||
/** Body results
|
||||
*
|
||||
* Array of individual results with one object per detected body
|
||||
* Each results has:
|
||||
* - body id number
|
||||
* - score: overall detection score
|
||||
* - box bounding box: x, y, width, height
|
||||
* - keypoints: array of keypoints
|
||||
* - part: body part name
|
||||
* - position: body part position with x,y,z coordinates
|
||||
* - score: body part score value
|
||||
* - presence: body part presence value
|
||||
*/
|
||||
export interface Body {
|
||||
id: number;
|
||||
box: [x: number, y: number, width: number, height: number];
|
||||
score: number;
|
||||
keypoints: Array<{
|
||||
part: string;
|
||||
position: {
|
||||
x: number;
|
||||
|
@ -78,67 +83,79 @@ export interface Result {
|
|||
score: number;
|
||||
presence: number;
|
||||
}>;
|
||||
/** Hand results
|
||||
*
|
||||
* Array of individual results with one object per detected hand
|
||||
* Each result has:
|
||||
* - confidence as value
|
||||
* - box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw as array of [x, y, width, height], normalized to range 0..1
|
||||
* - landmarks as array of [x, y, z] points of hand, normalized to image resolution
|
||||
* - annotations as array of annotated face landmark points
|
||||
*/
|
||||
hand: Array<{
|
||||
confidence: number;
|
||||
box: [number, number, number, number];
|
||||
boxRaw: [number, number, number, number];
|
||||
landmarks: Array<[number, number, number]>;
|
||||
annotations: Array<{
|
||||
part: string;
|
||||
points: Array<[number, number, number]>[];
|
||||
}>;
|
||||
}>;
|
||||
/** Gesture results
|
||||
*
|
||||
* Array of individual results with one object per detected gesture
|
||||
* Each result has:
|
||||
* - part: part name and number where gesture was detected: face, iris, body, hand
|
||||
* - gesture: gesture detected
|
||||
*/
|
||||
gesture: Array<{
|
||||
'face': number;
|
||||
gesture: string;
|
||||
} | {
|
||||
'iris': number;
|
||||
gesture: string;
|
||||
} | {
|
||||
'body': number;
|
||||
gesture: string;
|
||||
} | {
|
||||
'hand': number;
|
||||
gesture: string;
|
||||
}>;
|
||||
/** Object results
|
||||
*
|
||||
* Array of individual results with one object per detected gesture
|
||||
* Each result has:
|
||||
* - score as value
|
||||
* - label as detected class name
|
||||
* - center as array of [x, y], normalized to image resolution
|
||||
* - centerRaw as array of [x, y], normalized to range 0..1
|
||||
* - box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw as array of [x, y, width, height], normalized to range 0..1
|
||||
*/
|
||||
object: Array<{
|
||||
score: number;
|
||||
strideSize: number;
|
||||
class: number;
|
||||
label: string;
|
||||
center: number[];
|
||||
centerRaw: number[];
|
||||
box: number[];
|
||||
boxRaw: number[];
|
||||
}
|
||||
/** Hand results
|
||||
*
|
||||
* Array of individual results with one object per detected hand
|
||||
* Each result has:
|
||||
* - confidence as value
|
||||
* - box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw as array of [x, y, width, height], normalized to range 0..1
|
||||
* - landmarks as array of [x, y, z] points of hand, normalized to image resolution
|
||||
* - annotations as array of annotated face landmark points
|
||||
*/
|
||||
export interface Hand {
|
||||
confidence: number;
|
||||
box: [number, number, number, number];
|
||||
boxRaw: [number, number, number, number];
|
||||
landmarks: Array<[number, number, number]>;
|
||||
annotations: Array<{
|
||||
part: string;
|
||||
points: Array<[number, number, number]>[];
|
||||
}>;
|
||||
}
|
||||
/** Object results
|
||||
*
|
||||
* Array of individual results with one object per detected gesture
|
||||
* Each result has:
|
||||
* - score as value
|
||||
* - label as detected class name
|
||||
* - center as array of [x, y], normalized to image resolution
|
||||
* - centerRaw as array of [x, y], normalized to range 0..1
|
||||
* - box as array of [x, y, width, height], normalized to image resolution
|
||||
* - boxRaw as array of [x, y, width, height], normalized to range 0..1
|
||||
*/
|
||||
export interface Object {
|
||||
score: number;
|
||||
strideSize: number;
|
||||
class: number;
|
||||
label: string;
|
||||
center: number[];
|
||||
centerRaw: number[];
|
||||
box: number[];
|
||||
boxRaw: number[];
|
||||
}
|
||||
/** Gesture results
|
||||
*
|
||||
* Array of individual results with one object per detected gesture
|
||||
* Each result has:
|
||||
* - part: part name and number where gesture was detected: face, iris, body, hand
|
||||
* - gesture: gesture detected
|
||||
*/
|
||||
export declare type Gesture = {
|
||||
'face': number;
|
||||
gesture: string;
|
||||
} | {
|
||||
'iris': number;
|
||||
gesture: string;
|
||||
} | {
|
||||
'body': number;
|
||||
gesture: string;
|
||||
} | {
|
||||
'hand': number;
|
||||
gesture: string;
|
||||
};
|
||||
export interface Result {
|
||||
/** {@link Face}: detection & analysis results */
|
||||
face: Array<Face>;
|
||||
/** {@link Body}: detection & analysis results */
|
||||
body: Array<Body>;
|
||||
/** {@link Hand}: detection & analysis results */
|
||||
hand: Array<Hand>;
|
||||
/** {@link Gesture}: detection & analysis results */
|
||||
gesture: Array<Gesture>;
|
||||
/** {@link Object}: detection & analysis results */
|
||||
object: Array<Object>;
|
||||
performance: {
|
||||
any: any;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue