mirror of https://github.com/vladmandic/human
rebuild all for release
parent
98e8e8646a
commit
a21f9b2a06
|
@ -1,6 +1,6 @@
|
|||
# @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**
|
||||
|
||||
Author: **Vladimir Mandic <mandic00@live.com>**
|
||||
|
@ -9,7 +9,12 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
|||
|
||||
## 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
|
||||
|
|
2
TODO.md
2
TODO.md
|
@ -6,7 +6,7 @@ N/A
|
|||
|
||||
## Exploring Features
|
||||
|
||||
- Output interpolation for draw
|
||||
- drawOptions.bufferedOutput: Output interpolation for draw
|
||||
|
||||
## 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;
|
||||
|
||||
const userConfig = {
|
||||
warmup: 'full',
|
||||
warmup: 'none',
|
||||
/*
|
||||
backend: 'webgl',
|
||||
async: false,
|
||||
|
@ -47,6 +47,7 @@ const ui = {
|
|||
modelsPreload: true, // preload human models on startup
|
||||
modelsWarmup: true, // warmup human models on startup
|
||||
buffered: true, // should output be buffered between frames
|
||||
iconSize: '48px', // ui icon sizes
|
||||
|
||||
// internal variables
|
||||
busy: false, // internal camera busy flag
|
||||
|
@ -222,11 +223,14 @@ async function drawResults(input) {
|
|||
}
|
||||
|
||||
// draw all results
|
||||
human.draw.all(canvas, result);
|
||||
/* use individual functions
|
||||
human.draw.face(canvas, result.face);
|
||||
human.draw.body(canvas, result.body);
|
||||
human.draw.hand(canvas, result.hand);
|
||||
human.draw.object(canvas, result.object);
|
||||
human.draw.gesture(canvas, result.gesture);
|
||||
*/
|
||||
await calcSimmilariry(result);
|
||||
|
||||
// update log
|
||||
|
@ -653,6 +657,8 @@ async function main() {
|
|||
|
||||
log('demo starting ...');
|
||||
|
||||
document.documentElement.style.setProperty('--icon-size', ui.iconSize);
|
||||
|
||||
// parse url search params
|
||||
const params = new URLSearchParams(location.search);
|
||||
log('url options:', params.toString());
|
||||
|
|
|
@ -60,11 +60,13 @@ export const options: DrawOptions = {
|
|||
fillPolygons: <Boolean>false,
|
||||
useDepth: <Boolean>true,
|
||||
useCurves: <Boolean>false,
|
||||
bufferedOutput: <Boolean>true,
|
||||
bufferedOutput: <Boolean>false, // not yet implemented
|
||||
useRawBoxes: <Boolean>false,
|
||||
calculateHandBox: <Boolean>true,
|
||||
};
|
||||
|
||||
let bufferedResult: Result;
|
||||
|
||||
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.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) {
|
||||
const localOptions = mergeDeep(options, drawOptions);
|
||||
if (!result || !inCanvas) return;
|
||||
|
@ -250,7 +251,6 @@ export async function body(inCanvas: HTMLCanvasElement, result: Array<Body>, dra
|
|||
if (!ctx) return;
|
||||
ctx.lineJoin = 'round';
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
if (!lastDrawnPose[i] && localOptions.bufferedOutput) lastDrawnPose[i] = { ...result[i] };
|
||||
ctx.strokeStyle = localOptions.color;
|
||||
ctx.fillStyle = localOptions.color;
|
||||
ctx.lineWidth = localOptions.lineWidth;
|
||||
|
@ -272,15 +272,9 @@ export async function body(inCanvas: HTMLCanvasElement, result: Array<Body>, dra
|
|||
if (localOptions.drawPoints) {
|
||||
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;
|
||||
if (localOptions.bufferedOutput) {
|
||||
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) {
|
||||
ctx.font = localOptions.font;
|
||||
if (result[i].keypoints) {
|
||||
|
@ -486,9 +480,14 @@ export async function all(inCanvas: HTMLCanvasElement, result: Result, drawOptio
|
|||
const localOptions = mergeDeep(options, drawOptions);
|
||||
if (!result || !inCanvas) return;
|
||||
if (!(inCanvas instanceof HTMLCanvasElement)) return;
|
||||
face(inCanvas, result.face, localOptions);
|
||||
body(inCanvas, result.body, localOptions);
|
||||
hand(inCanvas, result.hand, localOptions);
|
||||
gesture(inCanvas, result.gesture, localOptions);
|
||||
object(inCanvas, result.object, localOptions);
|
||||
if (localOptions.bufferedOutput) {
|
||||
if (result.timestamp !== bufferedResult?.timestamp) bufferedResult = result;
|
||||
} else {
|
||||
bufferedResult = result;
|
||||
}
|
||||
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,
|
||||
position: { x: number, y: number, z: number },
|
||||
score: number,
|
||||
presence: number,
|
||||
presence?: number,
|
||||
}>
|
||||
}
|
||||
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit fa896c5330432f26839d362b81ea9128db60d86b
|
||||
Subproject commit d3e31ec79f0f7f9b3382576dd246cd86de22bb43
|
Loading…
Reference in New Issue