mirror of https://github.com/vladmandic/human
add config flags
parent
398aefcad5
commit
15b50f2181
1
TODO.md
1
TODO.md
|
@ -88,6 +88,7 @@ Enable via `about:config` -> `gfx.offscreencanvas.enabled`
|
||||||
Run using: `demo/browser.html`
|
Run using: `demo/browser.html`
|
||||||
Runs tests for `webgl`, `humangl`, `webgpu` and `wasm`
|
Runs tests for `webgl`, `humangl`, `webgpu` and `wasm`
|
||||||
Runs tests for ESM and IIFE versions of library
|
Runs tests for ESM and IIFE versions of library
|
||||||
|
- Add `config.flags` settings to allow setting of custom **TFJS** flags during backend configuration
|
||||||
- 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 profiling methods in `human.profile()`
|
- Update profiling methods in `human.profile()`
|
||||||
|
|
10
package.json
10
package.json
|
@ -76,16 +76,16 @@
|
||||||
"@tensorflow/tfjs-node": "^3.20.0",
|
"@tensorflow/tfjs-node": "^3.20.0",
|
||||||
"@tensorflow/tfjs-node-gpu": "^3.20.0",
|
"@tensorflow/tfjs-node-gpu": "^3.20.0",
|
||||||
"@tensorflow/tfjs-tflite": "0.0.1-alpha.8",
|
"@tensorflow/tfjs-tflite": "0.0.1-alpha.8",
|
||||||
"@types/node": "^18.7.14",
|
"@types/node": "^18.7.15",
|
||||||
"@types/offscreencanvas": "^2019.7.0",
|
"@types/offscreencanvas": "^2019.7.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.36.1",
|
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
||||||
"@typescript-eslint/parser": "^5.36.1",
|
"@typescript-eslint/parser": "^5.36.2",
|
||||||
"@vladmandic/build": "^0.7.11",
|
"@vladmandic/build": "^0.7.11",
|
||||||
"@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",
|
||||||
"canvas": "^2.9.3",
|
"canvas": "^2.10.0",
|
||||||
"esbuild": "^0.15.6",
|
"esbuild": "^0.15.7",
|
||||||
"eslint": "8.23.0",
|
"eslint": "8.23.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",
|
||||||
|
|
|
@ -286,6 +286,9 @@ export interface Config {
|
||||||
*/
|
*/
|
||||||
cacheSensitivity: number;
|
cacheSensitivity: number;
|
||||||
|
|
||||||
|
/** Explicit flags passed to initialize TFJS */
|
||||||
|
flags: Record<string, unknown>,
|
||||||
|
|
||||||
/** Software Kernels
|
/** Software Kernels
|
||||||
* Registers software kernel ops running on CPU when accelerated version of kernel is not found in the current backend
|
* Registers software kernel ops running on CPU when accelerated version of kernel is not found in the current backend
|
||||||
*/
|
*/
|
||||||
|
@ -333,6 +336,7 @@ const config: Config = {
|
||||||
cacheSensitivity: 0.70,
|
cacheSensitivity: 0.70,
|
||||||
skipAllowed: false,
|
skipAllowed: false,
|
||||||
deallocate: false,
|
deallocate: false,
|
||||||
|
flags: {},
|
||||||
softwareKernels: false,
|
softwareKernels: false,
|
||||||
filter: {
|
filter: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|
|
@ -164,7 +164,7 @@ export async function check(instance: Human, force = false) {
|
||||||
// if (tf.env().flagRegistry.USE_SETTIMEOUTCUSTOM) tf.env().set('USE_SETTIMEOUTCUSTOM', true); // default=false <https://github.com/tensorflow/tfjs/issues/6687>
|
// if (tf.env().flagRegistry.USE_SETTIMEOUTCUSTOM) tf.env().set('USE_SETTIMEOUTCUSTOM', true); // default=false <https://github.com/tensorflow/tfjs/issues/6687>
|
||||||
// if (tf.env().flagRegistry.CPU_HANDOFF_SIZE_THRESHOLD) tf.env().set('CPU_HANDOFF_SIZE_THRESHOLD', 1024); // default=1000
|
// if (tf.env().flagRegistry.CPU_HANDOFF_SIZE_THRESHOLD) tf.env().set('CPU_HANDOFF_SIZE_THRESHOLD', 1024); // default=1000
|
||||||
// if (tf.env().flagRegistry['WEBGL_FORCE_F16_TEXTURES'] && !instance.config.object.enabled) tf.env().set('WEBGL_FORCE_F16_TEXTURES', true); // safe to use 16bit precision
|
// if (tf.env().flagRegistry['WEBGL_FORCE_F16_TEXTURES'] && !instance.config.object.enabled) tf.env().set('WEBGL_FORCE_F16_TEXTURES', true); // safe to use 16bit precision
|
||||||
if (typeof instance.config.deallocate !== 'undefined' && instance.config.deallocate) { // hidden param
|
if (instance.config.debug && typeof instance.config.deallocate !== 'undefined' && instance.config.deallocate) { // hidden param
|
||||||
log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', true);
|
log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', true);
|
||||||
tf.env().set('WEBGL_DELETE_TEXTURE_THRESHOLD', 0);
|
tf.env().set('WEBGL_DELETE_TEXTURE_THRESHOLD', 0);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,14 @@ export async function check(instance: Human, force = false) {
|
||||||
if (defaultFlags[key] === newFlags[key]) continue;
|
if (defaultFlags[key] === newFlags[key]) continue;
|
||||||
updatedFlags[key] = newFlags[key];
|
updatedFlags[key] = newFlags[key];
|
||||||
}
|
}
|
||||||
if (Object.keys(updatedFlags).length > 0) log('backend:', tf.getBackend(), 'flags:', updatedFlags);
|
if (instance.config.debug && Object.keys(updatedFlags).length > 0) log('backend:', tf.getBackend(), 'flags:', updatedFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (instance.config.flags && Object.keys(instance.config.flags).length > 0) {
|
||||||
|
if (instance.config.debug) log('flags:', instance.config['flags']);
|
||||||
|
for (const [key, val] of Object.entries(instance.config.flags)) {
|
||||||
|
tf.env().set(key, val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tf.enableProdMode();
|
tf.enableProdMode();
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
2022-09-03 17:17:20 [32mDATA: [39m Build {"name":"@vladmandic/human","version":"2.10.0"}
|
2022-09-06 10:28:18 [32mDATA: [39m Build {"name":"@vladmandic/human","version":"2.10.0"}
|
||||||
2022-09-03 17:17:20 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"2.10.0"}
|
2022-09-06 10:28:18 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"2.10.0"}
|
||||||
2022-09-03 17:17:20 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
2022-09-06 10:28:18 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||||
2022-09-03 17:17:20 [36mINFO: [39m Toolchain: {"build":"0.7.11","esbuild":"0.15.6","typescript":"4.8.2","typedoc":"0.23.14","eslint":"8.23.0"}
|
2022-09-06 10:28:18 [36mINFO: [39m Toolchain: {"build":"0.7.11","esbuild":"0.15.7","typescript":"4.8.2","typedoc":"0.23.14","eslint":"8.23.0"}
|
||||||
2022-09-03 17:17:20 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
2022-09-06 10:28:18 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
|
2022-09-06 10:28:18 [35mSTATE:[39m Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":159,"outputBytes":608}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":159,"outputBytes":608}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":656537,"outputBytes":308492}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":656961,"outputBytes":308696}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":167,"outputBytes":612}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":167,"outputBytes":612}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":656541,"outputBytes":308496}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":656965,"outputBytes":308700}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":206,"outputBytes":664}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":206,"outputBytes":664}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":656593,"outputBytes":308546}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":657017,"outputBytes":308750}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1125,"outputBytes":358}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1125,"outputBytes":358}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1088,"outputBytes":583}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1088,"outputBytes":583}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":656512,"outputBytes":307366}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":656936,"outputBytes":307570}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1344,"outputBytes":2821914}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1344,"outputBytes":2821914}
|
||||||
2022-09-03 17:17:20 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3477843,"outputBytes":1687572}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3478267,"outputBytes":1687773}
|
||||||
2022-09-03 17:17:21 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3477843,"outputBytes":3108530}
|
2022-09-06 10:28:18 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3478267,"outputBytes":3108879}
|
||||||
2022-09-03 17:17:25 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types/lib","files":30}
|
2022-09-06 10:28:23 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types/lib","files":30}
|
||||||
2022-09-03 17:17:27 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
|
2022-09-06 10:28:25 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
|
||||||
2022-09-03 17:17:27 [35mSTATE:[39m Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6714,"outputBytes":3134}
|
2022-09-06 10:28:25 [35mSTATE:[39m Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6714,"outputBytes":3134}
|
||||||
2022-09-03 17:17:27 [35mSTATE:[39m Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15488,"outputBytes":7788}
|
2022-09-06 10:28:25 [35mSTATE:[39m Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15488,"outputBytes":7788}
|
||||||
2022-09-03 17:17:38 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":110,"errors":0,"warnings":0}
|
2022-09-06 10:28:35 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":110,"errors":0,"warnings":0}
|
||||||
2022-09-03 17:17:38 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
2022-09-06 10:28:36 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||||
2022-09-03 17:17:38 [35mSTATE:[39m Copy: {"input":"tfjs/tfjs.esm.d.ts"}
|
2022-09-06 10:28:36 [35mSTATE:[39m Copy: {"input":"tfjs/tfjs.esm.d.ts"}
|
||||||
2022-09-03 17:17:38 [36mINFO: [39m Done...
|
2022-09-06 10:28:36 [36mINFO: [39m Done...
|
||||||
2022-09-03 17:17:39 [35mSTATE:[39m API-Extractor: {"succeeeded":true,"errors":0,"warnings":193}
|
2022-09-06 10:28:36 [35mSTATE:[39m API-Extractor: {"succeeeded":true,"errors":0,"warnings":193}
|
||||||
2022-09-03 17:17:39 [35mSTATE:[39m Copy: {"input":"types/human.d.ts"}
|
2022-09-06 10:28:36 [35mSTATE:[39m Copy: {"input":"types/human.d.ts"}
|
||||||
2022-09-03 17:17:39 [36mINFO: [39m Analyze models: {"folders":8,"result":"models/models.json"}
|
2022-09-06 10:28:36 [36mINFO: [39m Analyze models: {"folders":8,"result":"models/models.json"}
|
||||||
2022-09-03 17:17:39 [35mSTATE:[39m Models {"folder":"./models","models":13}
|
2022-09-06 10:28:36 [35mSTATE:[39m Models {"folder":"./models","models":13}
|
||||||
2022-09-03 17:17:39 [35mSTATE:[39m Models {"folder":"../human-models/models","models":42}
|
2022-09-06 10:28:36 [35mSTATE:[39m Models {"folder":"../human-models/models","models":42}
|
||||||
2022-09-03 17:17:39 [35mSTATE:[39m Models {"folder":"../blazepose/model/","models":4}
|
2022-09-06 10:28:36 [35mSTATE:[39m Models {"folder":"../blazepose/model/","models":4}
|
||||||
2022-09-03 17:17:39 [35mSTATE:[39m Models {"folder":"../anti-spoofing/model","models":1}
|
2022-09-06 10:28:36 [35mSTATE:[39m Models {"folder":"../anti-spoofing/model","models":1}
|
||||||
2022-09-03 17:17:39 [35mSTATE:[39m Models {"folder":"../efficientpose/models","models":3}
|
2022-09-06 10:28:36 [35mSTATE:[39m Models {"folder":"../efficientpose/models","models":3}
|
||||||
2022-09-03 17:17:39 [35mSTATE:[39m Models {"folder":"../insightface/models","models":5}
|
2022-09-06 10:28:36 [35mSTATE:[39m Models {"folder":"../insightface/models","models":5}
|
||||||
2022-09-03 17:17:39 [35mSTATE:[39m Models {"folder":"../movenet/models","models":3}
|
2022-09-06 10:28:36 [35mSTATE:[39m Models {"folder":"../movenet/models","models":3}
|
||||||
2022-09-03 17:17:39 [35mSTATE:[39m Models {"folder":"../nanodet/models","models":4}
|
2022-09-06 10:28:36 [35mSTATE:[39m Models {"folder":"../nanodet/models","models":4}
|
||||||
2022-09-03 17:17:40 [35mSTATE:[39m Models: {"count":57,"totalSize":383017442}
|
2022-09-06 10:28:37 [35mSTATE:[39m Models: {"count":57,"totalSize":383017442}
|
||||||
2022-09-03 17:17:40 [36mINFO: [39m Human Build complete... {"logFile":"test/build.log"}
|
2022-09-06 10:28:37 [36mINFO: [39m Human Build complete... {"logFile":"test/build.log"}
|
||||||
|
|
Loading…
Reference in New Issue