mirror of https://github.com/vladmandic/human
dynamically generate default wasm path
parent
494a845821
commit
34046f0528
|
@ -9,8 +9,9 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2021/08/20 mandic00@live.com
|
||||
### **HEAD -> main** 2021/08/23 mandic00@live.com
|
||||
|
||||
- implement finger poses in hand detection and gestures
|
||||
- implemented movenet-multipose model
|
||||
|
||||
### **2.1.4** 2021/08/19 mandic00@live.com
|
||||
|
|
|
@ -159,7 +159,7 @@ Simply load `Human` (*IIFE version*) directly from a cloud CDN in your HTML file
|
|||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/@vladmandic/human/dist/human.js"></script>
|
||||
<script src="https://unpkg.dev/@vladmandic/human/dist/human.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/human/1.4.1/human.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/human/2.1.4/human.js"></script>
|
||||
```
|
||||
|
||||
For details, including how to use `Browser ESM` version or `NodeJS` version of `Human`, see [**Installation**](https://github.com/vladmandic/human/wiki/Install)
|
||||
|
|
|
@ -16,7 +16,7 @@ const userConfig = {
|
|||
profile: false,
|
||||
warmup: 'full',
|
||||
modelBasePath: '../../models/',
|
||||
wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.8.0/dist/',
|
||||
// wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.9.0/dist/',
|
||||
filter: { enabled: false },
|
||||
face: { enabled: true,
|
||||
detector: { rotation: false, maxDetected: 1 },
|
||||
|
|
|
@ -14,7 +14,7 @@ const userConfig = {
|
|||
warmup: 'none',
|
||||
debug: true,
|
||||
modelBasePath: '../../models/',
|
||||
wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.8.0/dist/',
|
||||
// wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.9.0/dist/',
|
||||
face: {
|
||||
enabled: true,
|
||||
detector: { rotation: true, return: true },
|
||||
|
|
|
@ -32,8 +32,8 @@ let human;
|
|||
let userConfig = {
|
||||
warmup: 'none',
|
||||
backend: 'humangl',
|
||||
wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.8.0/dist/',
|
||||
/*
|
||||
wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.9.0/dist/',
|
||||
async: false,
|
||||
cacheSensitivity: 0,
|
||||
filter: {
|
||||
|
@ -947,6 +947,8 @@ async function main() {
|
|||
|
||||
// create instance of human
|
||||
human = new Human(userConfig);
|
||||
log('human version:', Human.version);
|
||||
log('tfjs version:', human.tf.version.tfjs);
|
||||
userConfig = { ...human.config, ...userConfig };
|
||||
if (typeof tf !== 'undefined') {
|
||||
// eslint-disable-next-line no-undef
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -122,7 +122,7 @@ function mergeDeep(...objects) {
|
|||
var config = {
|
||||
backend: "webgl",
|
||||
modelBasePath: "../models/",
|
||||
wasmPath: "../node_modules/@tensorflow/tfjs-backend-wasm/dist/",
|
||||
wasmPath: "",
|
||||
debug: true,
|
||||
async: true,
|
||||
warmup: "full",
|
||||
|
@ -11796,7 +11796,7 @@ var version = "2.1.4";
|
|||
|
||||
// src/human.ts
|
||||
var _numTensors, _analyzeMemoryLeaks, _checkSanity, _firstRun, _lastInputSum, _lastCacheDiff, _sanity, _checkBackend, _skipFrame, _warmupBitmap, _warmupCanvas, _warmupNode;
|
||||
var Human = class {
|
||||
var _Human = class {
|
||||
constructor(userConfig) {
|
||||
__privateAdd(this, _numTensors, void 0);
|
||||
__privateAdd(this, _analyzeMemoryLeaks, void 0);
|
||||
|
@ -11998,10 +11998,12 @@ var Human = class {
|
|||
}
|
||||
return res;
|
||||
});
|
||||
_Human.version = version;
|
||||
Object.defineProperty(this, "version", { value: version });
|
||||
config.wasmPath = `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${tf21.version_core}/dist/`;
|
||||
this.config = mergeDeep(config, userConfig || {});
|
||||
this.tf = tf21;
|
||||
this.draw = draw_exports;
|
||||
this.version = version;
|
||||
this.state = "idle";
|
||||
__privateSet(this, _numTensors, 0);
|
||||
__privateSet(this, _analyzeMemoryLeaks, false);
|
||||
|
@ -12051,7 +12053,7 @@ var Human = class {
|
|||
this.config = mergeDeep(this.config, userConfig);
|
||||
if (__privateGet(this, _firstRun)) {
|
||||
if (this.config.debug)
|
||||
log(`version: ${this.version}`);
|
||||
log(`version: ${_Human.version}`);
|
||||
if (this.config.debug)
|
||||
log(`tfjs version: ${this.tf.version_core}`);
|
||||
if (this.config.debug)
|
||||
|
@ -12253,6 +12255,7 @@ var Human = class {
|
|||
return res;
|
||||
}
|
||||
};
|
||||
var Human = _Human;
|
||||
_numTensors = new WeakMap();
|
||||
_analyzeMemoryLeaks = new WeakMap();
|
||||
_checkSanity = new WeakMap();
|
||||
|
|
|
@ -123,7 +123,7 @@ function mergeDeep(...objects) {
|
|||
var config = {
|
||||
backend: "webgl",
|
||||
modelBasePath: "../models/",
|
||||
wasmPath: "../node_modules/@tensorflow/tfjs-backend-wasm/dist/",
|
||||
wasmPath: "",
|
||||
debug: true,
|
||||
async: true,
|
||||
warmup: "full",
|
||||
|
@ -11797,7 +11797,7 @@ var version = "2.1.4";
|
|||
|
||||
// src/human.ts
|
||||
var _numTensors, _analyzeMemoryLeaks, _checkSanity, _firstRun, _lastInputSum, _lastCacheDiff, _sanity, _checkBackend, _skipFrame, _warmupBitmap, _warmupCanvas, _warmupNode;
|
||||
var Human = class {
|
||||
var _Human = class {
|
||||
constructor(userConfig) {
|
||||
__privateAdd(this, _numTensors, void 0);
|
||||
__privateAdd(this, _analyzeMemoryLeaks, void 0);
|
||||
|
@ -11999,10 +11999,12 @@ var Human = class {
|
|||
}
|
||||
return res;
|
||||
});
|
||||
_Human.version = version;
|
||||
Object.defineProperty(this, "version", { value: version });
|
||||
config.wasmPath = `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${tf21.version_core}/dist/`;
|
||||
this.config = mergeDeep(config, userConfig || {});
|
||||
this.tf = tf21;
|
||||
this.draw = draw_exports;
|
||||
this.version = version;
|
||||
this.state = "idle";
|
||||
__privateSet(this, _numTensors, 0);
|
||||
__privateSet(this, _analyzeMemoryLeaks, false);
|
||||
|
@ -12052,7 +12054,7 @@ var Human = class {
|
|||
this.config = mergeDeep(this.config, userConfig);
|
||||
if (__privateGet(this, _firstRun)) {
|
||||
if (this.config.debug)
|
||||
log(`version: ${this.version}`);
|
||||
log(`version: ${_Human.version}`);
|
||||
if (this.config.debug)
|
||||
log(`tfjs version: ${this.tf.version_core}`);
|
||||
if (this.config.debug)
|
||||
|
@ -12254,6 +12256,7 @@ var Human = class {
|
|||
return res;
|
||||
}
|
||||
};
|
||||
var Human = _Human;
|
||||
_numTensors = new WeakMap();
|
||||
_analyzeMemoryLeaks = new WeakMap();
|
||||
_checkSanity = new WeakMap();
|
||||
|
|
|
@ -122,7 +122,7 @@ function mergeDeep(...objects) {
|
|||
var config = {
|
||||
backend: "webgl",
|
||||
modelBasePath: "../models/",
|
||||
wasmPath: "../node_modules/@tensorflow/tfjs-backend-wasm/dist/",
|
||||
wasmPath: "",
|
||||
debug: true,
|
||||
async: true,
|
||||
warmup: "full",
|
||||
|
@ -11796,7 +11796,7 @@ var version = "2.1.4";
|
|||
|
||||
// src/human.ts
|
||||
var _numTensors, _analyzeMemoryLeaks, _checkSanity, _firstRun, _lastInputSum, _lastCacheDiff, _sanity, _checkBackend, _skipFrame, _warmupBitmap, _warmupCanvas, _warmupNode;
|
||||
var Human = class {
|
||||
var _Human = class {
|
||||
constructor(userConfig) {
|
||||
__privateAdd(this, _numTensors, void 0);
|
||||
__privateAdd(this, _analyzeMemoryLeaks, void 0);
|
||||
|
@ -11998,10 +11998,12 @@ var Human = class {
|
|||
}
|
||||
return res;
|
||||
});
|
||||
_Human.version = version;
|
||||
Object.defineProperty(this, "version", { value: version });
|
||||
config.wasmPath = `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${tf21.version_core}/dist/`;
|
||||
this.config = mergeDeep(config, userConfig || {});
|
||||
this.tf = tf21;
|
||||
this.draw = draw_exports;
|
||||
this.version = version;
|
||||
this.state = "idle";
|
||||
__privateSet(this, _numTensors, 0);
|
||||
__privateSet(this, _analyzeMemoryLeaks, false);
|
||||
|
@ -12051,7 +12053,7 @@ var Human = class {
|
|||
this.config = mergeDeep(this.config, userConfig);
|
||||
if (__privateGet(this, _firstRun)) {
|
||||
if (this.config.debug)
|
||||
log(`version: ${this.version}`);
|
||||
log(`version: ${_Human.version}`);
|
||||
if (this.config.debug)
|
||||
log(`tfjs version: ${this.tf.version_core}`);
|
||||
if (this.config.debug)
|
||||
|
@ -12253,6 +12255,7 @@ var Human = class {
|
|||
return res;
|
||||
}
|
||||
};
|
||||
var Human = _Human;
|
||||
_numTensors = new WeakMap();
|
||||
_analyzeMemoryLeaks = new WeakMap();
|
||||
_checkSanity = new WeakMap();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
38
package.json
38
package.json
|
@ -55,37 +55,37 @@
|
|||
"tensorflow"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@tensorflow/tfjs": "^3.8.0",
|
||||
"@tensorflow/tfjs-backend-cpu": "^3.8.0",
|
||||
"@tensorflow/tfjs-backend-wasm": "^3.8.0",
|
||||
"@tensorflow/tfjs-backend-webgl": "^3.8.0",
|
||||
"@tensorflow/tfjs": "^3.9.0",
|
||||
"@tensorflow/tfjs-backend-cpu": "^3.9.0",
|
||||
"@tensorflow/tfjs-backend-wasm": "^3.9.0",
|
||||
"@tensorflow/tfjs-backend-webgl": "^3.9.0",
|
||||
"@tensorflow/tfjs-backend-webgpu": "^0.0.1-alpha.7",
|
||||
"@tensorflow/tfjs-converter": "^3.8.0",
|
||||
"@tensorflow/tfjs-core": "^3.8.0",
|
||||
"@tensorflow/tfjs-data": "^3.8.0",
|
||||
"@tensorflow/tfjs-layers": "^3.8.0",
|
||||
"@tensorflow/tfjs-node": "^3.8.0",
|
||||
"@tensorflow/tfjs-node-gpu": "^3.8.0",
|
||||
"@types/node": "^16.7.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.2",
|
||||
"@typescript-eslint/parser": "^4.29.2",
|
||||
"@tensorflow/tfjs-converter": "^3.9.0",
|
||||
"@tensorflow/tfjs-core": "^3.9.0",
|
||||
"@tensorflow/tfjs-data": "^3.9.0",
|
||||
"@tensorflow/tfjs-layers": "^3.9.0",
|
||||
"@tensorflow/tfjs-node": "^3.9.0",
|
||||
"@tensorflow/tfjs-node-gpu": "^3.9.0",
|
||||
"@types/node": "^16.7.8",
|
||||
"@typescript-eslint/eslint-plugin": "^4.30.0",
|
||||
"@typescript-eslint/parser": "^4.30.0",
|
||||
"@vladmandic/pilogger": "^0.2.18",
|
||||
"canvas": "^2.8.0",
|
||||
"chokidar": "^3.5.2",
|
||||
"dayjs": "^1.10.6",
|
||||
"esbuild": "^0.12.22",
|
||||
"esbuild": "^0.12.24",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-plugin-import": "^2.24.1",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-json": "^3.1.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"node-fetch": "^3.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"seedrandom": "^3.0.5",
|
||||
"simple-git": "^2.44.0",
|
||||
"simple-git": "^2.45.0",
|
||||
"tslib": "^2.3.1",
|
||||
"typedoc": "0.21.6",
|
||||
"typescript": "4.3.5"
|
||||
"typedoc": "0.21.9",
|
||||
"typescript": "4.4.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,28 @@
|
|||
2021-08-23 08:36:57 [36mINFO: [39m @vladmandic/human version 2.1.4
|
||||
2021-08-23 08:36:57 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.5.0
|
||||
2021-08-23 08:36:57 [36mINFO: [39m Toolchain: {"tfjs":"3.8.0","esbuild":"0.12.22","typescript":"4.3.5","typedoc":"0.21.6","eslint":"7.32.0"}
|
||||
2021-08-23 08:36:57 [36mINFO: [39m Clean: ["dist/*","types/*","typedoc/*"]
|
||||
2021-08-23 08:36:57 [36mINFO: [39m Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
|
||||
2021-08-23 08:36:57 [35mSTATE:[39m target: node type: tfjs: {"imports":1,"importBytes":102,"outputBytes":1303,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-08-23 08:36:57 [35mSTATE:[39m target: node type: node: {"imports":47,"importBytes":456488,"outputBytes":396865,"outputFiles":"dist/human.node.js"}
|
||||
2021-08-23 08:36:57 [35mSTATE:[39m target: nodeGPU type: tfjs: {"imports":1,"importBytes":110,"outputBytes":1311,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-08-23 08:36:57 [35mSTATE:[39m target: nodeGPU type: node: {"imports":47,"importBytes":456496,"outputBytes":396869,"outputFiles":"dist/human.node-gpu.js"}
|
||||
2021-08-23 08:36:57 [35mSTATE:[39m target: nodeWASM type: tfjs: {"imports":1,"importBytes":149,"outputBytes":1378,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-08-23 08:36:57 [35mSTATE:[39m target: nodeWASM type: node: {"imports":47,"importBytes":456563,"outputBytes":396941,"outputFiles":"dist/human.node-wasm.js"}
|
||||
2021-08-23 08:36:57 [35mSTATE:[39m target: browserNoBundle type: tfjs: {"imports":1,"importBytes":2168,"outputBytes":1242,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-08-23 08:36:57 [35mSTATE:[39m target: browserNoBundle type: esm: {"imports":47,"importBytes":456427,"outputBytes":255552,"outputFiles":"dist/human.esm-nobundle.js"}
|
||||
2021-08-23 08:36:58 [35mSTATE:[39m target: browserBundle type: tfjs: {"modules":1170,"moduleBytes":4145868,"imports":7,"importBytes":2168,"outputBytes":2334701,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-08-23 08:36:58 [35mSTATE:[39m target: browserBundle type: iife: {"imports":47,"importBytes":2789886,"outputBytes":1386025,"outputFiles":"dist/human.js"}
|
||||
2021-08-23 08:36:59 [35mSTATE:[39m target: browserBundle type: esm: {"imports":47,"importBytes":2789886,"outputBytes":1386017,"outputFiles":"dist/human.esm.js"}
|
||||
2021-08-23 08:36:59 [36mINFO: [39m Running Linter: ["server/","src/","tfjs/","test/","demo/"]
|
||||
2021-08-23 08:37:22 [36mINFO: [39m Linter complete: files: 83 errors: 0 warnings: 0
|
||||
2021-08-23 08:37:22 [36mINFO: [39m Generate ChangeLog: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-08-23 08:37:22 [36mINFO: [39m Generate Typings: ["src/human.ts"] outDir: ["types"]
|
||||
2021-08-23 08:37:37 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"] outDir: ["typedoc"]
|
||||
2021-08-23 08:37:50 [36mINFO: [39m Documentation generated at /home/vlado/dev/human/typedoc 1
|
||||
2021-08-31 12:56:24 [36mINFO: [39m @vladmandic/human version 2.1.4
|
||||
2021-08-31 12:56:24 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.5.0
|
||||
2021-08-31 12:56:24 [36mINFO: [39m Toolchain: {"tfjs":"3.9.0","esbuild":"0.12.24","typescript":"4.4.2","typedoc":"0.21.9","eslint":"7.32.0"}
|
||||
2021-08-31 12:56:24 [36mINFO: [39m Clean: ["dist/*","types/*","typedoc/*"]
|
||||
2021-08-31 12:56:24 [36mINFO: [39m Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
|
||||
2021-08-31 12:56:24 [35mSTATE:[39m target: node type: tfjs: {"imports":1,"importBytes":102,"outputBytes":1303,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-08-31 12:56:24 [35mSTATE:[39m target: node type: node: {"imports":47,"importBytes":456777,"outputBytes":397014,"outputFiles":"dist/human.node.js"}
|
||||
2021-08-31 12:56:24 [35mSTATE:[39m target: nodeGPU type: tfjs: {"imports":1,"importBytes":110,"outputBytes":1311,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-08-31 12:56:24 [35mSTATE:[39m target: nodeGPU type: node: {"imports":47,"importBytes":456785,"outputBytes":397018,"outputFiles":"dist/human.node-gpu.js"}
|
||||
2021-08-31 12:56:24 [35mSTATE:[39m target: nodeWASM type: tfjs: {"imports":1,"importBytes":149,"outputBytes":1378,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-08-31 12:56:24 [35mSTATE:[39m target: nodeWASM type: node: {"imports":47,"importBytes":456852,"outputBytes":397090,"outputFiles":"dist/human.node-wasm.js"}
|
||||
2021-08-31 12:56:24 [35mSTATE:[39m target: browserNoBundle type: tfjs: {"imports":1,"importBytes":2168,"outputBytes":1242,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-08-31 12:56:24 [35mSTATE:[39m target: browserNoBundle type: esm: {"imports":47,"importBytes":456716,"outputBytes":255649,"outputFiles":"dist/human.esm-nobundle.js"}
|
||||
2021-08-31 12:56:24 [35mSTATE:[39m target: browserBundle type: tfjs: {"modules":1174,"moduleBytes":8150347,"imports":7,"importBytes":2168,"outputBytes":2343932,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-08-31 12:56:25 [35mSTATE:[39m target: browserBundle type: iife: {"imports":47,"importBytes":2799406,"outputBytes":1391877,"outputFiles":"dist/human.js"}
|
||||
2021-08-31 12:56:25 [35mSTATE:[39m target: browserBundle type: esm: {"imports":47,"importBytes":2799406,"outputBytes":1391869,"outputFiles":"dist/human.esm.js"}
|
||||
2021-08-31 12:56:25 [36mINFO: [39m Running Linter: ["server/","src/","tfjs/","test/","demo/"]
|
||||
2021-08-31 12:56:47 [36mINFO: [39m Linter complete: files: 83 errors: 0 warnings: 1
|
||||
2021-08-31 12:56:47 [33mWARN: [39m [0m[0m
|
||||
[0m[4m/home/vlado/dev/human/demo/index.js[24m[0m
|
||||
[0m [2m953:3[22m [33mwarning[39m Unexpected console statement [2mno-console[22m[0m
|
||||
[0m[0m
|
||||
[0m[33m[1m✖ 1 problem (0 errors, 1 warning)[22m[39m[0m
|
||||
[0m[33m[1m[22m[39m[0m
|
||||
2021-08-31 12:56:48 [36mINFO: [39m Generate ChangeLog: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-08-31 12:56:48 [36mINFO: [39m Generate Typings: ["src/human.ts"] outDir: ["types"]
|
||||
2021-08-31 12:57:02 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"] outDir: ["typedoc"]
|
||||
2021-08-31 12:57:15 [36mINFO: [39m Documentation generated at /home/vlado/dev/human/typedoc 1
|
||||
|
|
|
@ -216,7 +216,8 @@ const config: Config = {
|
|||
backend: 'webgl', // select tfjs backend to use, leave empty to use default backend
|
||||
// can be 'webgl', 'wasm', 'cpu', or 'humangl' which is a custom version of webgl
|
||||
modelBasePath: '../models/', // base path for all models
|
||||
wasmPath: '../node_modules/@tensorflow/tfjs-backend-wasm/dist/', // path for wasm binaries, only used for backend: wasm
|
||||
wasmPath: '', // path for wasm binaries, only used for backend: wasm
|
||||
// default set to download from jsdeliv during Human class instantiation
|
||||
debug: true, // print additional status messages to console
|
||||
async: true, // execute enabled models in parallel
|
||||
warmup: 'full', // what to use for human.warmup(), can be 'none', 'face', 'full'
|
||||
|
|
10
src/human.ts
10
src/human.ts
|
@ -62,7 +62,7 @@ export type TensorFlow = typeof tf;
|
|||
*/
|
||||
export class Human {
|
||||
/** Current version of Human library in *semver* format */
|
||||
version: string;
|
||||
static version: string;
|
||||
/** Current configuration
|
||||
* - Details: {@link Config}
|
||||
*/
|
||||
|
@ -148,10 +148,12 @@ export class Human {
|
|||
* @param userConfig: {@link Config}
|
||||
*/
|
||||
constructor(userConfig?: Config | Record<string, unknown>) {
|
||||
Human.version = app.version;
|
||||
Object.defineProperty(this, 'version', { value: app.version });
|
||||
defaults.wasmPath = `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${tf.version_core}/dist/`;
|
||||
this.config = mergeDeep(defaults, userConfig || {});
|
||||
this.tf = tf;
|
||||
this.draw = draw;
|
||||
this.version = app.version;
|
||||
this.state = 'idle';
|
||||
this.#numTensors = 0;
|
||||
this.#analyzeMemoryLeaks = false;
|
||||
|
@ -188,6 +190,8 @@ export class Human {
|
|||
this.#lastInputSum = 1;
|
||||
}
|
||||
|
||||
// version = () => Human.version;
|
||||
|
||||
// helper function: measure tensor leak
|
||||
/** @hidden */
|
||||
analyze = (...msg: string[]) => {
|
||||
|
@ -268,7 +272,7 @@ export class Human {
|
|||
if (userConfig) this.config = mergeDeep(this.config, userConfig) as Config;
|
||||
|
||||
if (this.#firstRun) { // print version info on first run and check for correct backend setup
|
||||
if (this.config.debug) log(`version: ${this.version}`);
|
||||
if (this.config.debug) log(`version: ${Human.version}`);
|
||||
if (this.config.debug) log(`tfjs version: ${this.tf.version_core}`);
|
||||
if (this.config.debug) log('platform:', this.sysinfo.platform);
|
||||
if (this.config.debug) log('agent:', this.sysinfo.agent);
|
||||
|
|
|
@ -5,7 +5,7 @@ const config = {
|
|||
modelBasePath: 'http://localhost:10030/models/',
|
||||
backend: 'wasm',
|
||||
wasmPath: 'node_modules/@tensorflow/tfjs-backend-wasm/dist/',
|
||||
// wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.6.0/dist/',
|
||||
// wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.9.0/dist/',
|
||||
debug: false,
|
||||
async: false,
|
||||
face: {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -113,7 +113,6 @@
|
|||
<li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#state" class="tsd-kind-icon">state</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#sysinfo" class="tsd-kind-icon">sysinfo</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#tf" class="tsd-kind-icon">tf</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#version" class="tsd-kind-icon">version</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Human.html#Body" class="tsd-kind-icon">Body</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Human.html#Config" class="tsd-kind-icon">Config</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Human.html#DrawOptions" class="tsd-kind-icon">Draw<wbr>Options</a></li>
|
||||
|
@ -123,6 +122,7 @@
|
|||
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Human.html#Item" class="tsd-kind-icon">Item</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Human.html#Person" class="tsd-kind-icon">Person</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Human.html#Result" class="tsd-kind-icon">Result</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Human.html#version" class="tsd-kind-icon">version</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="tsd-index-section ">
|
||||
|
@ -566,18 +566,6 @@
|
|||
</dl>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
|
||||
<a name="version" class="tsd-anchor"></a>
|
||||
<h3>version</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
<div class="lead">
|
||||
<p>Current version of Human library in <em>semver</em> format</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-static">
|
||||
<a name="Body" class="tsd-anchor"></a>
|
||||
<h3><span class="tsd-flag ts-flagStatic">Static</span> Body</h3>
|
||||
|
@ -646,6 +634,18 @@
|
|||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-static">
|
||||
<a name="version" class="tsd-anchor"></a>
|
||||
<h3><span class="tsd-flag ts-flagStatic">Static</span> version</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||
<aside class="tsd-sources">
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
<div class="lead">
|
||||
<p>Current version of Human library in <em>semver</em> format</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
<section class="tsd-panel-group tsd-member-group ">
|
||||
<h2>Methods</h2>
|
||||
|
@ -959,9 +959,6 @@
|
|||
<li class=" tsd-kind-property tsd-parent-kind-class">
|
||||
<a href="Human.html#tf" class="tsd-kind-icon">tf</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-class">
|
||||
<a href="Human.html#version" class="tsd-kind-icon">version</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-static">
|
||||
<a href="Human.html#Body" class="tsd-kind-icon">Body</a>
|
||||
</li>
|
||||
|
@ -989,6 +986,9 @@
|
|||
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-static">
|
||||
<a href="Human.html#Result" class="tsd-kind-icon">Result</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-static">
|
||||
<a href="Human.html#version" class="tsd-kind-icon">version</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-method tsd-parent-kind-class">
|
||||
<a href="Human.html#detect" class="tsd-kind-icon">detect</a>
|
||||
</li>
|
||||
|
|
|
@ -2,7 +2,7 @@ export var Abs: string;
|
|||
export var Acos: string;
|
||||
export var Acosh: string;
|
||||
export var AdadeltaOptimizer: {
|
||||
new (learningRate: any, rho: any, epsilon3?: any): {
|
||||
new (learningRate: any, rho: any, epsilon3?: null): {
|
||||
learningRate: any;
|
||||
rho: any;
|
||||
epsilon: any;
|
||||
|
@ -73,7 +73,7 @@ export var AdagradOptimizer: {
|
|||
className: string;
|
||||
};
|
||||
export var AdamOptimizer: {
|
||||
new (learningRate: any, beta1: any, beta2: any, epsilon3?: any): {
|
||||
new (learningRate: any, beta1: any, beta2: any, epsilon3?: null): {
|
||||
learningRate: any;
|
||||
beta1: any;
|
||||
beta2: any;
|
||||
|
@ -114,7 +114,7 @@ export var AdamOptimizer: {
|
|||
className: string;
|
||||
};
|
||||
export var AdamaxOptimizer: {
|
||||
new (learningRate: any, beta1: any, beta2: any, epsilon3?: any, decay?: number): {
|
||||
new (learningRate: any, beta1: any, beta2: any, epsilon3?: null, decay?: number): {
|
||||
learningRate: any;
|
||||
beta1: any;
|
||||
beta2: any;
|
||||
|
@ -221,6 +221,7 @@ export var BackendWasm: {
|
|||
export var BatchMatMul: string;
|
||||
export var BatchToSpaceND: string;
|
||||
export var Bincount: string;
|
||||
export var BroadcastArgs: string;
|
||||
export var BroadcastTo: string;
|
||||
export var Callback: {
|
||||
new (...args: any[]): {
|
||||
|
@ -765,7 +766,7 @@ export var KernelBackend: {
|
|||
export var LRN: string;
|
||||
export var LRNGrad: string;
|
||||
export var LayerVariable: {
|
||||
new (val: any, dtype?: string, name?: string, trainable?: boolean, constraint?: any): {
|
||||
new (val: any, dtype?: string, name?: string, trainable?: boolean, constraint?: null): {
|
||||
dtype: string;
|
||||
shape: any;
|
||||
id: number;
|
||||
|
@ -1164,7 +1165,7 @@ export var Pow: string;
|
|||
export var Prelu: string;
|
||||
export var Prod: string;
|
||||
export var RMSPropOptimizer: {
|
||||
new (learningRate: any, decay?: number, momentum?: number, epsilon3?: any, centered?: boolean): {
|
||||
new (learningRate: any, decay?: number, momentum?: number, epsilon3?: null, centered?: boolean): {
|
||||
learningRate: any;
|
||||
decay: number;
|
||||
momentum: number;
|
||||
|
@ -1207,7 +1208,6 @@ export var RMSPropOptimizer: {
|
|||
};
|
||||
export var RNN: {
|
||||
new (args: any): {
|
||||
[x: string]: any;
|
||||
cell: any;
|
||||
returnSequences: any;
|
||||
returnState: any;
|
||||
|
@ -1296,7 +1296,7 @@ export var RNN: {
|
|||
trainable: boolean;
|
||||
};
|
||||
addLoss(losses4: any): void;
|
||||
addInboundNode(inputTensors: any, outputTensors: any, inputMasks: any, outputMasks: any, inputShapes: any, outputShapes: any, kwargs?: any): void;
|
||||
addInboundNode(inputTensors: any, outputTensors: any, inputMasks: any, outputMasks: any, inputShapes: any, outputShapes: any, kwargs?: null): void;
|
||||
disposeWeights(): number;
|
||||
assertNotDisposed(): void;
|
||||
dispose(): {
|
||||
|
@ -1538,6 +1538,8 @@ export namespace batchToSpaceND { }
|
|||
export function bincount(...args: any[]): any;
|
||||
export namespace bincount { }
|
||||
export function booleanMaskAsync(tensor2: any, mask: any, axis: any): Promise<any>;
|
||||
export function broadcastArgs(...args: any[]): any;
|
||||
export namespace broadcastArgs { }
|
||||
export function broadcastTo(...args: any[]): any;
|
||||
export namespace broadcastTo { }
|
||||
declare var browser_exports: {};
|
||||
|
@ -1676,6 +1678,7 @@ export function imag(...args: any[]): any;
|
|||
export namespace imag { }
|
||||
export namespace image {
|
||||
export { flipLeftRight };
|
||||
export { grayscaleToRGB };
|
||||
export { resizeNearestNeighbor };
|
||||
export { resizeBilinear };
|
||||
export { rotateWithOffset };
|
||||
|
@ -1836,8 +1839,8 @@ export function loadGraphModel(modelUrl: any, options?: {}): Promise<{
|
|||
export function loadLayersModel(pathOrIOHandler: any, options: any): Promise<any>;
|
||||
export function localResponseNormalization(...args: any[]): any;
|
||||
export namespace localResponseNormalization { }
|
||||
export function log(...args: any[]): any;
|
||||
export namespace log { }
|
||||
declare function log5(...args: any[]): any;
|
||||
declare namespace log5 { }
|
||||
export function log1p(...args: any[]): any;
|
||||
export namespace log1p { }
|
||||
export function logSigmoid(...args: any[]): any;
|
||||
|
@ -2309,6 +2312,8 @@ declare function earlyStopping(args: any): {
|
|||
};
|
||||
declare function flipLeftRight(...args: any[]): any;
|
||||
declare namespace flipLeftRight { }
|
||||
declare function grayscaleToRGB(...args: any[]): any;
|
||||
declare namespace grayscaleToRGB { }
|
||||
declare function resizeNearestNeighbor(...args: any[]): any;
|
||||
declare namespace resizeNearestNeighbor { }
|
||||
declare function resizeBilinear(...args: any[]): any;
|
||||
|
@ -2449,7 +2454,7 @@ declare var OptimizerConstructors: {
|
|||
extractIterations(weightValues: any): Promise<any>;
|
||||
getClassName(): any;
|
||||
};
|
||||
rmsprop(learningRate: any, decay?: number, momentum?: number, epsilon3?: any, centered?: boolean): {
|
||||
rmsprop(learningRate: any, decay?: number, momentum?: number, epsilon3?: null, centered?: boolean): {
|
||||
learningRate: any;
|
||||
decay: number;
|
||||
momentum: number;
|
||||
|
@ -2487,7 +2492,7 @@ declare var OptimizerConstructors: {
|
|||
extractIterations(weightValues: any): Promise<any>;
|
||||
getClassName(): any;
|
||||
};
|
||||
adam(learningRate?: number, beta1?: number, beta2?: number, epsilon3?: any): {
|
||||
adam(learningRate?: number, beta1?: number, beta2?: number, epsilon3?: null): {
|
||||
learningRate: any;
|
||||
beta1: any;
|
||||
beta2: any;
|
||||
|
@ -2524,7 +2529,7 @@ declare var OptimizerConstructors: {
|
|||
extractIterations(weightValues: any): Promise<any>;
|
||||
getClassName(): any;
|
||||
};
|
||||
adadelta(learningRate?: number, rho?: number, epsilon3?: any): {
|
||||
adadelta(learningRate?: number, rho?: number, epsilon3?: null): {
|
||||
learningRate: any;
|
||||
rho: any;
|
||||
epsilon: any;
|
||||
|
@ -2557,7 +2562,7 @@ declare var OptimizerConstructors: {
|
|||
extractIterations(weightValues: any): Promise<any>;
|
||||
getClassName(): any;
|
||||
};
|
||||
adamax(learningRate?: number, beta1?: number, beta2?: number, epsilon3?: any, decay?: number): {
|
||||
adamax(learningRate?: number, beta1?: number, beta2?: number, epsilon3?: null, decay?: number): {
|
||||
learningRate: any;
|
||||
beta1: any;
|
||||
beta2: any;
|
||||
|
@ -2624,4 +2629,4 @@ declare var OptimizerConstructors: {
|
|||
getClassName(): any;
|
||||
};
|
||||
};
|
||||
export { add2 as add, backend_util_exports as backend_util, browser_exports as browser, exports_constraints_exports as constraints, dist_exports as data, device_util_exports as device_util, fused_ops_exports as fused, gather_nd_util_exports as gather_util, gpgpu_util_exports as gpgpu_util, exports_initializers_exports as initializers, io_exports as io, isFinite2 as isFinite, isNaN2 as isNaN, kernel_impls_exports as kernel_impls, exports_layers_exports as layers, math_exports as math, exports_metrics_exports as metrics, exports_models_exports as models, ones2 as ones, print2 as print, exports_regularizers_exports as regularizers, round2 as round, scatter_nd_util_exports as scatter_util, serialization_exports as serialization, shared_exports as shared, slice_util_exports as slice_util, sum2 as sum, tanh2 as tanh, tensor_util_exports as tensor_util, test_util_exports as test_util, util_exports as util, version16 as version, version11 as version_converter, version9 as version_core, version13 as version_cpu, version10 as version_layers, version15 as version_wasm, version14 as version_webgl, webgl_util_exports as webgl_util };
|
||||
export { add2 as add, backend_util_exports as backend_util, browser_exports as browser, exports_constraints_exports as constraints, dist_exports as data, device_util_exports as device_util, fused_ops_exports as fused, gather_nd_util_exports as gather_util, gpgpu_util_exports as gpgpu_util, exports_initializers_exports as initializers, io_exports as io, isFinite2 as isFinite, isNaN2 as isNaN, kernel_impls_exports as kernel_impls, exports_layers_exports as layers, log5 as log, math_exports as math, exports_metrics_exports as metrics, exports_models_exports as models, ones2 as ones, print2 as print, exports_regularizers_exports as regularizers, round2 as round, scatter_nd_util_exports as scatter_util, serialization_exports as serialization, shared_exports as shared, slice_util_exports as slice_util, sum2 as sum, tanh2 as tanh, tensor_util_exports as tensor_util, test_util_exports as test_util, util_exports as util, version16 as version, version11 as version_converter, version9 as version_core, version13 as version_cpu, version10 as version_layers, version15 as version_wasm, version14 as version_webgl, webgl_util_exports as webgl_util };
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* Human main module
|
||||
*/
|
||||
/// <reference types="offscreencanvas" />
|
||||
import { Config } from './config';
|
||||
import { Result, Face, Hand, Body, Item, Gesture } from './result';
|
||||
import * as tf from '../dist/tfjs.esm.js';
|
||||
|
@ -38,7 +39,7 @@ export declare type TensorFlow = typeof tf;
|
|||
export declare class Human {
|
||||
#private;
|
||||
/** Current version of Human library in *semver* format */
|
||||
version: string;
|
||||
static version: string;
|
||||
/** Current configuration
|
||||
* - Details: {@link Config}
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* Image Processing module used by Human
|
||||
*/
|
||||
/// <reference types="offscreencanvas" />
|
||||
import { Tensor } from '../tfjs/types';
|
||||
import { Config } from '../config';
|
||||
declare type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* Type definitions for Human result object
|
||||
*/
|
||||
/// <reference types="offscreencanvas" />
|
||||
import { Tensor } from './tfjs/types';
|
||||
import { FaceGesture, BodyGesture, HandGesture, IrisGesture } from './gesture/gesture';
|
||||
/** Face results
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* EfficientPose Module
|
||||
*/
|
||||
/// <reference types="offscreencanvas" />
|
||||
import { GraphModel, Tensor } from '../tfjs/types';
|
||||
import { Config } from '../config';
|
||||
declare type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* Custom TFJS backend for Human based on WebGL
|
||||
* Not used by default
|
||||
*/
|
||||
/// <reference types="offscreencanvas" />
|
||||
export declare const config: {
|
||||
name: string;
|
||||
priority: number;
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit e894eff5aee6aeca6a7690c5a3d6a0f7404d7f2c
|
||||
Subproject commit fcc3945dedd5682f06c45c32504a86a1a7e2a20b
|
Loading…
Reference in New Issue