fix wasm detection

pull/293/head
Vladimir Mandic 2022-08-15 11:29:56 -04:00
parent 58d4390735
commit cc1b1ae5e6
38 changed files with 1691 additions and 1058 deletions

View File

@ -11,9 +11,8 @@
### **HEAD -> main** 2022/08/12 mandic00@live.com ### **HEAD -> main** 2022/08/12 mandic00@live.com
- enumerate additional models
### **origin/main** 2022/08/10 mandic00@live.com - release refresh
### **2.9.3** 2022/08/10 mandic00@live.com ### **2.9.3** 2022/08/10 mandic00@live.com

View File

@ -57,6 +57,8 @@ Model is supported using `WebGL` backend in browser
Models can be downloaded from <https://github.com/vladmandic/insightface> Models can be downloaded from <https://github.com/vladmandic/insightface>
- Add `human.check()` which validates all kernel ops for currently loaded models with currently selected backend - Add `human.check()` which validates all kernel ops for currently loaded models with currently selected backend
Example: `console.error(human.check());` Example: `console.error(human.check());`
- Add underlying tensorflow library version detection to `human.env`
Example: `console.log(human.env.tensorflow)`
- Host models in <human-models> - Host models in <human-models>
Models can be directly used without downloading to local storage Models can be directly used without downloading to local storage
Example: `modelPath: 'https://vladmandic.github.io/human-models/models/facemesh.json'` Example: `modelPath: 'https://vladmandic.github.io/human-models/models/facemesh.json'`
@ -69,10 +71,11 @@ Model is supported using `WebGL` backend in browser
- Fix **NanoDet** module as alternative object detection - Fix **NanoDet** module as alternative object detection
- Fix `demo/multithread/node-multiprocess.js` demo - Fix `demo/multithread/node-multiprocess.js` demo
- Fix `human.match` when using mixed descriptor lengths - Fix `human.match` when using mixed descriptor lengths
- Fix WASM feature detection issue in TFJS with Edge/Chromium
- Increased test coverage - Increased test coverage
Run using `npm run test` **NodeJS**: Run using `npm run test`
**Browser**: Run using `demo/browser.html`
- Increase availability of alternative models - Increase availability of alternative models
See `models/model.json` for full list See `models/model.json` for full list
- Update **NMS** methods resulting in some performance improvements
- Update profiling methods in `human.profile()` - Update profiling methods in `human.profile()`
- Update project dependencies - Update project dependencies

4
dist/human.d.ts vendored
View File

@ -449,6 +449,10 @@ export declare class Env {
offscreen: undefined | boolean; offscreen: undefined | boolean;
/** Are performance counter instant values or additive */ /** Are performance counter instant values or additive */
perfadd: boolean; perfadd: boolean;
/** If using tfjs-node get version of underlying tensorflow shared library */
tensorflow: {
version: undefined | string;
};
/** WASM detected capabilities */ /** WASM detected capabilities */
wasm: { wasm: {
supported: undefined | boolean; supported: undefined | boolean;

View File

@ -449,6 +449,10 @@ export declare class Env {
offscreen: undefined | boolean; offscreen: undefined | boolean;
/** Are performance counter instant values or additive */ /** Are performance counter instant values or additive */
perfadd: boolean; perfadd: boolean;
/** If using tfjs-node get version of underlying tensorflow shared library */
tensorflow: {
version: undefined | string;
};
/** WASM detected capabilities */ /** WASM detected capabilities */
wasm: { wasm: {
supported: undefined | boolean; supported: undefined | boolean;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/human.esm.d.ts vendored
View File

@ -449,6 +449,10 @@ export declare class Env {
offscreen: undefined | boolean; offscreen: undefined | boolean;
/** Are performance counter instant values or additive */ /** Are performance counter instant values or additive */
perfadd: boolean; perfadd: boolean;
/** If using tfjs-node get version of underlying tensorflow shared library */
tensorflow: {
version: undefined | string;
};
/** WASM detected capabilities */ /** WASM detected capabilities */
wasm: { wasm: {
supported: undefined | boolean; supported: undefined | boolean;

24
dist/human.esm.js vendored
View File

@ -73430,6 +73430,7 @@ var Env = class {
__publicField(this, "tfjs"); __publicField(this, "tfjs");
__publicField(this, "offscreen"); __publicField(this, "offscreen");
__publicField(this, "perfadd", false); __publicField(this, "perfadd", false);
__publicField(this, "tensorflow", { version: void 0 });
__publicField(this, "wasm", { __publicField(this, "wasm", {
supported: void 0, supported: void 0,
backend: void 0, backend: void 0,
@ -73478,6 +73479,7 @@ var Env = class {
} }
async updateBackend() { async updateBackend() {
this.backends = Object.keys(engine().registryFactory); this.backends = Object.keys(engine().registryFactory);
this.tensorflow = { version: backend()["binding"] ? backend()["binding"]["TF_Version"] : void 0 };
this.wasm.supported = typeof WebAssembly !== "undefined"; this.wasm.supported = typeof WebAssembly !== "undefined";
this.wasm.backend = this.backends.includes("wasm"); this.wasm.backend = this.backends.includes("wasm");
if (this.wasm.supported && this.wasm.backend && getBackend() === "wasm") { if (this.wasm.supported && this.wasm.backend && getBackend() === "wasm") {
@ -77547,7 +77549,7 @@ async function getBoxes(inputImage, config3) {
t2.logits = slice(t2.batch, [0, 0], [-1, 1]); t2.logits = slice(t2.batch, [0, 0], [-1, 1]);
t2.sigmoid = sigmoid(t2.logits); t2.sigmoid = sigmoid(t2.logits);
t2.scores = squeeze(t2.sigmoid); t2.scores = squeeze(t2.sigmoid);
t2.nms = image.nonMaxSuppression(t2.boxes, t2.scores, ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || 0, ((_b = config3.face.detector) == null ? void 0 : _b.iouThreshold) || 0, ((_c = config3.face.detector) == null ? void 0 : _c.minConfidence) || 0); t2.nms = await image.nonMaxSuppressionAsync(t2.boxes, t2.scores, ((_a = config3.face.detector) == null ? void 0 : _a.maxDetected) || 0, ((_b = config3.face.detector) == null ? void 0 : _b.iouThreshold) || 0, ((_c = config3.face.detector) == null ? void 0 : _c.minConfidence) || 0);
const nms = await t2.nms.array(); const nms = await t2.nms.array();
const boxes = []; const boxes = [];
const scores = await t2.scores.data(); const scores = await t2.scores.data();
@ -77991,7 +77993,7 @@ async function process3(res, outputShape, config3) {
t2.scores = squeeze(arr[4]); t2.scores = squeeze(arr[4]);
t2.classes = squeeze(arr[5]); t2.classes = squeeze(arr[5]);
dispose([res, ...arr]); dispose([res, ...arr]);
t2.nms = image.nonMaxSuppression(t2.boxes, t2.scores, config3.object.maxDetected, config3.object.iouThreshold, config3.object.minConfidence || 0); t2.nms = await image.nonMaxSuppressionAsync(t2.boxes, t2.scores, config3.object.maxDetected, config3.object.iouThreshold, config3.object.minConfidence || 0);
const nms = await t2.nms.data(); const nms = await t2.nms.data();
let i2 = 0; let i2 = 0;
for (const id of Array.from(nms)) { for (const id of Array.from(nms)) {
@ -82130,7 +82132,7 @@ var HandDetector = class {
const scores = await t2.scores.data(); const scores = await t2.scores.data();
t2.boxes = slice(t2.predictions, [0, 1], [-1, 4]); t2.boxes = slice(t2.predictions, [0, 1], [-1, 4]);
t2.norm = this.normalizeBoxes(t2.boxes); t2.norm = this.normalizeBoxes(t2.boxes);
t2.nms = image.nonMaxSuppression(t2.norm, t2.scores, 3 * config3.hand.maxDetected, config3.hand.iouThreshold, config3.hand.minConfidence); t2.nms = await image.nonMaxSuppressionAsync(t2.norm, t2.scores, 3 * config3.hand.maxDetected, config3.hand.iouThreshold, config3.hand.minConfidence);
const nms = await t2.nms.array(); const nms = await t2.nms.array();
const hands = []; const hands = [];
for (const index2 of nms) { for (const index2 of nms) {
@ -82981,12 +82983,18 @@ async function check(instance2, force = false) {
await setWasmPaths(instance2.config.wasmPath, instance2.config.wasmPlatformFetch); await setWasmPaths(instance2.config.wasmPath, instance2.config.wasmPlatformFetch);
else else
throw new Error("backend error: attempting to use wasm backend but wasm path is not set"); throw new Error("backend error: attempting to use wasm backend but wasm path is not set");
const simd = await env().getAsync("WASM_HAS_SIMD_SUPPORT"); let mt = false;
const mt = await env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT"); let simd = false;
try {
mt = await env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT");
simd = await env().getAsync("WASM_HAS_SIMD_SUPPORT");
if (instance2.config.debug) if (instance2.config.debug)
log(`wasm execution: ${simd ? "SIMD" : "no SIMD"} ${mt ? "multithreaded" : "singlethreaded"}`); log(`wasm execution: ${simd ? "simd" : "no simd"} ${mt ? "multithreaded" : "singlethreaded"}`);
if (instance2.config.debug && !simd) if (instance2.config.debug && !simd)
log("warning: wasm simd support is not enabled"); log("warning: wasm simd support is not enabled");
} catch (e2) {
log("wasm detection failed");
}
} }
try { try {
await setBackend(instance2.config.backend); await setBackend(instance2.config.backend);
@ -83119,7 +83127,7 @@ async function detectHands(input2, config3) {
t2.max = max(t2.filtered, 1); t2.max = max(t2.filtered, 1);
t2.argmax = argMax(t2.filtered, 1); t2.argmax = argMax(t2.filtered, 1);
let id = 0; let id = 0;
t2.nms = image.nonMaxSuppression(t2.boxes, t2.max, (config3.hand.maxDetected || 0) + 1, config3.hand.iouThreshold || 0, config3.hand.minConfidence || 1); t2.nms = await image.nonMaxSuppressionAsync(t2.boxes, t2.max, (config3.hand.maxDetected || 0) + 1, config3.hand.iouThreshold || 0, config3.hand.minConfidence || 1);
const nms = await t2.nms.data(); const nms = await t2.nms.data();
const scores = await t2.max.data(); const scores = await t2.max.data();
const classNum = await t2.argmax.data(); const classNum = await t2.argmax.data();
@ -83614,7 +83622,7 @@ async function process4(res, outputShape, config3) {
const nmsScores = results.map((a) => a.score); const nmsScores = results.map((a) => a.score);
let nmsIdx = []; let nmsIdx = [];
if (nmsBoxes && nmsBoxes.length > 0) { if (nmsBoxes && nmsBoxes.length > 0) {
const nms = image.nonMaxSuppression(nmsBoxes, nmsScores, config3.object.maxDetected, config3.object.iouThreshold, config3.object.minConfidence); const nms = await image.nonMaxSuppressionAsync(nmsBoxes, nmsScores, config3.object.maxDetected, config3.object.iouThreshold, config3.object.minConfidence);
nmsIdx = await nms.data(); nmsIdx = await nms.data();
dispose(nms); dispose(nms);
} }

File diff suppressed because one or more lines are too long

122
dist/human.js vendored

File diff suppressed because one or more lines are too long

View File

@ -449,6 +449,10 @@ export declare class Env {
offscreen: undefined | boolean; offscreen: undefined | boolean;
/** Are performance counter instant values or additive */ /** Are performance counter instant values or additive */
perfadd: boolean; perfadd: boolean;
/** If using tfjs-node get version of underlying tensorflow shared library */
tensorflow: {
version: undefined | string;
};
/** WASM detected capabilities */ /** WASM detected capabilities */
wasm: { wasm: {
supported: undefined | boolean; supported: undefined | boolean;

File diff suppressed because one or more lines are too long

View File

@ -449,6 +449,10 @@ export declare class Env {
offscreen: undefined | boolean; offscreen: undefined | boolean;
/** Are performance counter instant values or additive */ /** Are performance counter instant values or additive */
perfadd: boolean; perfadd: boolean;
/** If using tfjs-node get version of underlying tensorflow shared library */
tensorflow: {
version: undefined | string;
};
/** WASM detected capabilities */ /** WASM detected capabilities */
wasm: { wasm: {
supported: undefined | boolean; supported: undefined | boolean;

File diff suppressed because one or more lines are too long

View File

@ -449,6 +449,10 @@ export declare class Env {
offscreen: undefined | boolean; offscreen: undefined | boolean;
/** Are performance counter instant values or additive */ /** Are performance counter instant values or additive */
perfadd: boolean; perfadd: boolean;
/** If using tfjs-node get version of underlying tensorflow shared library */
tensorflow: {
version: undefined | string;
};
/** WASM detected capabilities */ /** WASM detected capabilities */
wasm: { wasm: {
supported: undefined | boolean; supported: undefined | boolean;

2
dist/human.node.js vendored

File diff suppressed because one or more lines are too long

View File

@ -79,7 +79,7 @@
"@tensorflow/tfjs-node": "^3.19.0", "@tensorflow/tfjs-node": "^3.19.0",
"@tensorflow/tfjs-node-gpu": "^3.19.0", "@tensorflow/tfjs-node-gpu": "^3.19.0",
"@tensorflow/tfjs-tflite": "0.0.1-alpha.8", "@tensorflow/tfjs-tflite": "0.0.1-alpha.8",
"@types/node": "^18.7.2", "@types/node": "^18.7.4",
"@types/offscreencanvas": "^2019.7.0", "@types/offscreencanvas": "^2019.7.0",
"@typescript-eslint/eslint-plugin": "^5.33.0", "@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0", "@typescript-eslint/parser": "^5.33.0",
@ -87,8 +87,8 @@
"@vladmandic/pilogger": "^0.4.6", "@vladmandic/pilogger": "^0.4.6",
"@vladmandic/tfjs": "github:vladmandic/tfjs", "@vladmandic/tfjs": "github:vladmandic/tfjs",
"@webgpu/types": "^0.1.21", "@webgpu/types": "^0.1.21",
"esbuild": "^0.15.1", "esbuild": "^0.15.3",
"eslint": "8.21.0", "eslint": "8.22.0",
"eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-html": "^7.1.0", "eslint-plugin-html": "^7.1.0",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.26.0",

View File

@ -71,7 +71,7 @@ export async function decode(boxesTensor: Tensor, logitsTensor: Tensor, config:
detected.push({ box, boxRaw, score: scores[i] }); detected.push({ box, boxRaw, score: scores[i] });
} }
/* /*
t.nms = tf.image.nonMaxSuppression(t.boxes, t.scores, 1, config.body.detector?.minConfidence || 0.1, config.body.detector?.iouThreshold || 0.1); t.nms = await tf.image.nonMaxSuppressionAsync(t.boxes, t.scores, 1, config.body.detector?.minConfidence || 0.1, config.body.detector?.iouThreshold || 0.1);
const boxes = t.boxes.arraySync(); const boxes = t.boxes.arraySync();
const scores = t.scores.dataSync(); const scores = t.scores.dataSync();
const nms = t.nms.dataSync(); const nms = t.nms.dataSync();

View File

@ -75,7 +75,7 @@ export async function getBoxes(inputImage: Tensor, config: Config) {
t.logits = tf.slice(t.batch, [0, 0], [-1, 1]); t.logits = tf.slice(t.batch, [0, 0], [-1, 1]);
t.sigmoid = tf.sigmoid(t.logits); t.sigmoid = tf.sigmoid(t.logits);
t.scores = tf.squeeze(t.sigmoid); t.scores = tf.squeeze(t.sigmoid);
t.nms = tf.image.nonMaxSuppression(t.boxes, t.scores, (config.face.detector?.maxDetected || 0), (config.face.detector?.iouThreshold || 0), (config.face.detector?.minConfidence || 0)); t.nms = await tf.image.nonMaxSuppressionAsync(t.boxes, t.scores, (config.face.detector?.maxDetected || 0), (config.face.detector?.iouThreshold || 0), (config.face.detector?.minConfidence || 0));
const nms = await t.nms.array() as number[]; const nms = await t.nms.array() as number[];
const boxes: Array<DetectBox> = []; const boxes: Array<DetectBox> = [];
const scores = await t.scores.data(); const scores = await t.scores.data();

View File

@ -67,7 +67,7 @@ export class HandDetector {
t.boxes = tf.slice(t.predictions, [0, 1], [-1, 4]); t.boxes = tf.slice(t.predictions, [0, 1], [-1, 4]);
t.norm = this.normalizeBoxes(t.boxes); t.norm = this.normalizeBoxes(t.boxes);
// box detection is flaky so we look for 3x boxes than we need results // box detection is flaky so we look for 3x boxes than we need results
t.nms = tf.image.nonMaxSuppression(t.norm, t.scores, 3 * config.hand.maxDetected, config.hand.iouThreshold, config.hand.minConfidence); t.nms = await tf.image.nonMaxSuppressionAsync(t.norm, t.scores, 3 * config.hand.maxDetected, config.hand.iouThreshold, config.hand.minConfidence);
const nms = await t.nms.array() as Array<number>; const nms = await t.nms.array() as Array<number>;
const hands: Array<{ startPoint: Point; endPoint: Point; palmLandmarks: Point[]; confidence: number }> = []; const hands: Array<{ startPoint: Point; endPoint: Point; palmLandmarks: Point[]; confidence: number }> = [];
for (const index of nms) { for (const index of nms) {

View File

@ -121,7 +121,7 @@ async function detectHands(input: Tensor, config: Config): Promise<HandDetectRes
t.max = tf.max(t.filtered, 1); // max overall score t.max = tf.max(t.filtered, 1); // max overall score
t.argmax = tf.argMax(t.filtered, 1); // class index of max overall score t.argmax = tf.argMax(t.filtered, 1); // class index of max overall score
let id = 0; let id = 0;
t.nms = tf.image.nonMaxSuppression(t.boxes, t.max, (config.hand.maxDetected || 0) + 1, config.hand.iouThreshold || 0, config.hand.minConfidence || 1); t.nms = await tf.image.nonMaxSuppressionAsync(t.boxes, t.max, (config.hand.maxDetected || 0) + 1, config.hand.iouThreshold || 0, config.hand.minConfidence || 1);
const nms = await t.nms.data(); const nms = await t.nms.data();
const scores = await t.max.data(); const scores = await t.max.data();
const classNum = await t.argmax.data(); const classNum = await t.argmax.data();

View File

@ -42,7 +42,7 @@ async function process(res: Tensor | null, outputShape: [number, number], config
t.scores = tf.squeeze(arr[4]); t.scores = tf.squeeze(arr[4]);
t.classes = tf.squeeze(arr[5]); t.classes = tf.squeeze(arr[5]);
tf.dispose([res, ...arr]); tf.dispose([res, ...arr]);
t.nms = tf.image.nonMaxSuppression(t.boxes, t.scores, config.object.maxDetected, config.object.iouThreshold, (config.object.minConfidence || 0)); t.nms = await tf.image.nonMaxSuppressionAsync(t.boxes, t.scores, config.object.maxDetected, config.object.iouThreshold, (config.object.minConfidence || 0));
const nms = await t.nms.data(); const nms = await t.nms.data();
let i = 0; let i = 0;
for (const id of Array.from(nms)) { for (const id of Array.from(nms)) {

View File

@ -91,7 +91,7 @@ async function process(res: Tensor[], outputShape: [number, number], config: Con
const nmsScores = results.map((a) => a.score); const nmsScores = results.map((a) => a.score);
let nmsIdx: Array<number> = []; let nmsIdx: Array<number> = [];
if (nmsBoxes && nmsBoxes.length > 0) { if (nmsBoxes && nmsBoxes.length > 0) {
const nms = tf.image.nonMaxSuppression(nmsBoxes, nmsScores, config.object.maxDetected, config.object.iouThreshold, config.object.minConfidence); const nms = await tf.image.nonMaxSuppressionAsync(nmsBoxes, nmsScores, config.object.maxDetected, config.object.iouThreshold, config.object.minConfidence);
nmsIdx = await nms.data(); nmsIdx = await nms.data();
tf.dispose(nms); tf.dispose(nms);
} }

View File

@ -90,10 +90,16 @@ export async function check(instance: Human, force = false) {
if (instance.config.debug) log('wasm path:', instance.config.wasmPath); if (instance.config.debug) log('wasm path:', instance.config.wasmPath);
if (typeof tf?.setWasmPaths !== 'undefined') await tf.setWasmPaths(instance.config.wasmPath, instance.config.wasmPlatformFetch); if (typeof tf?.setWasmPaths !== 'undefined') await tf.setWasmPaths(instance.config.wasmPath, instance.config.wasmPlatformFetch);
else throw new Error('backend error: attempting to use wasm backend but wasm path is not set'); else throw new Error('backend error: attempting to use wasm backend but wasm path is not set');
const simd = await tf.env().getAsync('WASM_HAS_SIMD_SUPPORT'); let mt = false;
const mt = await tf.env().getAsync('WASM_HAS_MULTITHREAD_SUPPORT'); let simd = false;
if (instance.config.debug) log(`wasm execution: ${simd ? 'SIMD' : 'no SIMD'} ${mt ? 'multithreaded' : 'singlethreaded'}`); try {
mt = await tf.env().getAsync('WASM_HAS_MULTITHREAD_SUPPORT');
simd = await tf.env().getAsync('WASM_HAS_SIMD_SUPPORT');
if (instance.config.debug) log(`wasm execution: ${simd ? 'simd' : 'no simd'} ${mt ? 'multithreaded' : 'singlethreaded'}`);
if (instance.config.debug && !simd) log('warning: wasm simd support is not enabled'); if (instance.config.debug && !simd) log('warning: wasm simd support is not enabled');
} catch {
log('wasm detection failed');
}
} }
try { try {

View File

@ -27,6 +27,10 @@ export class Env {
offscreen: undefined | boolean; offscreen: undefined | boolean;
/** Are performance counter instant values or additive */ /** Are performance counter instant values or additive */
perfadd: boolean = false; perfadd: boolean = false;
/** If using tfjs-node get version of underlying tensorflow shared library */
tensorflow: {
version: undefined | string,
} = { version: undefined };
/** WASM detected capabilities */ /** WASM detected capabilities */
wasm: { wasm: {
supported: undefined | boolean, supported: undefined | boolean,
@ -84,6 +88,7 @@ export class Env {
this.tfjs = { version: tf.version['tfjs-core'] }; this.tfjs = { version: tf.version['tfjs-core'] };
this.offscreen = typeof OffscreenCanvas !== 'undefined'; this.offscreen = typeof OffscreenCanvas !== 'undefined';
this.initial = true; this.initial = true;
// @ts-ignore WorkerGlobalScope evaluated in browser only // @ts-ignore WorkerGlobalScope evaluated in browser only
this.worker = this.browser && this.offscreen ? (typeof WorkerGlobalScope !== 'undefined') : undefined; this.worker = this.browser && this.offscreen ? (typeof WorkerGlobalScope !== 'undefined') : undefined;
if (typeof navigator !== 'undefined') { if (typeof navigator !== 'undefined') {
@ -114,6 +119,7 @@ export class Env {
async updateBackend() { async updateBackend() {
// analyze backends // analyze backends
this.backends = Object.keys(tf.engine().registryFactory); this.backends = Object.keys(tf.engine().registryFactory);
this.tensorflow = { version: (tf.backend()['binding'] ? tf.backend()['binding']['TF_Version'] : undefined) };
this.wasm.supported = typeof WebAssembly !== 'undefined'; this.wasm.supported = typeof WebAssembly !== 'undefined';
this.wasm.backend = this.backends.includes('wasm'); this.wasm.backend = this.backends.includes('wasm');
if (this.wasm.supported && this.wasm.backend && tf.getBackend() === 'wasm') { if (this.wasm.supported && this.wasm.backend && tf.getBackend() === 'wasm') {

View File

@ -13,9 +13,9 @@
<style> <style>
@font-face { font-family: 'Lato'; font-display: swap; font-style: normal; font-weight: 100; src: local('Lato'), url('../../assets/lato-light.woff2') } @font-face { font-family: 'Lato'; font-display: swap; font-style: normal; font-weight: 100; src: local('Lato'), url('../../assets/lato-light.woff2') }
html { font-family: 'Lato', 'Segoe UI'; font-size: 14px; font-variant: small-caps; } html { font-family: 'Lato', 'Segoe UI'; font-size: 14px; font-variant: small-caps; }
body { margin: 0; background: black; color: white; } body { margin: 0; background: black; color: white; width: 100vw; overflow-x: hidden; }
.canvas { position: absolute; bottom: 10px; right: 10px; width: 256px; height: 256px; z-index: 99; } .canvas { position: absolute; bottom: 10px; right: 10px; width: 256px; height: 256px; z-index: 99; }
.pre { line-height: 150%; } .pre { line-height: 150%; white-space: break-spaces; }
.events { position: absolute; top: 10px; right: 10px; width: 12rem; height: 1.25rem; background-color: grey; padding: 8px; z-index: 99; } .events { position: absolute; top: 10px; right: 10px; width: 12rem; height: 1.25rem; background-color: grey; padding: 8px; z-index: 99; }
.state { position: absolute; top: 60px; right: 10px; width: 12rem; height: 1.25rem; background-color: grey; padding: 8px; z-index: 99; } .state { position: absolute; top: 60px; right: 10px; width: 12rem; height: 1.25rem; background-color: grey; padding: 8px; z-index: 99; }
</style> </style>
@ -36,16 +36,16 @@
object: { enabled: true }, object: { enabled: true },
}; };
const backends = ['wasm', 'webgl', 'humangl', 'webgpu']; const backends = ['wasm', 'humangl', 'webgl', 'webgpu'];
const start = performance.now(); const start = performance.now();
function str(...msg) { function str(long, ...msg) {
if (!Array.isArray(msg)) return msg; if (!Array.isArray(msg)) return msg;
let line = ''; let line = '';
for (const entry of msg) { for (const entry of msg) {
if (typeof entry === 'object') line += JSON.stringify(entry).replace(/"/g, '').replace(/,/g, ', ').replace(/:/g, ': '); if (typeof entry === 'object') line += ' ' + JSON.stringify(entry, null, long ? 2 : 0).replace(/"/g, '').replace(/,/g, ', ').replace(/:/g, ': ');
else line += entry; else line += ' ' + entry;
} }
return line + '\n'; return line + '\n';
} }
@ -55,9 +55,19 @@
const dt = new Date(); const dt = new Date();
const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`; const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;
const elap = (dt - last).toString().padStart(5, '0'); const elap = (dt - last).toString().padStart(5, '0');
document.getElementById('log').innerHTML += ts + ' +' + elap + 'ms &nbsp' + str(...msgs); document.getElementById('log').innerHTML += ts + ' +' + elap + 'ms &nbsp' + str(false, ...msgs);
// eslint-disable-next-line no-console document.documentElement.scrollTop = document.documentElement.scrollHeight
console.log(ts, elap, ...msgs); console.log(ts, elap, ...msgs); // eslint-disable-line no-console
last = dt;
}
async function detailed(...msgs) {
const dt = new Date();
const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;
const elap = (dt - last).toString().padStart(5, '0');
document.getElementById('log').innerHTML += ts + ' +' + elap + 'ms &nbsp' + str(true, ...msgs);
document.documentElement.scrollTop = document.documentElement.scrollHeight
console.log(ts, elap, ...msgs); // eslint-disable-line no-console
last = dt; last = dt;
} }
@ -95,37 +105,44 @@
human.events.addEventListener('image', () => events('image')); human.events.addEventListener('image', () => events('image'));
human.events.addEventListener('detect', () => events('detect')); human.events.addEventListener('detect', () => events('detect'));
const timer = setInterval(() => { document.getElementById('state').innerText = `State: ${human.state}`; }, 10); const timer = setInterval(() => { document.getElementById('state').innerText = `State: ${human.state}`; }, 10);
log({ version: human.version }); log('version', human.version);
log({ tfjs: human.tf.version.tfjs }); log('tfjs', human.tf.version.tfjs);
log({ environment: human.env });
log({ config: human.config }); const env = JSON.parse(JSON.stringify(human.env));
env.kernels = human.env.kernels.length;
detailed('environment', env);
detailed('config', human.config);
await human.load(); await human.load();
const models = Object.keys(human.models).map((model) => ({ name: model, loaded: (human.models[model] !== null) })); const models = Object.keys(human.models).map((model) => ({ name: model, loaded: (human.models[model] !== null) }));
log({ models }); log('models', models);
for (const backend of backends) { for (const backend of backends) {
log(); log();
log('test start:', backend); log('test start:', backend);
human.config.backend = backend; human.config.backend = backend;
await human.init(); await human.init();
log({ initialized: human.tf.getBackend() }); log('desired', backend, 'detected', human.tf.getBackend());
log({ memory: human.tf.memory() }); if (human.tf.getBackend() !== backend) {
continue;
}
log('memory', human.tf.memory());
res = await human.validate(); res = await human.validate();
log({ validate: res }); log('validate', res);
res = await human.warmup({ warmup: 'face' }); res = await human.warmup({ warmup: 'face' });
draw(res.canvas); draw(res.canvas);
log({ warmup: 'face' }); log('warmup', 'face');
let img = await image('../../samples/in/ai-body.jpg'); let img = await image('../../samples/in/ai-body.jpg');
const input = await human.image(img); const input = await human.image(img);
log({ input: input.tensor.shape }); log('input', input.tensor.shape);
draw(res.canvas); draw(res.canvas);
res = await human.detect(input.tensor); res = await human.detect(input.tensor);
log({ detect: true }); log('detect');
human.next(); human.next();
log({ interpolated: true }); log('interpolate');
const persons = res.persons; const persons = res.persons;
log({ persons: true }); log('persons');
log({ summary: { persons: persons.length, face: res.face.length, body: res.body.length, hand: res.hand.length, object: res.object.length, gesture: res.gesture.length } }); log('summary', { persons: persons.length, face: res.face.length, body: res.body.length, hand: res.hand.length, object: res.object.length, gesture: res.gesture.length });
log({ performance: human.performance }); log('performance', human.performance);
human.tf.dispose(input.tensor); human.tf.dispose(input.tensor);
draw(); draw();
@ -138,12 +155,12 @@
draw(res.canvas); draw(res.canvas);
} }
const t1 = performance.now(); const t1 = performance.now();
log({ benchmark: { time: Math.round((t1 - t0) / 10), cacheSensitivity: val }, performance: human.performance }); log('benchmark', { time: Math.round((t1 - t0) / 10), cacheSensitivity: val, performance: human.performance });
await wait(10); await wait(10);
} }
draw(); draw();
log({ memory: human.tf.memory() }); log('memory', human.tf.memory());
} }
clearInterval(timer); clearInterval(timer);
log(); log();

View File

@ -1,80 +1,412 @@
14:40:51.744 +00001ms human tests 10:13:35.412 +00001ms human tests
14:40:51.918 +00174ms {version: 2.9.0} 10:13:35.517 +00105ms version 2.9.3
14:40:51.918 +00000ms {tfjs: 3.19.0} 10:13:35.517 +00000ms tfjs 3.19.0
14:40:51.918 +00000ms {environment: {browser: true, node: false, worker: false, platform: Windows NT 10.0; Win64; x64, agent: Mozilla/5.0 AppleWebKit/537.36 Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1329.0, backends: [cpu, webgl, wasm, webgpu, humangl], initial: true, tfjs: {version: 3.19.0}, offscreen: true, perfadd: false, wasm: {supported: true, backend: true}, webgl: {supported: true, backend: true, version: WebGL 2.0 (OpenGL ES 3.0 Chromium), renderer: WebKit WebGL}, webgpu: {supported: true, backend: true, adapter: Default}, cpu: {flags: []}, kernels: [_fusedmatmul, abs, acos, acosh, add, addn, all, any, argmax, argmin, asin, asinh, atan, atan2, atanh, avgpool, avgpool3d, avgpool3dgrad, avgpoolgrad, batchmatmul, fusedbatchnorm, batchtospacend, bincount, broadcastargs, cast, ceil, clipbyvalue, complex, complexabs, concat, conv2d, conv2dbackpropfilter, conv2dbackpropinput, conv3d, conv3dbackpropfilterv2, conv3dbackpropinputv2, cos, cosh, cropandresize, cumprod, cumsum, densebincount, depthtospace, depthwiseconv2dnative, depthwiseconv2dnativebackpropfilter, depthwiseconv2dnativebackpropinput, diag, dilation2d, einsum, elu, elugrad, equal, erf, exp, expanddims, expm1, fft, fill, flipleftright, floor, floordiv, frompixels, fusedconv2d, fuseddepthwiseconv2d, gathernd, gatherv2, greater, greaterequal, identity, ifft, imag, isfinite, isinf, isnan, leakyrelu, less, lessequal, linspace, log, log1p, logicaland, logicalnot, logicalor, lrn, lrngrad, max, maximum, maxpool, maxpool3d, maxpool3dgrad, maxpoolgrad, maxpoolwithargmax, mean, min, minimum, mirrorpad, mod, multinomial, multiply, neg, nonmaxsuppressionv3, nonmaxsuppressionv4, nonmaxsuppressionv5, notequal, onehot, oneslike, pack, padv2, pow, prelu, prod, range, real, realdiv, reciprocal, relu, relu6, reshape, resizebilinear, resizebilineargrad, resizenearestneighbor, resizenearestneighborgrad, reverse, rotatewithoffset, round, rsqrt, scatternd, searchsorted, select, selu, sigmoid, sign, sin, sinh, slice, softmax, softplus, spacetobatchnd, sparsefillemptyrows, sparsereshape, sparsesegmentmean, sparsesegmentsum, sparsetodense, splitv, sqrt, square, squareddifference, step, stridedslice, stringngrams, stringsplit, stringtohashbucketfast, sub, sum, tan, tanh, tile, topk, transform, transpose, unique, unpack, unsortedsegmentsum, zeroslike, floormod]}} 10:13:35.517 +00000ms environment {
14:40:51.918 +00000ms {config: {backend: humangl, modelBasePath: ../models/, cacheModels: true, wasmPath: https: //cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.19.0/dist/, wasmPlatformFetch: false, debug: true, async: true, warmup: none, cacheSensitivity: 0, skipAllowed: false, deallocate: false, filter: {enabled: true, equalization: false, width: 0, height: 0, flip: false, return: true, brightness: 0, contrast: 0, sharpness: 0, blur: 0, saturation: 0, hue: 0, negative: false, sepia: false, vintage: false, kodachrome: false, technicolor: false, polaroid: false, pixelate: 0}, gesture: {enabled: true}, face: {enabled: true, detector: {modelPath: blazeface.json, rotation: true, maxDetected: 1, skipFrames: 99, skipTime: 2500, minConfidence: 0.2, iouThreshold: 0.1, mask: false, return: false}, mesh: {enabled: true, modelPath: facemesh.json, keepInvalid: false}, attention: {enabled: false, modelPath: facemesh-attention.json}, iris: {enabled: true, modelPath: iris.json}, emotion: {enabled: true, minConfidence: 0.1, skipFrames: 99, skipTime: 1500, modelPath: emotion.json}, description: {enabled: true, modelPath: faceres.json, skipFrames: 99, skipTime: 3000, minConfidence: 0.1}, antispoof: {enabled: false, skipFrames: 99, skipTime: 4000, modelPath: antispoof.json}, liveness: {enabled: false, skipFrames: 99, skipTime: 4000, modelPath: liveness.json}}, body: {enabled: true, modelPath: movenet-lightning.json, maxDetected: -1, minConfidence: 0.3, skipFrames: 1, skipTime: 200}, hand: {enabled: true, rotation: true, skipFrames: 99, skipTime: 1000, minConfidence: 0.5, iouThreshold: 0.2, maxDetected: -1, landmarks: true, detector: {modelPath: handtrack.json}, skeleton: {modelPath: handlandmark-full.json}}, object: {enabled: true, modelPath: mb3-centernet.json, minConfidence: 0.2, iouThreshold: 0.4, maxDetected: 10, skipFrames: 99, skipTime: 2000}, segmentation: {enabled: false, modelPath: selfie.json, blur: 8}}} browser: true,
14:40:52.214 +00296ms {models: [{name: ssrnetage, loaded: false}, {name: gear, loaded: false}, {name: blazeposedetect, loaded: false}, {name: blazepose, loaded: false}, {name: centernet, loaded: true}, {name: efficientpose, loaded: false}, {name: mobilefacenet, loaded: false}, {name: emotion, loaded: true}, {name: facedetect, loaded: true}, {name: faceiris, loaded: true}, {name: facemesh, loaded: true}, {name: faceres, loaded: true}, {name: ssrnetgender, loaded: false}, {name: handpose, loaded: false}, {name: handskeleton, loaded: true}, {name: handtrack, loaded: true}, {name: liveness, loaded: false}, {name: movenet, loaded: true}, {name: nanodet, loaded: false}, {name: posenet, loaded: false}, {name: segmentation, loaded: false}, {name: antispoof, loaded: false}]} node: false,
14:40:52.214 +00000ms worker: false,
14:40:52.214 +00000ms test start:wasm platform: Windows NT 10.0; Win64; x64,
14:40:53.404 +01190ms {initialized: wasm} agent: Mozilla/5.0 AppleWebKit/537.36 Chrome/106.0.0.0 Safari/537.36,
14:40:53.404 +00000ms {memory: {unreliable: false, numTensors: 1761, numDataBuffers: 1761, numBytes: 60948216}} backends: [
14:40:53.404 +00000ms {validate: []} cpu,
14:40:53.884 +00480ms {warmup: face} webgl,
14:40:53.967 +00083ms {input: [1, 1200, 1200, 3]} wasm,
14:40:54.232 +00265ms {detect: true} webgpu,
14:40:54.234 +00002ms {interpolated: true} humangl
14:40:54.234 +00000ms {persons: true} ],
14:40:54.234 +00000ms {summary: {persons: 1, face: 1, body: 1, hand: 1, object: 1, gesture: 6}} initial: true,
14:40:54.234 +00000ms {performance: {initBackend: 1183, loadModels: 295, inputProcess: 2, totalFrames: 2, cachedFrames: 0, cacheCheck: 0, total: 263, warmup: 479}} tfjs: {
14:40:54.989 +00755ms {benchmark: {time: 71, cacheSensitivity: 0}, performance: {inputProcess: 2, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 52}} version: 3.19.0
14:40:55.708 +00719ms {benchmark: {time: 70, cacheSensitivity: 0.25}, performance: {inputProcess: 2, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 55}} },
14:40:56.418 +00710ms {benchmark: {time: 68, cacheSensitivity: 0.5}, performance: {inputProcess: 1, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 48}} offscreen: true,
14:40:57.108 +00690ms {benchmark: {time: 66, cacheSensitivity: 0.75}, performance: {inputProcess: 2, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 54}} perfadd: false,
14:40:57.484 +00376ms {benchmark: {time: 34, cacheSensitivity: 10}, performance: {inputProcess: 2, totalFrames: 10, cachedFrames: 8, cacheCheck: 0, total: 48}} wasm: {
14:40:57.512 +00028ms {memory: {unreliable: false, numTensors: 1762, numDataBuffers: 1762, numBytes: 61734648}} supported: true,
14:40:57.512 +00000ms backend: true
14:40:57.513 +00001ms test start:webgl },
14:40:57.550 +00037ms {initialized: webgl} webgl: {
14:40:57.551 +00001ms {memory: {unreliable: false, numBytesInGPU: 0, numBytesInGPUAllocated: 0, numBytesInGPUFree: 0, numTensors: 1768, numDataBuffers: 1768, numBytes: 61734680}} supported: true,
14:40:57.551 +00000ms {validate: []} backend: true,
14:40:59.550 +01999ms {warmup: face} version: WebGL 2.0 (OpenGL ES 3.0 Chromium),
14:40:59.589 +00039ms {input: [1, 1200, 1200, 3]} renderer: WebKit WebGL
14:41:01.233 +01644ms {detect: true} },
14:41:01.234 +00001ms {interpolated: true} webgpu: {
14:41:01.234 +00000ms {persons: true} supported: true,
14:41:01.234 +00000ms {summary: {persons: 0, face: 0, body: 1, hand: 0, object: 0, gesture: 0}} backend: true,
14:41:01.234 +00000ms {performance: {inputProcess: 0, totalFrames: 12, cachedFrames: 9, cacheCheck: 0, total: 1639, initBackend: 0, warmup: 1999}} adapter: Default
14:41:03.565 +02331ms {benchmark: {time: 229, cacheSensitivity: 0}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 63}} },
14:41:04.434 +00869ms {benchmark: {time: 83, cacheSensitivity: 0.25}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 5, total: 54}} cpu: {
14:41:05.322 +00888ms {benchmark: {time: 84, cacheSensitivity: 0.5}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 4, total: 55}} flags: []
14:41:06.268 +00946ms {benchmark: {time: 91, cacheSensitivity: 0.75}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 11, total: 84}} },
14:41:06.851 +00583ms {benchmark: {time: 54, cacheSensitivity: 10}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 8, cacheCheck: 16, total: 71}} kernels: [
14:41:06.897 +00046ms {memory: {unreliable: false, numBytesInGPU: 56099560, numBytesInGPUAllocated: 701611228, numBytesInGPUFree: 645511668, numTensors: 1768, numDataBuffers: 1768, numBytes: 61734680}} _fusedmatmul,
14:41:06.898 +00001ms abs,
14:41:06.898 +00000ms test start:humangl acos,
14:41:06.947 +00049ms {initialized: humangl} acosh,
14:41:06.947 +00000ms {memory: {unreliable: false, numBytesInGPU: 0, numBytesInGPUAllocated: 0, numBytesInGPUFree: 0, numTensors: 1774, numDataBuffers: 1774, numBytes: 61734712}} add,
14:41:06.947 +00000ms {validate: []} addn,
14:41:09.119 +02172ms {warmup: face} all,
14:41:09.189 +00070ms {input: [1, 1200, 1200, 3]} any,
14:41:09.663 +00474ms {detect: true} argmax,
14:41:09.665 +00002ms {interpolated: true} argmin,
14:41:09.666 +00001ms {persons: true} asin,
14:41:09.666 +00000ms {summary: {persons: 1, face: 1, body: 1, hand: 0, object: 0, gesture: 1}} asinh,
14:41:09.666 +00000ms {performance: {inputProcess: 0, totalFrames: 12, cachedFrames: 9, cacheCheck: 0, total: 473, initBackend: 2, warmup: 2171}} atan,
14:41:12.296 +02630ms {benchmark: {time: 263, cacheSensitivity: 0}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 283}} atan2,
14:41:14.946 +02650ms {benchmark: {time: 260, cacheSensitivity: 0.25}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 15, total: 249}} atanh,
14:41:17.663 +02717ms {benchmark: {time: 266, cacheSensitivity: 0.5}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 15, total: 250}} avgpool,
14:41:20.513 +02850ms {benchmark: {time: 279, cacheSensitivity: 0.75}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 15, total: 249}} avgpool3d,
14:41:21.796 +01283ms {benchmark: {time: 122, cacheSensitivity: 10}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 8, cacheCheck: 11, total: 245}} avgpool3dgrad,
14:41:21.857 +00061ms {memory: {unreliable: false, numBytesInGPU: 56099560, numBytesInGPUAllocated: 701611228, numBytesInGPUFree: 645511668, numTensors: 1774, numDataBuffers: 1774, numBytes: 61734712}} avgpoolgrad,
14:41:21.857 +00000ms batchmatmul,
14:41:21.857 +00000ms test start:webgpu fusedbatchnorm,
14:41:21.966 +00109ms {initialized: webgpu} batchtospacend,
14:41:21.966 +00000ms {memory: {numBytesInGPU: 0, numBytesAllocatedInGPU: 0, unreliable: false, numTensors: 1780, numDataBuffers: 1780, numBytes: 61734744}} bincount,
14:41:21.967 +00001ms {validate: []} broadcastargs,
14:41:37.313 +15346ms {warmup: face} cast,
14:41:37.327 +00014ms {input: [1, 1200, 1200, 3]} ceil,
14:41:38.482 +01155ms {detect: true} clipbyvalue,
14:41:38.483 +00001ms {interpolated: true} complex,
14:41:38.483 +00000ms {persons: true} complexabs,
14:41:38.483 +00000ms {summary: {persons: 1, face: 1, body: 1, hand: 0, object: 0, gesture: 1}} concat,
14:41:38.484 +00001ms {performance: {inputProcess: 0, totalFrames: 12, cachedFrames: 9, cacheCheck: 0, total: 1154, initBackend: 89, warmup: 15345}} conv2d,
14:41:41.952 +03468ms {benchmark: {time: 347, cacheSensitivity: 0}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 68}} conv2dbackpropfilter,
14:41:42.769 +00817ms {benchmark: {time: 77, cacheSensitivity: 0.25}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 3, total: 75}} conv2dbackpropinput,
14:41:43.586 +00817ms {benchmark: {time: 77, cacheSensitivity: 0.5}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 3, total: 73}} conv3d,
14:41:44.400 +00814ms {benchmark: {time: 76, cacheSensitivity: 0.75}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 3, total: 71}} conv3dbackpropfilterv2,
14:41:44.833 +00433ms {benchmark: {time: 38, cacheSensitivity: 10}, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 8, cacheCheck: 3, total: 77}} conv3dbackpropinputv2,
14:41:44.887 +00054ms {memory: {numBytesInGPU: 53317336, numBytesAllocatedInGPU: 402364236, unreliable: false, numTensors: 1780, numDataBuffers: 41787, numBytes: 61734744}} cos,
14:41:44.887 +00000ms cosh,
14:41:44.887 +00000ms tests complete cropandresize,
cumprod,
cumsum,
densebincount,
depthtospace,
depthwiseconv2dnative,
depthwiseconv2dnativebackpropfilter,
depthwiseconv2dnativebackpropinput,
diag,
dilation2d,
einsum,
elu,
elugrad,
equal,
erf,
exp,
expanddims,
expm1,
fft,
fill,
flipleftright,
floor,
floordiv,
frompixels,
fusedconv2d,
fuseddepthwiseconv2d,
gathernd,
gatherv2,
greater,
greaterequal,
identity,
ifft,
imag,
isfinite,
isinf,
isnan,
leakyrelu,
less,
lessequal,
linspace,
log,
log1p,
logicaland,
logicalnot,
logicalor,
lrn,
lrngrad,
max,
maximum,
maxpool,
maxpool3d,
maxpool3dgrad,
maxpoolgrad,
maxpoolwithargmax,
mean,
min,
minimum,
mirrorpad,
mod,
multinomial,
multiply,
neg,
nonmaxsuppressionv3,
nonmaxsuppressionv4,
nonmaxsuppressionv5,
notequal,
onehot,
oneslike,
pack,
padv2,
pow,
prelu,
prod,
range,
real,
realdiv,
reciprocal,
relu,
relu6,
reshape,
resizebilinear,
resizebilineargrad,
resizenearestneighbor,
resizenearestneighborgrad,
reverse,
rotatewithoffset,
round,
rsqrt,
scatternd,
searchsorted,
select,
selu,
sigmoid,
sign,
sin,
sinh,
slice,
softmax,
softplus,
spacetobatchnd,
sparsefillemptyrows,
sparsereshape,
sparsesegmentmean,
sparsesegmentsum,
sparsetodense,
splitv,
sqrt,
square,
squareddifference,
step,
stridedslice,
stringngrams,
stringsplit,
stringtohashbucketfast,
sub,
sum,
tan,
tanh,
tile,
topk,
transform,
transpose,
unique,
unpack,
unsortedsegmentsum,
zeroslike,
floormod
]
}
10:13:35.527 +00010ms config {
backend: humangl,
modelBasePath: ../models/,
cacheModels: true,
validateModels: true,
wasmPath: https: //cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.19.0/dist/,
wasmPlatformFetch: false,
debug: true,
async: true,
warmup: none,
cacheSensitivity: 0,
skipAllowed: false,
deallocate: false,
filter: {
enabled: true,
equalization: false,
width: 0,
height: 0,
flip: false,
return: true,
brightness: 0,
contrast: 0,
sharpness: 0,
blur: 0,
saturation: 0,
hue: 0,
negative: false,
sepia: false,
vintage: false,
kodachrome: false,
technicolor: false,
polaroid: false,
pixelate: 0
},
gesture: {
enabled: true
},
face: {
enabled: true,
detector: {
modelPath: blazeface.json,
rotation: true,
maxDetected: 1,
skipFrames: 99,
skipTime: 2500,
minConfidence: 0.2,
iouThreshold: 0.1,
mask: false,
return: false
},
mesh: {
enabled: true,
modelPath: facemesh.json,
keepInvalid: false
},
attention: {
enabled: false,
modelPath: facemesh-attention.json
},
iris: {
enabled: true,
modelPath: iris.json
},
emotion: {
enabled: true,
minConfidence: 0.1,
skipFrames: 99,
skipTime: 1500,
modelPath: emotion.json
},
description: {
enabled: true,
modelPath: faceres.json,
skipFrames: 99,
skipTime: 3000,
minConfidence: 0.1
},
antispoof: {
enabled: false,
skipFrames: 99,
skipTime: 4000,
modelPath: antispoof.json
},
liveness: {
enabled: false,
skipFrames: 99,
skipTime: 4000,
modelPath: liveness.json
}
},
body: {
enabled: true,
modelPath: movenet-lightning.json,
maxDetected: -1,
minConfidence: 0.3,
skipFrames: 1,
skipTime: 200
},
hand: {
enabled: true,
rotation: true,
skipFrames: 99,
skipTime: 1000,
minConfidence: 0.5,
iouThreshold: 0.2,
maxDetected: -1,
landmarks: true,
detector: {
modelPath: handtrack.json
},
skeleton: {
modelPath: handlandmark-full.json
}
},
object: {
enabled: true,
modelPath: mb3-centernet.json,
minConfidence: 0.2,
iouThreshold: 0.4,
maxDetected: 10,
skipFrames: 99,
skipTime: 2000
},
segmentation: {
enabled: false,
modelPath: selfie.json,
blur: 8
}
}
10:13:35.838 +00311ms models [{name: ssrnetage, loaded: false}, {name: gear, loaded: false}, {name: blazeposedetect, loaded: false}, {name: blazepose, loaded: false}, {name: centernet, loaded: true}, {name: efficientpose, loaded: false}, {name: mobilefacenet, loaded: false}, {name: insightface, loaded: false}, {name: emotion, loaded: true}, {name: facedetect, loaded: true}, {name: faceiris, loaded: true}, {name: facemesh, loaded: true}, {name: faceres, loaded: true}, {name: ssrnetgender, loaded: false}, {name: handpose, loaded: false}, {name: handskeleton, loaded: true}, {name: handtrack, loaded: true}, {name: liveness, loaded: false}, {name: movenet, loaded: true}, {name: nanodet, loaded: false}, {name: posenet, loaded: false}, {name: segmentation, loaded: false}, {name: antispoof, loaded: false}]
10:13:35.871 +00033ms
10:13:35.903 +00032ms test start: wasm
10:13:36.129 +00226ms desired wasm detected wasm
10:13:36.162 +00033ms memory {unreliable: false, numTensors: 1763, numDataBuffers: 1763, numBytes: 60948232}
10:13:36.196 +00034ms validate []
10:13:37.456 +01260ms warmup face
10:13:37.559 +00103ms input [1, 1200, 1200, 3]
10:13:38.433 +00874ms detect
10:13:38.471 +00038ms interpolate
10:13:38.522 +00051ms persons
10:13:38.558 +00036ms summary {persons: 1, face: 1, body: 1, hand: 1, object: 1, gesture: 8}
10:13:38.595 +00037ms performance {initBackend: 181, loadModels: 285, inputProcess: 1, totalFrames: 2, cachedFrames: 0, cacheCheck: 0, total: 833, warmup: 1227}
10:13:39.730 +01135ms benchmark {time: 109, cacheSensitivity: 0, performance: {inputProcess: 2, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 50}}
10:13:40.410 +00680ms benchmark {time: 65, cacheSensitivity: 0.25, performance: {inputProcess: 2, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 51}}
10:13:41.083 +00673ms benchmark {time: 64, cacheSensitivity: 0.5, performance: {inputProcess: 2, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 49}}
10:13:41.758 +00675ms benchmark {time: 64, cacheSensitivity: 0.75, performance: {inputProcess: 2, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 48}}
10:13:42.121 +00363ms benchmark {time: 33, cacheSensitivity: 10, performance: {inputProcess: 2, totalFrames: 10, cachedFrames: 8, cacheCheck: 0, total: 48}}
10:13:42.160 +00039ms memory {unreliable: false, numTensors: 1764, numDataBuffers: 1764, numBytes: 61734664}
10:13:42.189 +00029ms
10:13:42.219 +00030ms test start: humangl
10:13:42.253 +00034ms desired humangl detected humangl
10:13:42.281 +00028ms memory {unreliable: false, numBytesInGPU: 0, numBytesInGPUAllocated: 0, numBytesInGPUFree: 0, numTensors: 1770, numDataBuffers: 1770, numBytes: 61734696}
10:13:42.311 +00030ms validate []
10:13:44.370 +02059ms warmup face
10:13:44.433 +00063ms input [1, 1200, 1200, 3]
10:13:46.227 +01794ms detect
10:13:46.260 +00033ms interpolate
10:13:46.301 +00041ms persons
10:13:46.329 +00028ms summary {persons: 0, face: 0, body: 1, hand: 0, object: 0, gesture: 0}
10:13:46.359 +00030ms performance {inputProcess: 0, totalFrames: 12, cachedFrames: 9, cacheCheck: 0, total: 1762, initBackend: 0, warmup: 2026}
10:13:48.486 +02127ms benchmark {time: 209, cacheSensitivity: 0, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 56}}
10:13:49.281 +00795ms benchmark {time: 75, cacheSensitivity: 0.25, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 5, total: 57}}
10:13:50.135 +00854ms benchmark {time: 81, cacheSensitivity: 0.5, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 4, total: 64}}
10:13:51.047 +00912ms benchmark {time: 87, cacheSensitivity: 0.75, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 5, total: 63}}
10:13:51.637 +00590ms benchmark {time: 55, cacheSensitivity: 10, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 8, cacheCheck: 5, total: 61}}
10:13:51.687 +00050ms memory {unreliable: false, numBytesInGPU: 56099560, numBytesInGPUAllocated: 701598940, numBytesInGPUFree: 645499380, numTensors: 1770, numDataBuffers: 1770, numBytes: 61734696}
10:13:51.725 +00038ms
10:13:51.758 +00033ms test start: webgl
10:13:51.804 +00046ms desired webgl detected webgl
10:13:51.845 +00041ms memory {unreliable: false, numBytesInGPU: 0, numBytesInGPUAllocated: 0, numBytesInGPUFree: 0, numTensors: 1776, numDataBuffers: 1776, numBytes: 61734728}
10:13:51.893 +00048ms validate []
10:13:57.083 +05190ms warmup face
10:13:57.160 +00077ms input [1, 1200, 1200, 3]
10:13:57.876 +00716ms detect
10:13:57.916 +00040ms interpolate
10:13:57.960 +00044ms persons
10:13:58.003 +00043ms summary {persons: 1, face: 1, body: 1, hand: 0, object: 0, gesture: 1}
10:13:58.048 +00045ms performance {inputProcess: 0, totalFrames: 12, cachedFrames: 9, cacheCheck: 0, total: 668, initBackend: 0, warmup: 5146}
10:13:59.556 +01508ms benchmark {time: 146, cacheSensitivity: 0, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 122}}
10:14:01.012 +01456ms benchmark {time: 140, cacheSensitivity: 0.25, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 6, total: 130}}
10:14:02.436 +01424ms benchmark {time: 137, cacheSensitivity: 0.5, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 5, total: 127}}
10:14:03.931 +01495ms benchmark {time: 144, cacheSensitivity: 0.75, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 4, total: 137}}
10:14:04.695 +00764ms benchmark {time: 70, cacheSensitivity: 10, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 8, cacheCheck: 5, total: 134}}
10:14:04.756 +00061ms memory {unreliable: false, numBytesInGPU: 56099560, numBytesInGPUAllocated: 701598940, numBytesInGPUFree: 645499380, numTensors: 1776, numDataBuffers: 1776, numBytes: 61734728}
10:14:04.810 +00054ms
10:14:04.865 +00055ms test start: webgpu
10:14:04.956 +00091ms desired webgpu detected webgpu
10:14:05.012 +00056ms memory {numBytesInGPU: 0, numBytesAllocatedInGPU: 0, unreliable: false, numTensors: 1782, numDataBuffers: 1782, numBytes: 61734760}
10:14:05.068 +00056ms validate []
10:14:18.964 +13896ms warmup face
10:14:19.032 +00068ms input [1, 1200, 1200, 3]
10:14:20.109 +01077ms detect
10:14:20.166 +00057ms interpolate
10:14:20.224 +00058ms persons
10:14:20.275 +00051ms summary {persons: 1, face: 1, body: 1, hand: 0, object: 0, gesture: 1}
10:14:20.329 +00054ms performance {inputProcess: 0, totalFrames: 12, cachedFrames: 9, cacheCheck: 0, total: 1025, initBackend: 33, warmup: 13840}
10:14:23.824 +03495ms benchmark {time: 343, cacheSensitivity: 0, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 0, total: 81}}
10:14:24.663 +00839ms benchmark {time: 77, cacheSensitivity: 0.25, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 15, total: 82}}
10:14:25.583 +00920ms benchmark {time: 85, cacheSensitivity: 0.5, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 10, total: 81}}
10:14:26.502 +00919ms benchmark {time: 85, cacheSensitivity: 0.75, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 0, cacheCheck: 12, total: 85}}
10:14:27.041 +00539ms benchmark {time: 46, cacheSensitivity: 10, performance: {inputProcess: 0, totalFrames: 10, cachedFrames: 8, cacheCheck: 9, total: 86}}
10:14:27.123 +00082ms memory {numBytesInGPU: 53317336, numBytesAllocatedInGPU: 402350412, unreliable: false, numTensors: 1782, numDataBuffers: 41789, numBytes: 61734760}
10:14:27.193 +00070ms
10:14:27.261 +00068ms tests complete

View File

@ -1,39 +1,39 @@
2022-08-12 09:50:24 DATA:  Build {"name":"@vladmandic/human","version":"2.9.3"} 2022-08-15 11:28:08 DATA:  Build {"name":"@vladmandic/human","version":"2.9.3"}
2022-08-12 09:50:24 INFO:  Application: {"name":"@vladmandic/human","version":"2.9.3"} 2022-08-15 11:28:08 INFO:  Application: {"name":"@vladmandic/human","version":"2.9.3"}
2022-08-12 09:50:24 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true} 2022-08-15 11:28:08 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2022-08-12 09:50:24 INFO:  Toolchain: {"build":"0.7.9","esbuild":"0.15.1","typescript":"4.7.4","typedoc":"0.23.10","eslint":"8.21.0"} 2022-08-15 11:28:08 INFO:  Toolchain: {"build":"0.7.9","esbuild":"0.15.3","typescript":"4.7.4","typedoc":"0.23.10","eslint":"8.22.0"}
2022-08-12 09:50:24 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]} 2022-08-15 11:28:08 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2022-08-12 09:50:24 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]} 2022-08-15 11:28:08 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
2022-08-12 09:50:24 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":608} 2022-08-15 11:28:08 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":608}
2022-08-12 09:50:24 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":654779,"outputBytes":307161} 2022-08-15 11:28:08 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":655247,"outputBytes":307391}
2022-08-12 09:50:24 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":612} 2022-08-15 11:28:08 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":612}
2022-08-12 09:50:24 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":654783,"outputBytes":307165} 2022-08-15 11:28:08 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":655251,"outputBytes":307395}
2022-08-12 09:50:24 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":664} 2022-08-15 11:28:08 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":664}
2022-08-12 09:50:24 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":654835,"outputBytes":307215} 2022-08-15 11:28:08 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":655303,"outputBytes":307445}
2022-08-12 09:50:24 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1069,"outputBytes":358} 2022-08-15 11:28:08 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1069,"outputBytes":358}
2022-08-12 09:50:24 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1032,"outputBytes":583} 2022-08-15 11:28:08 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1032,"outputBytes":583}
2022-08-12 09:50:24 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":654754,"outputBytes":306014} 2022-08-15 11:28:08 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":655222,"outputBytes":306242}
2022-08-12 09:50:24 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1271,"outputBytes":2787569} 2022-08-15 11:28:09 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1271,"outputBytes":2787569}
2022-08-12 09:50:24 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3441740,"outputBytes":1668900} 2022-08-15 11:28:09 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3442208,"outputBytes":1669116}
2022-08-12 09:50:24 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3441740,"outputBytes":3072630} 2022-08-15 11:28:09 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3442208,"outputBytes":3072985}
2022-08-12 09:50:31 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":30} 2022-08-15 11:28:14 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":30}
2022-08-12 09:50:33 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true} 2022-08-15 11:28:15 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
2022-08-12 09:50:33 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6716,"outputBytes":3141} 2022-08-15 11:28:15 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6716,"outputBytes":3141}
2022-08-12 09:50:33 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15629,"outputBytes":7798} 2022-08-15 11:28:15 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15629,"outputBytes":7798}
2022-08-12 09:50:42 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":109,"errors":0,"warnings":0} 2022-08-15 11:28:24 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":109,"errors":0,"warnings":0}
2022-08-12 09:50:42 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"} 2022-08-15 11:28:24 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2022-08-12 09:50:42 STATE: Copy: {"input":"tfjs/tfjs.esm.d.ts"} 2022-08-15 11:28:24 STATE: Copy: {"input":"tfjs/tfjs.esm.d.ts"}
2022-08-12 09:50:42 INFO:  Done... 2022-08-15 11:28:24 INFO:  Done...
2022-08-12 09:50:42 STATE: API-Extractor: {"succeeeded":true,"errors":0,"warnings":198} 2022-08-15 11:28:24 STATE: API-Extractor: {"succeeeded":true,"errors":0,"warnings":198}
2022-08-12 09:50:42 STATE: Copy: {"input":"types/human.d.ts"} 2022-08-15 11:28:24 STATE: Copy: {"input":"types/human.d.ts"}
2022-08-12 09:50:42 INFO:  Analyze models: {"folders":8,"result":"models/models.json"} 2022-08-15 11:28:24 INFO:  Analyze models: {"folders":8,"result":"models/models.json"}
2022-08-12 09:50:42 STATE: Models {"folder":"./models","models":13} 2022-08-15 11:28:24 STATE: Models {"folder":"./models","models":13}
2022-08-12 09:50:42 STATE: Models {"folder":"../human-models/models","models":42} 2022-08-15 11:28:24 STATE: Models {"folder":"../human-models/models","models":42}
2022-08-12 09:50:42 STATE: Models {"folder":"../blazepose/model/","models":4} 2022-08-15 11:28:24 STATE: Models {"folder":"../blazepose/model/","models":4}
2022-08-12 09:50:42 STATE: Models {"folder":"../anti-spoofing/model","models":1} 2022-08-15 11:28:24 STATE: Models {"folder":"../anti-spoofing/model","models":1}
2022-08-12 09:50:42 STATE: Models {"folder":"../efficientpose/models","models":3} 2022-08-15 11:28:24 STATE: Models {"folder":"../efficientpose/models","models":3}
2022-08-12 09:50:42 STATE: Models {"folder":"../insightface/models","models":5} 2022-08-15 11:28:24 STATE: Models {"folder":"../insightface/models","models":5}
2022-08-12 09:50:42 STATE: Models {"folder":"../movenet/models","models":3} 2022-08-15 11:28:24 STATE: Models {"folder":"../movenet/models","models":3}
2022-08-12 09:50:42 STATE: Models {"folder":"../nanodet/models","models":4} 2022-08-15 11:28:24 STATE: Models {"folder":"../nanodet/models","models":4}
2022-08-12 09:50:43 STATE: Models: {"count":57,"totalSize":383017442} 2022-08-15 11:28:25 STATE: Models: {"count":57,"totalSize":383017442}
2022-08-12 09:50:43 INFO:  Human Build complete... {"logFile":"test/build.log"} 2022-08-15 11:28:25 INFO:  Human Build complete... {"logFile":"test/build.log"}

View File

@ -5,7 +5,7 @@ const { fork } = require('child_process');
const log = require('@vladmandic/pilogger'); const log = require('@vladmandic/pilogger');
let logFile = 'test.log'; let logFile = 'test.log';
log.configure({ inspect: { breakLength: 500 } }); log.configure({ inspect: { breakLength: 350 } });
const tests = [ const tests = [
'test-node.js', 'test-node.js',

View File

@ -12,7 +12,8 @@ const log = (status, ...data) => {
}; };
process.on('uncaughtException', (err) => { process.on('uncaughtException', (err) => {
log('error', 'uncaughtException', lastOp, err); log('error', 'uncaughtException', lastOp, err); // abort immediately
process.exit(1);
}); });
async function testHTTP() { async function testHTTP() {
@ -74,12 +75,17 @@ async function testInstance(human) {
log('info', 'human version:', human.version); log('info', 'human version:', human.version);
log('info', 'platform:', human.env.platform, 'agent:', human.env.agent); log('info', 'platform:', human.env.platform, 'agent:', human.env.agent);
log('info', 'tfjs version:', human.tf.version.tfjs); log('info', 'tfjs version:', human.tf.version.tfjs);
const bindingVer = human.tf.backend()['binding'] ? human.tf.backend()['binding']['TF_Version'] : null; const env = JSON.parse(JSON.stringify(human.env));
if (bindingVer) log('info', 'tensorflow binding version:', bindingVer); env.kernels = human.env.kernels.length;
log('info', 'env:', env);
await human.load(); await human.load();
if (config.backend === human.tf.getBackend()) log('state', 'passed: set backend:', config.backend); if (config.backend === human.tf.getBackend()) {
else log('error', 'failed: set backend:', config.backend); log('state', 'passed: set backend:', config.backend);
} else {
log('error', 'failed: set backend:', config.backend); // abort immediately
return false;
}
log('state', 'tensors', human.tf.memory().numTensors); log('state', 'tensors', human.tf.memory().numTensors);
if (human.models) { if (human.models) {
@ -296,7 +302,11 @@ async function test(Human, inputConfig) {
// test warmup sequences // test warmup sequences
log('info', 'test: warmup'); log('info', 'test: warmup');
await testInstance(human); res = await testInstance(human);
if (!res) {
log('error', 'failed: instance backend:', human.tf.getBackend());
return;
}
config.cacheSensitivity = 0; config.cacheSensitivity = 0;
config.warmup = 'none'; config.warmup = 'none';
res = await testWarmup(human, 'default'); res = await testWarmup(human, 'default');
@ -475,7 +485,7 @@ async function test(Human, inputConfig) {
// test face attention // test face attention
log('info', 'test face attention'); log('info', 'test face attention');
human.models.facemesh = null; human.models.facemesh = null;
config.face.attention = { enabled: true }; config.face.attention = { enabled: true, modelPath: 'https://vladmandic.github.io/human-models/models/facemesh-attention.json' };
res = await testDetect(human, 'samples/in/ai-face.jpg', 'face attention'); res = await testDetect(human, 'samples/in/ai-face.jpg', 'face attention');
if (!res || !res.face[0] || res.face[0].mesh.length !== 478 || Object.keys(res.face[0].annotations).length !== 36) log('error', 'failed: face attention', { mesh: res.face?.[0]?.mesh?.length, annotations: Object.keys(res.face?.[0]?.annotations | {}).length }); if (!res || !res.face[0] || res.face[0].mesh.length !== 478 || Object.keys(res.face[0].annotations).length !== 36) log('error', 'failed: face attention', { mesh: res.face?.[0]?.mesh?.length, annotations: Object.keys(res.face?.[0]?.annotations | {}).length });
else log('state', 'passed: face attention'); else log('state', 'passed: face attention');

View File

@ -1,5 +1,5 @@
process.env.TF_CPP_MIN_LOG_LEVEL = '2'; process.env.TF_CPP_MIN_LOG_LEVEL = '2';
const Human = require('../dist/human.node-gpu.js').default; const H = require('../dist/human.node-gpu.js');
const test = require('./test-main.js').test; const test = require('./test-main.js').test;
const config = { const config = {
@ -25,4 +25,8 @@ const config = {
filter: { enabled: false }, filter: { enabled: false },
}; };
test(Human, config); async function main() {
test(H.Human, config);
}
main();

View File

@ -1,20 +1,21 @@
const log = require('@vladmandic/pilogger');
const tf = require('@tensorflow/tfjs'); // wasm backend requires tfjs to be loaded first const tf = require('@tensorflow/tfjs'); // wasm backend requires tfjs to be loaded first
const wasm = require('@tensorflow/tfjs-backend-wasm'); // wasm backend does not get auto-loaded in nodejs const wasm = require('@tensorflow/tfjs-backend-wasm'); // wasm backend does not get auto-loaded in nodejs
const { Canvas, Image } = require('canvas'); const { Canvas, Image } = require('canvas');
const Human = require('../dist/human.node-wasm.js'); const H = require('../dist/human.node-wasm.js');
const test = require('./test-main.js').test; const test = require('./test-main.js').test;
// @ts-ignore // @ts-ignore
Human.env.Canvas = Canvas; // requires monkey-patch as wasm does not have tf.browser namespace H.env.Canvas = Canvas; // requires monkey-patch as wasm does not have tf.browser namespace
// @ts-ignore // @ts-ignore
Human.env.Image = Image; // requires monkey-patch as wasm does not have tf.browser namespace H.env.Image = Image; // requires monkey-patch as wasm does not have tf.browser namespace
const config = { const config = {
cacheSensitivity: 0, cacheSensitivity: 0,
modelBasePath: 'https://vladmandic.github.io/human/models/', modelBasePath: 'https://vladmandic.github.io/human/models/',
backend: 'wasm', backend: 'wasm',
wasmPath: 'node_modules/@tensorflow/tfjs-backend-wasm/dist/', // wasmPath: 'node_modules/@tensorflow/tfjs-backend-wasm/dist/',
// wasmPath: `cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${tf.version_core}/dist/`, wasmPath: `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${tf.version_core}/dist/`,
debug: false, debug: false,
async: false, async: false,
face: { face: {
@ -38,7 +39,9 @@ async function main() {
wasm.setWasmPaths(config.wasmPath); wasm.setWasmPaths(config.wasmPath);
await tf.setBackend('wasm'); await tf.setBackend('wasm');
await tf.ready(); await tf.ready();
test(Human.Human, config); H.env.updateBackend();
log.info(H.env.wasm);
test(H.Human, config);
} }
main(); main();

View File

@ -1,5 +1,6 @@
process.env.TF_CPP_MIN_LOG_LEVEL = '2'; process.env.TF_CPP_MIN_LOG_LEVEL = '2';
const Human = require('../dist/human.node.js').default;
const H = require('../dist/human.node.js');
const test = require('./test-main.js').test; const test = require('./test-main.js').test;
const config = { const config = {
@ -25,4 +26,8 @@ const config = {
filter: { enabled: false }, filter: { enabled: false },
}; };
test(Human, config); async function main() {
test(H.Human, config);
}
main();

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -47,6 +47,7 @@
<a href="Env.html#offscreen" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>offscreen</span></a> <a href="Env.html#offscreen" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>offscreen</span></a>
<a href="Env.html#perfadd" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>perfadd</span></a> <a href="Env.html#perfadd" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>perfadd</span></a>
<a href="Env.html#platform" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>platform</span></a> <a href="Env.html#platform" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>platform</span></a>
<a href="Env.html#tensorflow" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>tensorflow</span></a>
<a href="Env.html#tfjs" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>tfjs</span></a> <a href="Env.html#tfjs" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>tfjs</span></a>
<a href="Env.html#wasm" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>wasm</span></a> <a href="Env.html#wasm" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>wasm</span></a>
<a href="Env.html#webgl" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>webgl</span></a> <a href="Env.html#webgl" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>webgl</span></a>
@ -67,7 +68,7 @@
<li class="tsd-description"> <li class="tsd-description">
<h4 class="tsd-returns-title">Returns <a href="Env.html" class="tsd-signature-type" data-tsd-kind="Class">Env</a></h4><aside class="tsd-sources"> <h4 class="tsd-returns-title">Returns <a href="Env.html" class="tsd-signature-type" data-tsd-kind="Class">Env</a></h4><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L81">src/util/env.ts:81</a></li></ul></aside></li></ul></section></section> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L85">src/util/env.ts:85</a></li></ul></aside></li></ul></section></section>
<section class="tsd-panel-group tsd-member-group"> <section class="tsd-panel-group tsd-member-group">
<h2>Properties</h2> <h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="Canvas" class="tsd-anchor"></a> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="Canvas" class="tsd-anchor"></a>
@ -76,21 +77,21 @@
<div class="tsd-comment tsd-typography"><p>MonkeyPatch for Canvas</p> <div class="tsd-comment tsd-typography"><p>MonkeyPatch for Canvas</p>
</div><aside class="tsd-sources"> </div><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L75">src/util/env.ts:75</a></li></ul></aside></section> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L79">src/util/env.ts:79</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="Image" class="tsd-anchor"></a> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="Image" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>Image</span><a href="#Image" 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> <h3 class="tsd-anchor-link"><span>Image</span><a href="#Image" 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>
<div class="tsd-signature">Image<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span></div> <div class="tsd-signature">Image<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span></div>
<div class="tsd-comment tsd-typography"><p>MonkeyPatch for Image</p> <div class="tsd-comment tsd-typography"><p>MonkeyPatch for Image</p>
</div><aside class="tsd-sources"> </div><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L77">src/util/env.ts:77</a></li></ul></aside></section> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L81">src/util/env.ts:81</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="ImageData" class="tsd-anchor"></a> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="ImageData" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>Image<wbr/>Data</span><a href="#ImageData" 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> <h3 class="tsd-anchor-link"><span>Image<wbr/>Data</span><a href="#ImageData" 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>
<div class="tsd-signature">Image<wbr/>Data<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span></div> <div class="tsd-signature">Image<wbr/>Data<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span></div>
<div class="tsd-comment tsd-typography"><p>MonkeyPatch for ImageData</p> <div class="tsd-comment tsd-typography"><p>MonkeyPatch for ImageData</p>
</div><aside class="tsd-sources"> </div><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L79">src/util/env.ts:79</a></li></ul></aside></section> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L83">src/util/env.ts:83</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="agent" class="tsd-anchor"></a> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="agent" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>agent</span><a href="#agent" 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> <h3 class="tsd-anchor-link"><span>agent</span><a href="#agent" 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>
<div class="tsd-signature">agent<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = &#39;&#39;</span></div> <div class="tsd-signature">agent<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = &#39;&#39;</span></div>
@ -125,7 +126,7 @@
<li class="tsd-parameter"> <li class="tsd-parameter">
<h5>model<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5></li></ul></div><aside class="tsd-sources"> <h5>model<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5></li></ul></div><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L65">src/util/env.ts:65</a></li></ul></aside></section> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L69">src/util/env.ts:69</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="filter" class="tsd-anchor"></a> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="filter" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>filter</span><a href="#filter" 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> <h3 class="tsd-anchor-link"><span>filter</span><a href="#filter" 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>
<div class="tsd-signature">filter<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></div> <div class="tsd-signature">filter<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></div>
@ -146,7 +147,7 @@
<div class="tsd-comment tsd-typography"><p>List of supported kernels for current backend</p> <div class="tsd-comment tsd-typography"><p>List of supported kernels for current backend</p>
</div><aside class="tsd-sources"> </div><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L73">src/util/env.ts:73</a></li></ul></aside></section> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L77">src/util/env.ts:77</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="node" class="tsd-anchor"></a> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="node" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>node</span><a href="#node" 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> <h3 class="tsd-anchor-link"><span>node</span><a href="#node" 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>
<div class="tsd-signature">node<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <div class="tsd-signature">node<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
@ -175,6 +176,18 @@
</div><aside class="tsd-sources"> </div><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L13">src/util/env.ts:13</a></li></ul></aside></section> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L13">src/util/env.ts:13</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="tensorflow" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>tensorflow</span><a href="#tensorflow" 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>
<div class="tsd-signature">tensorflow<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>version<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><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></div>
<div class="tsd-comment tsd-typography"><p>If using tfjs-node get version of underlying tensorflow shared library</p>
</div>
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5>version<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5></li></ul></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L31">src/util/env.ts:31</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="tfjs" class="tsd-anchor"></a> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="tfjs" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>tfjs</span><a href="#tfjs" 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> <h3 class="tsd-anchor-link"><span>tfjs</span><a href="#tfjs" 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>
<div class="tsd-signature">tfjs<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>version<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></div> <div class="tsd-signature">tfjs<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>version<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></div>
@ -204,7 +217,7 @@
<li class="tsd-parameter"> <li class="tsd-parameter">
<h5>supported<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></h5></li></ul></div><aside class="tsd-sources"> <h5>supported<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></h5></li></ul></div><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L31">src/util/env.ts:31</a></li></ul></aside></section> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L35">src/util/env.ts:35</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="webgl" class="tsd-anchor"></a> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="webgl" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>webgl</span><a href="#webgl" 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> <h3 class="tsd-anchor-link"><span>webgl</span><a href="#webgl" 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>
<div class="tsd-signature">webgl<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>backend<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>renderer<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>supported<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>version<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><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></div> <div class="tsd-signature">webgl<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>backend<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>renderer<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>supported<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>version<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><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></div>
@ -222,7 +235,7 @@
<li class="tsd-parameter"> <li class="tsd-parameter">
<h5>version<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5></li></ul></div><aside class="tsd-sources"> <h5>version<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5></li></ul></div><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L43">src/util/env.ts:43</a></li></ul></aside></section> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L47">src/util/env.ts:47</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="webgpu" class="tsd-anchor"></a> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="webgpu" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>webgpu</span><a href="#webgpu" 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> <h3 class="tsd-anchor-link"><span>webgpu</span><a href="#webgpu" 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>
<div class="tsd-signature">webgpu<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>adapter<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>backend<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>supported<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></div> <div class="tsd-signature">webgpu<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>adapter<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>backend<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>supported<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></div>
@ -238,7 +251,7 @@
<li class="tsd-parameter"> <li class="tsd-parameter">
<h5>supported<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></h5></li></ul></div><aside class="tsd-sources"> <h5>supported<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></h5></li></ul></div><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L55">src/util/env.ts:55</a></li></ul></aside></section> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L59">src/util/env.ts:59</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="worker" class="tsd-anchor"></a> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="worker" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>worker</span><a href="#worker" 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> <h3 class="tsd-anchor-link"><span>worker</span><a href="#worker" 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>
<div class="tsd-signature">worker<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <div class="tsd-signature">worker<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
@ -257,7 +270,7 @@
</div> </div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L114">src/util/env.ts:114</a></li></ul></aside></li></ul></section> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L119">src/util/env.ts:119</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="updateCPU" class="tsd-anchor"></a> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="updateCPU" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>updateCPU</span><a href="#updateCPU" 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> <h3 class="tsd-anchor-link"><span>updateCPU</span><a href="#updateCPU" 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"> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
@ -267,7 +280,7 @@
</div> </div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L151">src/util/env.ts:151</a></li></ul></aside></li></ul></section></section></div> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L157">src/util/env.ts:157</a></li></ul></aside></li></ul></section></section></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings"> <div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary"> <details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
@ -309,6 +322,7 @@
<li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#offscreen" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>offscreen</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#offscreen" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>offscreen</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#perfadd" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>perfadd</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#perfadd" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>perfadd</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#platform" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>platform</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#platform" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>platform</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#tensorflow" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>tensorflow</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#tfjs" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>tfjs</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#tfjs" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>tfjs</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#wasm" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>wasm</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#wasm" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>wasm</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#webgl" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>webgl</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="Env.html#webgl" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>webgl</a></li>

View File

@ -15,7 +15,7 @@
<h1>Variable env<code class="tsd-tag ts-flagConst">Const</code> </h1></div> <h1>Variable env<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
<div class="tsd-signature">env<span class="tsd-signature-symbol">:</span> <a href="../classes/Env.html" class="tsd-signature-type" data-tsd-kind="Class">Env</a><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"> <div class="tsd-signature">env<span class="tsd-signature-symbol">:</span> <a href="../classes/Env.html" class="tsd-signature-type" data-tsd-kind="Class">Env</a><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources">
<ul> <ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L170">src/util/env.ts:170</a></li></ul></aside></div> <li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/util/env.ts#L176">src/util/env.ts:176</a></li></ul></aside></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings"> <div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary"> <details class="tsd-index-accordion"><summary class="tsd-accordion-summary">

4
types/human.d.ts vendored
View File

@ -449,6 +449,10 @@ export declare class Env {
offscreen: undefined | boolean; offscreen: undefined | boolean;
/** Are performance counter instant values or additive */ /** Are performance counter instant values or additive */
perfadd: boolean; perfadd: boolean;
/** If using tfjs-node get version of underlying tensorflow shared library */
tensorflow: {
version: undefined | string;
};
/** WASM detected capabilities */ /** WASM detected capabilities */
wasm: { wasm: {
supported: undefined | boolean; supported: undefined | boolean;