mirror of https://github.com/vladmandic/human
rebuild all for release
parent
98e8e8646a
commit
a21f9b2a06
|
@ -1,6 +1,6 @@
|
||||||
# @vladmandic/human
|
# @vladmandic/human
|
||||||
|
|
||||||
Version: **1.9.1**
|
Version: **1.9.2**
|
||||||
Description: **Human: AI-powered 3D Face Detection & Rotation Tracking, Face Description & Recognition, Body Pose Tracking, 3D Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction, Gesture Recognition**
|
Description: **Human: AI-powered 3D Face Detection & Rotation Tracking, Face Description & Recognition, Body Pose Tracking, 3D Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction, Gesture Recognition**
|
||||||
|
|
||||||
Author: **Vladimir Mandic <mandic00@live.com>**
|
Author: **Vladimir Mandic <mandic00@live.com>**
|
||||||
|
@ -9,7 +9,12 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
### **HEAD -> main** 2021/05/21 mandic00@live.com
|
### **1.9.2** 2021/05/22 mandic00@live.com
|
||||||
|
|
||||||
|
- add id and boxraw on missing objects
|
||||||
|
- restructure results strong typing
|
||||||
|
|
||||||
|
### **origin/main** 2021/05/21 mandic00@live.com
|
||||||
|
|
||||||
|
|
||||||
### **1.9.1** 2021/05/21 mandic00@live.com
|
### **1.9.1** 2021/05/21 mandic00@live.com
|
||||||
|
|
2
TODO.md
2
TODO.md
|
@ -6,7 +6,7 @@ N/A
|
||||||
|
|
||||||
## Exploring Features
|
## Exploring Features
|
||||||
|
|
||||||
- Output interpolation for draw
|
- drawOptions.bufferedOutput: Output interpolation for draw
|
||||||
|
|
||||||
## Explore Models
|
## Explore Models
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ import webRTC from './helpers/webrtc.js';
|
||||||
let human;
|
let human;
|
||||||
|
|
||||||
const userConfig = {
|
const userConfig = {
|
||||||
warmup: 'full',
|
warmup: 'none',
|
||||||
/*
|
/*
|
||||||
backend: 'webgl',
|
backend: 'webgl',
|
||||||
async: false,
|
async: false,
|
||||||
|
@ -47,6 +47,7 @@ const ui = {
|
||||||
modelsPreload: true, // preload human models on startup
|
modelsPreload: true, // preload human models on startup
|
||||||
modelsWarmup: true, // warmup human models on startup
|
modelsWarmup: true, // warmup human models on startup
|
||||||
buffered: true, // should output be buffered between frames
|
buffered: true, // should output be buffered between frames
|
||||||
|
iconSize: '48px', // ui icon sizes
|
||||||
|
|
||||||
// internal variables
|
// internal variables
|
||||||
busy: false, // internal camera busy flag
|
busy: false, // internal camera busy flag
|
||||||
|
@ -222,11 +223,14 @@ async function drawResults(input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw all results
|
// draw all results
|
||||||
|
human.draw.all(canvas, result);
|
||||||
|
/* use individual functions
|
||||||
human.draw.face(canvas, result.face);
|
human.draw.face(canvas, result.face);
|
||||||
human.draw.body(canvas, result.body);
|
human.draw.body(canvas, result.body);
|
||||||
human.draw.hand(canvas, result.hand);
|
human.draw.hand(canvas, result.hand);
|
||||||
human.draw.object(canvas, result.object);
|
human.draw.object(canvas, result.object);
|
||||||
human.draw.gesture(canvas, result.gesture);
|
human.draw.gesture(canvas, result.gesture);
|
||||||
|
*/
|
||||||
await calcSimmilariry(result);
|
await calcSimmilariry(result);
|
||||||
|
|
||||||
// update log
|
// update log
|
||||||
|
@ -653,6 +657,8 @@ async function main() {
|
||||||
|
|
||||||
log('demo starting ...');
|
log('demo starting ...');
|
||||||
|
|
||||||
|
document.documentElement.style.setProperty('--icon-size', ui.iconSize);
|
||||||
|
|
||||||
// parse url search params
|
// parse url search params
|
||||||
const params = new URLSearchParams(location.search);
|
const params = new URLSearchParams(location.search);
|
||||||
log('url options:', params.toString());
|
log('url options:', params.toString());
|
||||||
|
|
|
@ -60,11 +60,13 @@ export const options: DrawOptions = {
|
||||||
fillPolygons: <Boolean>false,
|
fillPolygons: <Boolean>false,
|
||||||
useDepth: <Boolean>true,
|
useDepth: <Boolean>true,
|
||||||
useCurves: <Boolean>false,
|
useCurves: <Boolean>false,
|
||||||
bufferedOutput: <Boolean>true,
|
bufferedOutput: <Boolean>false, // not yet implemented
|
||||||
useRawBoxes: <Boolean>false,
|
useRawBoxes: <Boolean>false,
|
||||||
calculateHandBox: <Boolean>true,
|
calculateHandBox: <Boolean>true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let bufferedResult: Result;
|
||||||
|
|
||||||
function point(ctx, x, y, z = 0, localOptions) {
|
function point(ctx, x, y, z = 0, localOptions) {
|
||||||
ctx.fillStyle = localOptions.useDepth && z ? `rgba(${127.5 + (2 * z)}, ${127.5 - (2 * z)}, 255, 0.3)` : localOptions.color;
|
ctx.fillStyle = localOptions.useDepth && z ? `rgba(${127.5 + (2 * z)}, ${127.5 - (2 * z)}, 255, 0.3)` : localOptions.color;
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
|
@ -241,7 +243,6 @@ export async function face(inCanvas: HTMLCanvasElement, result: Array<Face>, dra
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastDrawnPose:any[] = [];
|
|
||||||
export async function body(inCanvas: HTMLCanvasElement, result: Array<Body>, drawOptions?: DrawOptions) {
|
export async function body(inCanvas: HTMLCanvasElement, result: Array<Body>, drawOptions?: DrawOptions) {
|
||||||
const localOptions = mergeDeep(options, drawOptions);
|
const localOptions = mergeDeep(options, drawOptions);
|
||||||
if (!result || !inCanvas) return;
|
if (!result || !inCanvas) return;
|
||||||
|
@ -250,7 +251,6 @@ export async function body(inCanvas: HTMLCanvasElement, result: Array<Body>, dra
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
ctx.lineJoin = 'round';
|
ctx.lineJoin = 'round';
|
||||||
for (let i = 0; i < result.length; i++) {
|
for (let i = 0; i < result.length; i++) {
|
||||||
if (!lastDrawnPose[i] && localOptions.bufferedOutput) lastDrawnPose[i] = { ...result[i] };
|
|
||||||
ctx.strokeStyle = localOptions.color;
|
ctx.strokeStyle = localOptions.color;
|
||||||
ctx.fillStyle = localOptions.color;
|
ctx.fillStyle = localOptions.color;
|
||||||
ctx.lineWidth = localOptions.lineWidth;
|
ctx.lineWidth = localOptions.lineWidth;
|
||||||
|
@ -272,13 +272,7 @@ export async function body(inCanvas: HTMLCanvasElement, result: Array<Body>, dra
|
||||||
if (localOptions.drawPoints) {
|
if (localOptions.drawPoints) {
|
||||||
for (let pt = 0; pt < result[i].keypoints.length; pt++) {
|
for (let pt = 0; pt < result[i].keypoints.length; pt++) {
|
||||||
ctx.fillStyle = localOptions.useDepth && result[i].keypoints[pt].position.z ? `rgba(${127.5 + (2 * result[i].keypoints[pt].position.z)}, ${127.5 - (2 * result[i].keypoints[pt].position.z)}, 255, 0.5)` : localOptions.color;
|
ctx.fillStyle = localOptions.useDepth && result[i].keypoints[pt].position.z ? `rgba(${127.5 + (2 * result[i].keypoints[pt].position.z)}, ${127.5 - (2 * result[i].keypoints[pt].position.z)}, 255, 0.5)` : localOptions.color;
|
||||||
if (localOptions.bufferedOutput) {
|
point(ctx, result[i].keypoints[pt].position.x, result[i].keypoints[pt].position.y, 0, localOptions);
|
||||||
lastDrawnPose[i].keypoints[pt][0] = (lastDrawnPose[i].keypoints[pt][0] + result[i].keypoints[pt].position.x) / 2;
|
|
||||||
lastDrawnPose[i].keypoints[pt][1] = (lastDrawnPose[i].keypoints[pt][1] + result[i].keypoints[pt].position.y) / 2;
|
|
||||||
point(ctx, lastDrawnPose[i].keypoints[pt][0], lastDrawnPose[i].keypoints[pt][1], 0, localOptions);
|
|
||||||
} else {
|
|
||||||
point(ctx, result[i].keypoints[pt].position.x, result[i].keypoints[pt].position.y, 0, localOptions);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (localOptions.drawLabels) {
|
if (localOptions.drawLabels) {
|
||||||
|
@ -486,9 +480,14 @@ export async function all(inCanvas: HTMLCanvasElement, result: Result, drawOptio
|
||||||
const localOptions = mergeDeep(options, drawOptions);
|
const localOptions = mergeDeep(options, drawOptions);
|
||||||
if (!result || !inCanvas) return;
|
if (!result || !inCanvas) return;
|
||||||
if (!(inCanvas instanceof HTMLCanvasElement)) return;
|
if (!(inCanvas instanceof HTMLCanvasElement)) return;
|
||||||
face(inCanvas, result.face, localOptions);
|
if (localOptions.bufferedOutput) {
|
||||||
body(inCanvas, result.body, localOptions);
|
if (result.timestamp !== bufferedResult?.timestamp) bufferedResult = result;
|
||||||
hand(inCanvas, result.hand, localOptions);
|
} else {
|
||||||
gesture(inCanvas, result.gesture, localOptions);
|
bufferedResult = result;
|
||||||
object(inCanvas, result.object, localOptions);
|
}
|
||||||
|
face(inCanvas, bufferedResult.face, localOptions);
|
||||||
|
body(inCanvas, bufferedResult.body, localOptions);
|
||||||
|
hand(inCanvas, bufferedResult.hand, localOptions);
|
||||||
|
gesture(inCanvas, bufferedResult.gesture, localOptions);
|
||||||
|
object(inCanvas, bufferedResult.object, localOptions);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ export interface Body {
|
||||||
part: string,
|
part: string,
|
||||||
position: { x: number, y: number, z: number },
|
position: { x: number, y: number, z: number },
|
||||||
score: number,
|
score: number,
|
||||||
presence: number,
|
presence?: number,
|
||||||
}>
|
}>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
||||||
Subproject commit fa896c5330432f26839d362b81ea9128db60d86b
|
Subproject commit d3e31ec79f0f7f9b3382576dd246cd86de22bb43
|
Loading…
Reference in New Issue