quantize handdetect model

pull/134/head
Vladimir Mandic 2021-05-29 18:29:57 -04:00
parent 8808d66696
commit 08f4e65d81
19 changed files with 346 additions and 319 deletions

View File

@ -9,8 +9,9 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
## Changelog ## Changelog
### **HEAD -> main** 2021/05/28 mandic00@live.com ### **HEAD -> main** 2021/05/29 mandic00@live.com
- added experimental movenet-lightning and removed blazepose from default dist
- added experimental face.rotation.gaze - added experimental face.rotation.gaze
- fix and optimize for mobile platform - fix and optimize for mobile platform
- lock typescript to 4.2 due to typedoc incompatibility with 4.3 - lock typescript to 4.2 due to typedoc incompatibility with 4.3

View File

@ -7,13 +7,12 @@ N/A
## Exploring Features ## Exploring Features
- Switch from PoseNet to MoveNet - Switch from PoseNet to MoveNet
- Optimize HandPose - Implement demo as installable PWA with model caching
- Implement results interpolation on library level
## Explore Models ## Explore Models
- InsightFace - InsightFace: RetinaFace detector and ArcFace recognition: <https://github.com/deepinsight/insightface>
RetinaFace detector and ArcFace recognition
<https://github.com/deepinsight/insightface>
## In Progress ## In Progress

View File

@ -15,7 +15,7 @@ import webRTC from './helpers/webrtc.js';
let human; let human;
const userConfig = { const userConfig = {
warmup: 'none', warmup: 'full',
/* /*
backend: 'webgl', backend: 'webgl',
async: false, async: false,
@ -33,8 +33,8 @@ const userConfig = {
}, },
hand: { enabled: false }, hand: { enabled: false },
// body: { enabled: true, modelPath: 'posenet.json' }, // body: { enabled: true, modelPath: 'posenet.json' },
body: { enabled: true, modelPath: 'movenet-lightning.json' },
// body: { enabled: true, modelPath: 'blazepose.json' }, // body: { enabled: true, modelPath: 'blazepose.json' },
body: { enabled: true, modelPath: 'movenet-lightning.json' },
object: { enabled: false }, object: { enabled: false },
gesture: { enabled: true }, gesture: { enabled: true },
*/ */

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.js vendored

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.js vendored

File diff suppressed because one or more lines are too long

View File

@ -185,7 +185,7 @@ var config = {
}, },
body: { body: {
enabled: true, enabled: true,
modelPath: "posenet.json", modelPath: "movenet-lightning.json",
maxDetected: 1, maxDetected: 1,
minConfidence: 0.2 minConfidence: 0.2
}, },
@ -20375,7 +20375,7 @@ var Human = class {
} }
this.perf.total = Math.trunc(now() - timeStart); this.perf.total = Math.trunc(now() - timeStart);
this.state = "idle"; this.state = "idle";
const res = { this.result = {
face: faceRes, face: faceRes,
body: bodyRes, body: bodyRes,
hand: handRes, hand: handRes,
@ -20390,7 +20390,7 @@ var Human = class {
} }
}; };
tf19.dispose(process5.tensor); tf19.dispose(process5.tensor);
resolve(res); resolve(this.result);
}); });
} }
async warmup(userConfig = {}) { async warmup(userConfig = {}) {

View File

@ -186,7 +186,7 @@ var config = {
}, },
body: { body: {
enabled: true, enabled: true,
modelPath: "posenet.json", modelPath: "movenet-lightning.json",
maxDetected: 1, maxDetected: 1,
minConfidence: 0.2 minConfidence: 0.2
}, },
@ -20376,7 +20376,7 @@ var Human = class {
} }
this.perf.total = Math.trunc(now() - timeStart); this.perf.total = Math.trunc(now() - timeStart);
this.state = "idle"; this.state = "idle";
const res = { this.result = {
face: faceRes, face: faceRes,
body: bodyRes, body: bodyRes,
hand: handRes, hand: handRes,
@ -20391,7 +20391,7 @@ var Human = class {
} }
}; };
tf19.dispose(process5.tensor); tf19.dispose(process5.tensor);
resolve(res); resolve(this.result);
}); });
} }
async warmup(userConfig = {}) { async warmup(userConfig = {}) {

6
dist/human.node.js vendored
View File

@ -185,7 +185,7 @@ var config = {
}, },
body: { body: {
enabled: true, enabled: true,
modelPath: "posenet.json", modelPath: "movenet-lightning.json",
maxDetected: 1, maxDetected: 1,
minConfidence: 0.2 minConfidence: 0.2
}, },
@ -20375,7 +20375,7 @@ var Human = class {
} }
this.perf.total = Math.trunc(now() - timeStart); this.perf.total = Math.trunc(now() - timeStart);
this.state = "idle"; this.state = "idle";
const res = { this.result = {
face: faceRes, face: faceRes,
body: bodyRes, body: bodyRes,
hand: handRes, hand: handRes,
@ -20390,7 +20390,7 @@ var Human = class {
} }
}; };
tf19.dispose(process5.tensor); tf19.dispose(process5.tensor);
resolve(res); resolve(this.result);
}); });
} }
async warmup(userConfig = {}) { async warmup(userConfig = {}) {

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1,17 +1,17 @@
2021-05-29 09:19:14 INFO:  @vladmandic/human version 1.9.4 2021-05-29 18:28:57 INFO:  @vladmandic/human version 1.9.4
2021-05-29 09:19:14 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.0.0 2021-05-29 18:28:57 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.0.0
2021-05-29 09:19:14 INFO:  Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true} 2021-05-29 18:28:57 INFO:  Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
2021-05-29 09:19:14 STATE: Build for: node type: tfjs: {"imports":1,"importBytes":102,"outputBytes":1292,"outputFiles":"dist/tfjs.esm.js"} 2021-05-29 18:28:57 STATE: Build for: node type: tfjs: {"imports":1,"importBytes":102,"outputBytes":1292,"outputFiles":"dist/tfjs.esm.js"}
2021-05-29 09:19:14 STATE: Build for: node type: node: {"imports":39,"importBytes":443616,"outputBytes":396012,"outputFiles":"dist/human.node.js"} 2021-05-29 18:28:57 STATE: Build for: node type: node: {"imports":39,"importBytes":443782,"outputBytes":396032,"outputFiles":"dist/human.node.js"}
2021-05-29 09:19:14 STATE: Build for: nodeGPU type: tfjs: {"imports":1,"importBytes":110,"outputBytes":1300,"outputFiles":"dist/tfjs.esm.js"} 2021-05-29 18:28:57 STATE: Build for: nodeGPU type: tfjs: {"imports":1,"importBytes":110,"outputBytes":1300,"outputFiles":"dist/tfjs.esm.js"}
2021-05-29 09:19:14 STATE: Build for: nodeGPU type: node: {"imports":39,"importBytes":443624,"outputBytes":396016,"outputFiles":"dist/human.node-gpu.js"} 2021-05-29 18:28:57 STATE: Build for: nodeGPU type: node: {"imports":39,"importBytes":443790,"outputBytes":396036,"outputFiles":"dist/human.node-gpu.js"}
2021-05-29 09:19:14 STATE: Build for: nodeWASM type: tfjs: {"imports":1,"importBytes":149,"outputBytes":1367,"outputFiles":"dist/tfjs.esm.js"} 2021-05-29 18:28:57 STATE: Build for: nodeWASM type: tfjs: {"imports":1,"importBytes":149,"outputBytes":1367,"outputFiles":"dist/tfjs.esm.js"}
2021-05-29 09:19:14 STATE: Build for: nodeWASM type: node: {"imports":39,"importBytes":443691,"outputBytes":396088,"outputFiles":"dist/human.node-wasm.js"} 2021-05-29 18:28:57 STATE: Build for: nodeWASM type: node: {"imports":39,"importBytes":443857,"outputBytes":396108,"outputFiles":"dist/human.node-wasm.js"}
2021-05-29 09:19:14 STATE: Build for: browserNoBundle type: tfjs: {"imports":1,"importBytes":2478,"outputBytes":1394,"outputFiles":"dist/tfjs.esm.js"} 2021-05-29 18:28:57 STATE: Build for: browserNoBundle type: tfjs: {"imports":1,"importBytes":2478,"outputBytes":1394,"outputFiles":"dist/tfjs.esm.js"}
2021-05-29 09:19:15 STATE: Build for: browserNoBundle type: esm: {"imports":39,"importBytes":443718,"outputBytes":242135,"outputFiles":"dist/human.esm-nobundle.js"} 2021-05-29 18:28:57 STATE: Build for: browserNoBundle type: esm: {"imports":39,"importBytes":443884,"outputBytes":242161,"outputFiles":"dist/human.esm-nobundle.js"}
2021-05-29 09:19:15 STATE: Build for: browserBundle type: tfjs: {"modules":1274,"moduleBytes":4114813,"imports":7,"importBytes":2478,"outputBytes":1111414,"outputFiles":"dist/tfjs.esm.js"} 2021-05-29 18:28:58 STATE: Build for: browserBundle type: tfjs: {"modules":1274,"moduleBytes":4114813,"imports":7,"importBytes":2478,"outputBytes":1111414,"outputFiles":"dist/tfjs.esm.js"}
2021-05-29 09:19:16 STATE: Build for: browserBundle type: iife: {"imports":39,"importBytes":1553738,"outputBytes":1349942,"outputFiles":"dist/human.js"} 2021-05-29 18:28:59 STATE: Build for: browserBundle type: iife: {"imports":39,"importBytes":1553904,"outputBytes":1349968,"outputFiles":"dist/human.js"}
2021-05-29 09:19:16 STATE: Build for: browserBundle type: esm: {"imports":39,"importBytes":1553738,"outputBytes":1349934,"outputFiles":"dist/human.esm.js"} 2021-05-29 18:28:59 STATE: Build for: browserBundle type: esm: {"imports":39,"importBytes":1553904,"outputBytes":1349960,"outputFiles":"dist/human.esm.js"}
2021-05-29 09:19:16 INFO:  Generate types: ["src/human.ts"] 2021-05-29 18:28:59 INFO:  Generate types: ["src/human.ts"]
2021-05-29 09:19:22 INFO:  Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"] 2021-05-29 18:29:05 INFO:  Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
2021-05-29 09:19:22 INFO:  Generate TypeDocs: ["src/human.ts"] 2021-05-29 18:29:05 INFO:  Generate TypeDocs: ["src/human.ts"]

View File

@ -287,8 +287,8 @@ const config: Config = {
body: { body: {
enabled: true, enabled: true,
modelPath: 'posenet.json', // body model, can be absolute path or relative to modelBasePath modelPath: 'movenet-lightning.json', // body model, can be absolute path or relative to modelBasePath
// can be 'posenet', 'blazepose', 'efficientpose', 'movenet' // can be 'posenet', 'blazepose', 'efficientpose', 'movenet-lightning', 'movenet-thunder'
maxDetected: 1, // maximum number of people detected in the input maxDetected: 1, // maximum number of people detected in the input
// should be set to the minimum number for performance // should be set to the minimum number for performance
// only valid for posenet as other models detects single pose // only valid for posenet as other models detects single pose

View File

@ -60,6 +60,10 @@ export class Human {
* - Details: {@link Config} * - Details: {@link Config}
*/ */
config: Config; config: Config;
/** Last known result of detect run
* - Can be accessed anytime after initial detection
*/
result: Result;
/** Current state of Human library /** Current state of Human library
* - Can be polled to determine operations that are currently executed * - Can be polled to determine operations that are currently executed
*/ */
@ -548,7 +552,7 @@ export class Human {
this.perf.total = Math.trunc(now() - timeStart); this.perf.total = Math.trunc(now() - timeStart);
this.state = 'idle'; this.state = 'idle';
const res = { this.result = {
face: faceRes, face: faceRes,
body: bodyRes, body: bodyRes,
hand: handRes, hand: handRes,
@ -564,7 +568,7 @@ export class Human {
tf.dispose(process.tensor); tf.dispose(process.tensor);
// log('Result:', result); // log('Result:', result);
resolve(res); resolve(this.result);
}); });
} }

File diff suppressed because one or more lines are too long

View File

@ -105,6 +105,7 @@
<li class="tsd-kind-property tsd-parent-kind-class"><a href="human.html#image" class="tsd-kind-icon">image</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="human.html#image" class="tsd-kind-icon">image</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="human.html#models" class="tsd-kind-icon">models</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="human.html#models" class="tsd-kind-icon">models</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="human.html#perf" class="tsd-kind-icon">perf</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="human.html#perf" class="tsd-kind-icon">perf</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="human.html#result" class="tsd-kind-icon">result</a></li>
<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#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#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#tf" class="tsd-kind-icon">tf</a></li>
@ -516,6 +517,21 @@
</div> </div>
</div> </div>
</section> </section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="result" class="tsd-anchor"></a>
<h3>result</h3>
<div class="tsd-signature tsd-kind-icon">result<span class="tsd-signature-symbol">:</span> <a href="../interfaces/result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></div>
<aside class="tsd-sources">
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Last known result of detect run</p>
<ul>
<li>Can be accessed anytime after initial detection</li>
</ul>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="state" class="tsd-anchor"></a> <a name="state" class="tsd-anchor"></a>
<h3>state</h3> <h3>state</h3>
@ -828,6 +844,9 @@
<li class=" tsd-kind-property tsd-parent-kind-class"> <li class=" tsd-kind-property tsd-parent-kind-class">
<a href="human.html#perf" class="tsd-kind-icon">perf</a> <a href="human.html#perf" class="tsd-kind-icon">perf</a>
</li> </li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="human.html#result" class="tsd-kind-icon">result</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class"> <li class=" tsd-kind-property tsd-parent-kind-class">
<a href="human.html#state" class="tsd-kind-icon">state</a> <a href="human.html#state" class="tsd-kind-icon">state</a>
</li> </li>

4
types/human.d.ts vendored
View File

@ -45,6 +45,10 @@ export declare class Human {
* - Details: {@link Config} * - Details: {@link Config}
*/ */
config: Config; config: Config;
/** Last known result of detect run
* - Can be accessed anytime after initial detection
*/
result: Result;
/** Current state of Human library /** Current state of Human library
* - Can be polled to determine operations that are currently executed * - Can be polled to determine operations that are currently executed
*/ */