mirror of https://github.com/vladmandic/human
dynamically generate default wasm path
parent
17356e0a4d
commit
e58ba5e803
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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: {
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit e894eff5aee6aeca6a7690c5a3d6a0f7404d7f2c
|
||||
Subproject commit fcc3945dedd5682f06c45c32504a86a1a7e2a20b
|
Loading…
Reference in New Issue