mirror of https://github.com/vladmandic/human
add human.video method
parent
ed5f093ff8
commit
f098b5659c
|
@ -9,7 +9,7 @@
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2022/09/13 mandic00@live.com
|
||||
### **HEAD -> main** 2022/09/14 mandic00@live.com
|
||||
|
||||
|
||||
### **2.10.2** 2022/09/11 mandic00@live.com
|
||||
|
|
20
README.md
20
README.md
|
@ -64,6 +64,7 @@ JavaScript module using TensorFlow/JS Machine Learning library
|
|||
|
||||
- **Full** [[*Live*]](https://vladmandic.github.io/human/demo/index.html) [[*Details*]](https://github.com/vladmandic/human/tree/main/demo): Main browser demo app that showcases all Human capabilities
|
||||
- **Simple** [[*Live*]](https://vladmandic.github.io/human/demo/typescript/index.html) [[*Details*]](https://github.com/vladmandic/human/tree/main/demo/typescript): Simple demo in WebCam processing demo in TypeScript
|
||||
- **Embedded** [[*Live*]](https://vladmandic.github.io/human/demo/video/index.html) [[*Details*]](https://github.com/vladmandic/human/tree/main/video/index.html): Even simpler demo with tiny code embedded in HTML file
|
||||
- **Face Match** [[*Live*]](https://vladmandic.github.io/human/demo/facematch/index.html) [[*Details*]](https://github.com/vladmandic/human/tree/main/demo/facematch): Extract faces from images, calculates face descriptors and simmilarities and matches them to known database
|
||||
- **Face ID** [[*Live*]](https://vladmandic.github.io/human/demo/faceid/index.html) [[*Details*]](https://github.com/vladmandic/human/tree/main/demo/faceid): Runs multiple checks to validate webcam input before performing face match to faces in IndexDB
|
||||
- **Multi-thread** [[*Live*]](https://vladmandic.github.io/human/demo/multithread/index.html) [[*Details*]](https://github.com/vladmandic/human/tree/main/demo/multithread): Runs each Human module in a separate web worker for highest possible performance
|
||||
|
@ -321,7 +322,7 @@ async function detectVideo() {
|
|||
|
||||
async function drawVideo() {
|
||||
if (result) { // check if result is available
|
||||
const interpolated = human.next(result); // calculate next interpolated frame
|
||||
const interpolated = human.next(result); // get smoothened result using last-known results
|
||||
human.draw.all(outputCanvas, interpolated); // draw the frame
|
||||
}
|
||||
requestAnimationFrame(drawVideo); // run draw loop
|
||||
|
@ -331,6 +332,23 @@ detectVideo(); // start detection loop
|
|||
drawVideo(); // start draw loop
|
||||
```
|
||||
|
||||
or same, but using built-in full video processing instead of running manual frame-by-frame loop:
|
||||
|
||||
```js
|
||||
const human = new Human(); // create instance of Human
|
||||
const inputVideo = document.getElementById('video-id');
|
||||
const outputCanvas = document.getElementById('canvas-id');
|
||||
|
||||
async function drawResults() {
|
||||
const interpolated = human.next(); // get smoothened result using last-known results
|
||||
human.draw.all(outputCanvas, interpolated); // draw the frame
|
||||
requestAnimationFrame(drawVideo); // run draw loop
|
||||
}
|
||||
|
||||
human.video(inputVideo); // start detection loop which continously updates results
|
||||
drawResults(); // start draw loop
|
||||
```
|
||||
|
||||
And for even better results, you can run detection in a separate web worker thread
|
||||
|
||||
<br><hr><br>
|
||||
|
|
3
TODO.md
3
TODO.md
|
@ -43,5 +43,8 @@ Enable via `about:config` -> `gfx.offscreencanvas.enabled`
|
|||
|
||||
## Pending Release Changes
|
||||
|
||||
- New API [`human.video()`](https://vladmandic.github.io/human/typedoc/classes/Human.html#video)
|
||||
Runs continous detection of an input video instead of processing each frame manually
|
||||
- New simple demo [*Live*](https://vladmandic.github.io/human/demo/video/index.html)
|
||||
- Enable model cache when using web workers
|
||||
- Improve NodeJS resolver when using ESM
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Human</title>
|
||||
<meta name="viewport" content="width=device-width" id="viewport">
|
||||
<meta name="keywords" content="Human">
|
||||
<meta name="description" content="Human: 3D Face Detection, Body Pose, Hand & Finger Tracking, Iris Tracking, Age & Gender Prediction, Emotion Prediction & Gesture Recognition; Author: Vladimir Mandic <https://github.com/vladmandic>">
|
||||
<link rel="manifest" href="../manifest.webmanifest">
|
||||
<link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon">
|
||||
<style>
|
||||
@font-face { font-family: 'Lato'; font-display: swap; font-style: normal; font-weight: 100; src: local('Lato'), url('../../assets/lato-light.woff2') }
|
||||
body { font-family: 'Lato', 'Segoe UI'; font-size: 16px; font-variant: small-caps; margin: 0; background: black; color: white; overflow: hidden; width: 100vw; height: 100vh; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" style="margin: 0 auto; width: 100%"></canvas>
|
||||
<video id="video" playsinline style="display: none"></video>
|
||||
<pre id="log" style="padding: 8px"></pre>
|
||||
<script type="module">
|
||||
import * as H from '../../dist/human.esm.js'; // equivalent of import @vladmandic/Human
|
||||
|
||||
const humanConfig = { // user configuration for human, used to fine-tune behavior
|
||||
modelBasePath: '../../models',
|
||||
filter: { enabled: true, equalization: false, flip: false },
|
||||
face: { enabled: true, detector: { rotation: false }, mesh: { enabled: true }, attention: { enabled: false }, iris: { enabled: true }, description: { enabled: true }, emotion: { enabled: true } },
|
||||
body: { enabled: true },
|
||||
hand: { enabled: true },
|
||||
object: { enabled: false },
|
||||
gesture: { enabled: true },
|
||||
};
|
||||
const human = new H.Human(humanConfig); // create instance of human with overrides from user configuration
|
||||
const video = document.getElementById('video');
|
||||
const canvas = document.getElementById('canvas');
|
||||
|
||||
async function webCam() { // initialize webcam
|
||||
const options = { audio: false, video: { facingMode: 'user', resizeMode: 'none', width: { ideal: document.body.clientWidth }, height: { ideal: document.body.clientHeight } } }; // set ideal webcam video properties
|
||||
const stream = await navigator.mediaDevices.getUserMedia(options); // find webcam stream that best matches what we want
|
||||
const videoReady = new Promise((resolve) => { video.onloadeddata = () => resolve(true); });
|
||||
video.srcObject = stream; // assign webcam stream to a video element
|
||||
video.play(); // start webcam
|
||||
await videoReady; // wait for video ready
|
||||
canvas.width = video.videoWidth; // set canvas resolution to input webcam native resolution
|
||||
canvas.height = video.videoHeight;
|
||||
canvas.onclick = () => { // pause when clicked on screen and resume on next click
|
||||
if (video.paused) void video.play();
|
||||
else video.pause();
|
||||
};
|
||||
}
|
||||
|
||||
async function drawLoop() { // main screen refresh loop
|
||||
human.draw.canvas(video, canvas); // draw original video to screen canvas // better than using procesed image as this loop happens faster than processing loop
|
||||
const interpolated = human.next(); // get smoothened result using last-known results
|
||||
await human.draw.all(canvas, interpolated); // draw labels, boxes, lines, etc.
|
||||
setTimeout(drawLoop, 30); // use to slow down refresh from max refresh rate to target of 30 fps
|
||||
}
|
||||
|
||||
async function main() { // main entry point
|
||||
document.getElementById('log').innerHTML = `human version: ${human.version} | tfjs version: ${human.tf.version['tfjs-core']}<br>platform: ${human.env.platform} | agent ${human.env.agent}<br>`;
|
||||
await webCam(); // start webcam
|
||||
human.video(video); // instruct human to detect video frames
|
||||
await drawLoop(); // start draw loop
|
||||
}
|
||||
|
||||
window.onload = main;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1367,6 +1367,16 @@ declare class Human {
|
|||
* @returns result - {@link Result}
|
||||
*/
|
||||
detect(input: Input, userConfig?: Partial<Config>): Promise<Result>;
|
||||
/** Helper function
|
||||
* @param ms - sleep time in miliseconds
|
||||
*/
|
||||
sleep(ms: number): Promise<void>;
|
||||
/** Continously detect video frames
|
||||
* @param element - HTMLVideoElement input
|
||||
* @param run - boolean run continously or stop if already running, default true
|
||||
* @param delay - number delay detection between frames for number of miliseconds, default 0
|
||||
*/
|
||||
video(element: HTMLVideoElement, run?: boolean, delay?: number): Promise<void>;
|
||||
}
|
||||
export { Human }
|
||||
export default Human;
|
||||
|
|
|
@ -1367,6 +1367,16 @@ declare class Human {
|
|||
* @returns result - {@link Result}
|
||||
*/
|
||||
detect(input: Input, userConfig?: Partial<Config>): Promise<Result>;
|
||||
/** Helper function
|
||||
* @param ms - sleep time in miliseconds
|
||||
*/
|
||||
sleep(ms: number): Promise<void>;
|
||||
/** Continously detect video frames
|
||||
* @param element - HTMLVideoElement input
|
||||
* @param run - boolean run continously or stop if already running, default true
|
||||
* @param delay - number delay detection between frames for number of miliseconds, default 0
|
||||
*/
|
||||
video(element: HTMLVideoElement, run?: boolean, delay?: number): Promise<void>;
|
||||
}
|
||||
export { Human }
|
||||
export default Human;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1367,6 +1367,16 @@ declare class Human {
|
|||
* @returns result - {@link Result}
|
||||
*/
|
||||
detect(input: Input, userConfig?: Partial<Config>): Promise<Result>;
|
||||
/** Helper function
|
||||
* @param ms - sleep time in miliseconds
|
||||
*/
|
||||
sleep(ms: number): Promise<void>;
|
||||
/** Continously detect video frames
|
||||
* @param element - HTMLVideoElement input
|
||||
* @param run - boolean run continously or stop if already running, default true
|
||||
* @param delay - number delay detection between frames for number of miliseconds, default 0
|
||||
*/
|
||||
video(element: HTMLVideoElement, run?: boolean, delay?: number): Promise<void>;
|
||||
}
|
||||
export { Human }
|
||||
export default Human;
|
||||
|
|
|
@ -87363,7 +87363,7 @@ async function warmup(instance2, userConfig) {
|
|||
}
|
||||
|
||||
// src/human.ts
|
||||
var _numTensors, _analyzeMemoryLeaks, _checkSanity, _sanity;
|
||||
var _numTensors, _analyzeMemoryLeaks, _checkSanity, _sanity, _loops;
|
||||
var Human2 = class {
|
||||
constructor(userConfig) {
|
||||
__publicField(this, "version");
|
||||
|
@ -87415,6 +87415,7 @@ var Human2 = class {
|
|||
if ((_a = this.events) == null ? void 0 : _a.dispatchEvent)
|
||||
this.events.dispatchEvent(new Event(event));
|
||||
});
|
||||
__privateAdd(this, _loops, {});
|
||||
this.env = env2;
|
||||
const tfVersion = (V.tfjs || version).replace(/-(.*)/, "");
|
||||
config.wasmPath = `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${tfVersion}/dist/`;
|
||||
|
@ -87721,11 +87722,36 @@ var Human2 = class {
|
|||
resolve(this.result);
|
||||
});
|
||||
}
|
||||
async sleep(ms) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
async video(element, run = true, delay = 0) {
|
||||
if (run) {
|
||||
if (!__privateGet(this, _loops)[element.id]) {
|
||||
if (this.config.debug)
|
||||
log("video start", element.id);
|
||||
__privateGet(this, _loops)[element.id] = true;
|
||||
}
|
||||
if (!element.paused && __privateGet(this, _loops)[element.id] && element.readyState >= 2)
|
||||
await this.detect(element);
|
||||
if (delay > 0)
|
||||
await this.sleep(delay);
|
||||
if (__privateGet(this, _loops)[element.id])
|
||||
requestAnimationFrame(() => this.video(element, run, delay));
|
||||
} else {
|
||||
if (this.config.debug)
|
||||
log("video stop", element.id);
|
||||
__privateGet(this, _loops)[element.id] = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
_numTensors = new WeakMap();
|
||||
_analyzeMemoryLeaks = new WeakMap();
|
||||
_checkSanity = new WeakMap();
|
||||
_sanity = new WeakMap();
|
||||
_loops = new WeakMap();
|
||||
export {
|
||||
Human2 as Human,
|
||||
Human2 as default,
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1367,6 +1367,16 @@ declare class Human {
|
|||
* @returns result - {@link Result}
|
||||
*/
|
||||
detect(input: Input, userConfig?: Partial<Config>): Promise<Result>;
|
||||
/** Helper function
|
||||
* @param ms - sleep time in miliseconds
|
||||
*/
|
||||
sleep(ms: number): Promise<void>;
|
||||
/** Continously detect video frames
|
||||
* @param element - HTMLVideoElement input
|
||||
* @param run - boolean run continously or stop if already running, default true
|
||||
* @param delay - number delay detection between frames for number of miliseconds, default 0
|
||||
*/
|
||||
video(element: HTMLVideoElement, run?: boolean, delay?: number): Promise<void>;
|
||||
}
|
||||
export { Human }
|
||||
export default Human;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1367,6 +1367,16 @@ declare class Human {
|
|||
* @returns result - {@link Result}
|
||||
*/
|
||||
detect(input: Input, userConfig?: Partial<Config>): Promise<Result>;
|
||||
/** Helper function
|
||||
* @param ms - sleep time in miliseconds
|
||||
*/
|
||||
sleep(ms: number): Promise<void>;
|
||||
/** Continously detect video frames
|
||||
* @param element - HTMLVideoElement input
|
||||
* @param run - boolean run continously or stop if already running, default true
|
||||
* @param delay - number delay detection between frames for number of miliseconds, default 0
|
||||
*/
|
||||
video(element: HTMLVideoElement, run?: boolean, delay?: number): Promise<void>;
|
||||
}
|
||||
export { Human }
|
||||
export default Human;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1367,6 +1367,16 @@ declare class Human {
|
|||
* @returns result - {@link Result}
|
||||
*/
|
||||
detect(input: Input, userConfig?: Partial<Config>): Promise<Result>;
|
||||
/** Helper function
|
||||
* @param ms - sleep time in miliseconds
|
||||
*/
|
||||
sleep(ms: number): Promise<void>;
|
||||
/** Continously detect video frames
|
||||
* @param element - HTMLVideoElement input
|
||||
* @param run - boolean run continously or stop if already running, default true
|
||||
* @param delay - number delay detection between frames for number of miliseconds, default 0
|
||||
*/
|
||||
video(element: HTMLVideoElement, run?: boolean, delay?: number): Promise<void>;
|
||||
}
|
||||
export { Human }
|
||||
export default Human;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -66,9 +66,9 @@
|
|||
"tensorflow"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@html-eslint/eslint-plugin": "^0.13.2",
|
||||
"@html-eslint/parser": "^0.13.2",
|
||||
"@microsoft/api-extractor": "^7.31.0",
|
||||
"@html-eslint/eslint-plugin": "^0.14.1",
|
||||
"@html-eslint/parser": "^0.14.0",
|
||||
"@microsoft/api-extractor": "^7.31.1",
|
||||
"@tensorflow/tfjs": "^3.20.0",
|
||||
"@tensorflow/tfjs-backend-cpu": "^3.20.0",
|
||||
"@tensorflow/tfjs-backend-wasm": "^3.20.0",
|
||||
|
|
29
src/human.ts
29
src/human.ts
|
@ -551,6 +551,35 @@ export class Human {
|
|||
resolve(this.result);
|
||||
});
|
||||
}
|
||||
|
||||
/** Helper function
|
||||
* @param ms - sleep time in miliseconds
|
||||
*/
|
||||
async sleep(ms: number): Promise<void> { // eslint-disable-line class-methods-use-this
|
||||
return new Promise((resolve) => { setTimeout(resolve, ms); });
|
||||
}
|
||||
|
||||
/** internal structure that keeps track of processed videos @hidden */
|
||||
#loops: Record<string, boolean> = {};
|
||||
/** Continously detect video frames
|
||||
* @param element - HTMLVideoElement input
|
||||
* @param run - boolean run continously or stop if already running, default true
|
||||
* @param delay - number delay detection between frames for number of miliseconds, default 0
|
||||
*/
|
||||
async video(element: HTMLVideoElement, run: boolean = true, delay: number = 0) {
|
||||
if (run) {
|
||||
if (!this.#loops[element.id]) {
|
||||
if (this.config.debug) log('video start', element.id);
|
||||
this.#loops[element.id] = true;
|
||||
}
|
||||
if (!element.paused && this.#loops[element.id] && (element.readyState >= 2)) await this.detect(element);
|
||||
if (delay > 0) await this.sleep(delay);
|
||||
if (this.#loops[element.id]) requestAnimationFrame(() => this.video(element, run, delay));
|
||||
} else {
|
||||
if (this.config.debug) log('video stop', element.id);
|
||||
this.#loops[element.id] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Class Human as default export */
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
2022-09-14 11:37:14 [32mDATA: [39m Build {"name":"@vladmandic/human","version":"2.10.2"}
|
||||
2022-09-14 11:37:14 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"2.10.2"}
|
||||
2022-09-14 11:37:14 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2022-09-14 11:37:14 [36mINFO: [39m Toolchain: {"build":"0.7.12","esbuild":"0.15.7","typescript":"4.8.3","typedoc":"0.23.14","eslint":"8.23.1"}
|
||||
2022-09-14 11:37:14 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":159,"outputBytes":608}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":657017,"outputBytes":308794}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":167,"outputBytes":612}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":657021,"outputBytes":308798}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":206,"outputBytes":664}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":657073,"outputBytes":308848}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1125,"outputBytes":358}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1088,"outputBytes":583}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":656992,"outputBytes":307668}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1344,"outputBytes":2821914}
|
||||
2022-09-14 11:37:14 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3478323,"outputBytes":1687855}
|
||||
2022-09-14 11:37:15 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3478323,"outputBytes":3109019}
|
||||
2022-09-14 11:37:19 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types/lib","files":15}
|
||||
2022-09-14 11:37:21 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
|
||||
2022-09-14 11:37:21 [35mSTATE:[39m Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6714,"outputBytes":3134}
|
||||
2022-09-14 11:37:21 [35mSTATE:[39m Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15488,"outputBytes":7788}
|
||||
2022-09-14 11:37:32 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":110,"errors":0,"warnings":0}
|
||||
2022-09-14 11:37:32 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2022-09-14 11:37:32 [35mSTATE:[39m Copy: {"input":"tfjs/tfjs.esm.d.ts"}
|
||||
2022-09-14 11:37:32 [36mINFO: [39m Done...
|
||||
2022-09-14 11:37:33 [35mSTATE:[39m API-Extractor: {"succeeeded":true,"errors":0,"warnings":193}
|
||||
2022-09-14 11:37:33 [35mSTATE:[39m Copy: {"input":"types/human.d.ts"}
|
||||
2022-09-14 11:37:33 [36mINFO: [39m Analyze models: {"folders":8,"result":"models/models.json"}
|
||||
2022-09-14 11:37:33 [35mSTATE:[39m Models {"folder":"./models","models":13}
|
||||
2022-09-14 11:37:33 [35mSTATE:[39m Models {"folder":"../human-models/models","models":42}
|
||||
2022-09-14 11:37:33 [35mSTATE:[39m Models {"folder":"../blazepose/model/","models":4}
|
||||
2022-09-14 11:37:33 [35mSTATE:[39m Models {"folder":"../anti-spoofing/model","models":1}
|
||||
2022-09-14 11:37:33 [35mSTATE:[39m Models {"folder":"../efficientpose/models","models":3}
|
||||
2022-09-14 11:37:33 [35mSTATE:[39m Models {"folder":"../insightface/models","models":5}
|
||||
2022-09-14 11:37:33 [35mSTATE:[39m Models {"folder":"../movenet/models","models":3}
|
||||
2022-09-14 11:37:33 [35mSTATE:[39m Models {"folder":"../nanodet/models","models":4}
|
||||
2022-09-14 11:37:34 [35mSTATE:[39m Models: {"count":57,"totalSize":383017442}
|
||||
2022-09-14 11:37:34 [36mINFO: [39m Human Build complete... {"logFile":"test/build.log"}
|
||||
2022-09-17 17:17:01 [32mDATA: [39m Build {"name":"@vladmandic/human","version":"2.10.2"}
|
||||
2022-09-17 17:17:01 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"2.10.2"}
|
||||
2022-09-17 17:17:01 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2022-09-17 17:17:01 [36mINFO: [39m Toolchain: {"build":"0.7.12","esbuild":"0.15.7","typescript":"4.8.3","typedoc":"0.23.14","eslint":"8.23.1"}
|
||||
2022-09-17 17:17:01 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2022-09-17 17:17:01 [35mSTATE:[39m Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
|
||||
2022-09-17 17:17:01 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":159,"outputBytes":608}
|
||||
2022-09-17 17:17:01 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":658253,"outputBytes":309214}
|
||||
2022-09-17 17:17:01 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":167,"outputBytes":612}
|
||||
2022-09-17 17:17:01 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":658257,"outputBytes":309218}
|
||||
2022-09-17 17:17:01 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":206,"outputBytes":664}
|
||||
2022-09-17 17:17:01 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":658309,"outputBytes":309268}
|
||||
2022-09-17 17:17:01 [35mSTATE:[39m Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1125,"outputBytes":358}
|
||||
2022-09-17 17:17:01 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1088,"outputBytes":583}
|
||||
2022-09-17 17:17:01 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":658228,"outputBytes":308088}
|
||||
2022-09-17 17:17:02 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1344,"outputBytes":2821914}
|
||||
2022-09-17 17:17:02 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3479559,"outputBytes":1688279}
|
||||
2022-09-17 17:17:02 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3479559,"outputBytes":3109891}
|
||||
2022-09-17 17:17:06 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types/lib","files":15}
|
||||
2022-09-17 17:17:09 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
|
||||
2022-09-17 17:17:09 [35mSTATE:[39m Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6714,"outputBytes":3134}
|
||||
2022-09-17 17:17:09 [35mSTATE:[39m Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15488,"outputBytes":7788}
|
||||
2022-09-17 17:17:20 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":110,"errors":0,"warnings":0}
|
||||
2022-09-17 17:17:20 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2022-09-17 17:17:20 [35mSTATE:[39m Copy: {"input":"tfjs/tfjs.esm.d.ts"}
|
||||
2022-09-17 17:17:20 [36mINFO: [39m Done...
|
||||
2022-09-17 17:17:21 [35mSTATE:[39m API-Extractor: {"succeeeded":true,"errors":0,"warnings":193}
|
||||
2022-09-17 17:17:21 [35mSTATE:[39m Copy: {"input":"types/human.d.ts"}
|
||||
2022-09-17 17:17:21 [36mINFO: [39m Analyze models: {"folders":8,"result":"models/models.json"}
|
||||
2022-09-17 17:17:21 [35mSTATE:[39m Models {"folder":"./models","models":13}
|
||||
2022-09-17 17:17:21 [35mSTATE:[39m Models {"folder":"../human-models/models","models":42}
|
||||
2022-09-17 17:17:21 [35mSTATE:[39m Models {"folder":"../blazepose/model/","models":4}
|
||||
2022-09-17 17:17:21 [35mSTATE:[39m Models {"folder":"../anti-spoofing/model","models":1}
|
||||
2022-09-17 17:17:21 [35mSTATE:[39m Models {"folder":"../efficientpose/models","models":3}
|
||||
2022-09-17 17:17:21 [35mSTATE:[39m Models {"folder":"../insightface/models","models":5}
|
||||
2022-09-17 17:17:21 [35mSTATE:[39m Models {"folder":"../movenet/models","models":3}
|
||||
2022-09-17 17:17:21 [35mSTATE:[39m Models {"folder":"../nanodet/models","models":4}
|
||||
2022-09-17 17:17:22 [35mSTATE:[39m Models: {"count":57,"totalSize":383017442}
|
||||
2022-09-17 17:17:22 [36mINFO: [39m Human Build complete... {"logFile":"test/build.log"}
|
||||
|
|
1998
test/test.log
1998
test/test.log
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -77,7 +77,9 @@
|
|||
<a href="Human.html#profile" class="tsd-index-link tsd-kind-method tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg><span>profile</span></a>
|
||||
<a href="Human.html#reset" class="tsd-index-link tsd-kind-method tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg><span>reset</span></a>
|
||||
<a href="Human.html#segmentation" class="tsd-index-link tsd-kind-method tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg><span>segmentation</span></a>
|
||||
<a href="Human.html#sleep" class="tsd-index-link tsd-kind-method tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg><span>sleep</span></a>
|
||||
<a href="Human.html#validate" class="tsd-index-link tsd-kind-method tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg><span>validate</span></a>
|
||||
<a href="Human.html#video" class="tsd-index-link tsd-kind-method tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg><span>video</span></a>
|
||||
<a href="Human.html#warmup" class="tsd-index-link tsd-kind-method tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg><span>warmup</span></a>
|
||||
</div></section></div></details></section></section>
|
||||
<section class="tsd-panel-group tsd-member-group">
|
||||
|
@ -766,6 +768,23 @@ Interpolation is based on time since last known result so can be called independ
|
|||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{ </span>alpha<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/AnyCanvas.html" class="tsd-signature-type" data-tsd-kind="Type alias">AnyCanvas</a><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/AnyCanvas.html" class="tsd-signature-type" data-tsd-kind="Type alias">AnyCanvas</a><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L262">src/human.ts:262</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="sleep" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>sleep</span><a href="#sleep" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
||||
<li class="tsd-signature tsd-anchor-link" id="sleep.sleep-1">sleep<span class="tsd-signature-symbol">(</span>ms<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-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#sleep.sleep-1" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></li>
|
||||
<li class="tsd-description">
|
||||
<div class="tsd-comment tsd-typography"><p>Helper function</p>
|
||||
</div>
|
||||
<div class="tsd-parameters">
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
<ul class="tsd-parameter-list">
|
||||
<li>
|
||||
<h5>ms: <span class="tsd-signature-type">number</span></h5>
|
||||
<div class="tsd-comment tsd-typography"><p>sleep time in miliseconds</p>
|
||||
</div></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L558">src/human.ts:558</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="validate" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>validate</span><a href="#validate" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
||||
|
@ -781,6 +800,31 @@ Interpolation is based on time since last known result so can be called independ
|
|||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>expected<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>reason<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>where<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L219">src/human.ts:219</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="video" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>video</span><a href="#video" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
||||
<li class="tsd-signature tsd-anchor-link" id="video.video-1">video<span class="tsd-signature-symbol">(</span>element<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">HTMLVideoElement</span>, run<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, delay<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-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#video.video-1" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></li>
|
||||
<li class="tsd-description">
|
||||
<div class="tsd-comment tsd-typography"><p>Continously detect video frames</p>
|
||||
</div>
|
||||
<div class="tsd-parameters">
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
<ul class="tsd-parameter-list">
|
||||
<li>
|
||||
<h5>element: <span class="tsd-signature-type">HTMLVideoElement</span></h5>
|
||||
<div class="tsd-comment tsd-typography"><p>HTMLVideoElement input</p>
|
||||
</div></li>
|
||||
<li>
|
||||
<h5>run: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></h5>
|
||||
<div class="tsd-comment tsd-typography"><p>boolean run continously or stop if already running, default true</p>
|
||||
</div></li>
|
||||
<li>
|
||||
<h5>delay: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0</span></h5>
|
||||
<div class="tsd-comment tsd-typography"><p>number delay detection between frames for number of miliseconds, default 0</p>
|
||||
</div></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L569">src/human.ts:569</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="warmup" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>warmup</span><a href="#warmup" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
||||
|
@ -862,6 +906,8 @@ Interpolation is based on time since last known result so can be called independ
|
|||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#profile" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>profile</a></li>
|
||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#reset" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>reset</a></li>
|
||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#segmentation" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>segmentation</a></li>
|
||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#sleep" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>sleep</a></li>
|
||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#validate" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>validate</a></li>
|
||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#video" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>video</a></li>
|
||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#warmup" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>warmup</a></li></ul></li></ul></nav></div></div>
|
||||
<div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
|
@ -1367,6 +1367,16 @@ declare class Human {
|
|||
* @returns result - {@link Result}
|
||||
*/
|
||||
detect(input: Input, userConfig?: Partial<Config>): Promise<Result>;
|
||||
/** Helper function
|
||||
* @param ms - sleep time in miliseconds
|
||||
*/
|
||||
sleep(ms: number): Promise<void>;
|
||||
/** Continously detect video frames
|
||||
* @param element - HTMLVideoElement input
|
||||
* @param run - boolean run continously or stop if already running, default true
|
||||
* @param delay - number delay detection between frames for number of miliseconds, default 0
|
||||
*/
|
||||
video(element: HTMLVideoElement, run?: boolean, delay?: number): Promise<void>;
|
||||
}
|
||||
export { Human }
|
||||
export default Human;
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit 9785618d94c8eb325fefbf8ca1212359b5c913d6
|
||||
Subproject commit 7a9a68dc4dbbc06c82324266c9a31d9fe037cf3b
|
Loading…
Reference in New Issue