mirror of https://github.com/vladmandic/human
add wasm bundle
parent
68253ad0dd
commit
4d8ceea62a
|
@ -18,12 +18,13 @@
|
|||
### Wiki pages:
|
||||
|
||||
- [**Home**](https://github.com/vladmandic/human/wiki)
|
||||
- [**Demos**](https://github.com/vladmandic/human/wiki/Demos)
|
||||
- [**Installation**](https://github.com/vladmandic/human/wiki/Install)
|
||||
- [**Usage**](https://github.com/vladmandic/human/wiki/Usage)
|
||||
- [**Usage**](https://github.com/vladmandic/human/wiki/Backends)
|
||||
- [**Configuration**](https://github.com/vladmandic/human/wiki/Configuration)
|
||||
- [**Outputs**](https://github.com/vladmandic/human/wiki/Outputs)
|
||||
- [**Gesture Recognition**](https://github.com/vladmandic/human/wiki/Gesture)
|
||||
- [**Demos**](https://github.com/vladmandic/human/wiki/Demos)
|
||||
- [**Development Server**](https://github.com/vladmandic/human/wiki/Development-Server)
|
||||
- [**Build Process**](https://github.com/vladmandic/human/wiki/Build-Process)
|
||||
- [**Profiling**](https://github.com/vladmandic/human/wiki/Profiling)
|
||||
|
@ -33,7 +34,7 @@
|
|||
<br>
|
||||
|
||||
Compatible with *Browser*, *WebWorker* and *NodeJS* execution on both Windows and Linux
|
||||
- Browser/WebWorker: Compatible with *CPU*, *WebGL*, *WASM* and *WebGPU* backends
|
||||
- Browser/WebWorker: Compatible with *CPU*, *WebGL* and *WASM* backends
|
||||
- NodeJS: Compatible with software *tfjs-node* and CUDA accelerated backends *tfjs-node-gpu*
|
||||
|
||||
(and maybe with React-Native as it doesn't use any DOM objects)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -3,6 +3,8 @@
|
|||
|
||||
export default {
|
||||
backend: 'webgl', // select tfjs backend to use
|
||||
wasmPath: '../assets/', // path for wasm binaries
|
||||
// only used for backend: wasm
|
||||
console: true, // enable debugging output to console
|
||||
async: true, // execute enabled models in parallel
|
||||
// this disables per-model performance data but
|
||||
|
|
|
@ -157,7 +157,7 @@ async function setupCamera() {
|
|||
const track = stream.getVideoTracks()[0];
|
||||
const settings = track.getSettings();
|
||||
// log('camera constraints:', constraints, 'window:', { width: window.innerWidth, height: window.innerHeight }, 'settings:', settings, 'track:', track);
|
||||
ui.camera = { name: track.label, width: settings.width, height: settings.height, facing: settings.facingMode === 'user' ? 'front' : 'back' };
|
||||
ui.camera = { name: track.label?.toLowerCase(), width: settings.width, height: settings.height, facing: settings.facingMode === 'user' ? 'front' : 'back' };
|
||||
return new Promise((resolve) => {
|
||||
video.onloadeddata = async () => {
|
||||
video.width = video.videoWidth;
|
||||
|
@ -303,7 +303,7 @@ function setupMenu() {
|
|||
document.getElementById('play').addEventListener('click', () => btn.click());
|
||||
|
||||
menu.addHTML('<hr style="min-width: 200px; border-style: inset; border-color: dimgray">');
|
||||
menu.addList('backend', ['cpu', 'webgl', 'wasm', 'webgpu'], human.config.backend, (val) => human.config.backend = val);
|
||||
menu.addList('backend', ['cpu', 'webgl', 'wasm'], human.config.backend, (val) => human.config.backend = val);
|
||||
menu.addBool('async operations', human.config, 'async', (val) => human.config.async = val);
|
||||
menu.addBool('enable profiler', human.config, 'profile', (val) => human.config.profile = val);
|
||||
menu.addBool('memory shield', human.config, 'deallocate', (val) => human.config.deallocate = val);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="content-type">
|
||||
<meta content="text/html">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="description" content="3D Face Detection, Body Pose, Hand & Finger Tracking, Iris Tracking, Age & Gender Prediction & Emotion Prediction; Author: Vladimir Mandic <mandic00@live.com>">
|
||||
<meta name="description" content="3D Face Detection, Body Pose, Hand & Finger Tracking, Iris Tracking, Age & Gender Prediction, Emotion Prediction & Gesture Recognition; Author: Vladimir Mandic <https://github.com/vladmandic>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.6, minimum-scale=0.1, maximum-scale=4.0, shrink-to-fit=yes, user-scalable=yes">
|
||||
<meta name="theme-color" content="#000000"/>
|
||||
<meta name="application-name" content="Human">
|
||||
|
@ -13,13 +13,9 @@
|
|||
<link rel="manifest" href="./manifest.json">
|
||||
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
|
||||
<link rel="apple-touch-icon" href="../assets/icon.png">
|
||||
<!-- not required for tfjs cpu or webgl backends, required if you want to use tfjs wasm or webgpu backends -->
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.7.0/dist/tf.es2017.js"></script> -->
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@2.7.0/dist/tf-backend-wasm.es2017.js"></script> -->
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgpu@0.0.1-alpha.0/dist/tf-webgpu.js"></script> -->
|
||||
<!-- load compiled demo js -->
|
||||
<script src="../dist/demo-browser-index.js"></script>
|
||||
<!-- alternatively load demo sources directly, this is not supported on mobile platforms as they don't support type=module -->
|
||||
<!-- alternatively load demo sources directly -->
|
||||
<!-- <script src="./browser.js" type="module"></script> -->
|
||||
<style>
|
||||
@font-face { font-family: 'Lato'; font-display: swap; font-style: normal; font-weight: 400; src: local('Lato'), url('../assets/lato.ttf') format('truetype'); }
|
||||
|
|
14
demo/menu.js
14
demo/menu.js
|
@ -33,12 +33,13 @@ function createCSS() {
|
|||
|
||||
.menu-list { margin-right: 0.8rem; }
|
||||
select:focus { outline: none; }
|
||||
.menu-list-item { background: ${theme.itemBackground}; color: ${theme.itemColor}; border: none; padding: 0.2rem; font-family: inherit; font-variant: inherit; border-radius: var(--rounded); font-weight: 800; }
|
||||
.menu-list-item { background: ${theme.itemBackground}; color: ${theme.itemColor}; border: none; padding: 0.2rem; font-family: inherit;
|
||||
font-variant: inherit; border-radius: var(--rounded); font-weight: 800; }
|
||||
|
||||
.menu-chart-title { padding: 0; font-size: 0.8rem; font-weight: 800; align-items: center}
|
||||
.menu-chart-canvas { background: transparent; margin: 0.2rem 0 0.2rem 0.6rem; }
|
||||
|
||||
.menu-button { border: 0; background: ${theme.buttonBackground}; width: -webkit-fill-available; padding: 8px; margin: 8px 0 8px 0; cursor: pointer; box-shadow: 4px 4px 4px 0 dimgrey;
|
||||
.menu-button { border: 0; background: ${theme.buttonBackground}; width: 100%; padding: 8px; margin: 8px 0 8px 0; cursor: pointer; box-shadow: 4px 4px 4px 0 dimgrey;
|
||||
border-radius: var(--rounded); justify-content: center; font-family: inherit; font-variant: inherit; font-size: 1rem; font-weight: 800; }
|
||||
.menu-button:hover { background: ${theme.buttonHover}; box-shadow: 4px 4px 4px 0 black; }
|
||||
.menu-button:focus { outline: none; }
|
||||
|
@ -46,15 +47,20 @@ function createCSS() {
|
|||
.menu-checkbox { width: 2.8rem; height: 1rem; background: ${theme.itemBackground}; margin: 0.5rem 0.8rem 0 0; position: relative; border-radius: var(--rounded); }
|
||||
.menu-checkbox:after { content: 'OFF'; color: ${theme.checkboxOff}; position: absolute; right: 0.2rem; top: -0.4rem; font-weight: 800; font-size: 0.5rem; }
|
||||
.menu-checkbox:before { content: 'ON'; color: ${theme.checkboxOn}; position: absolute; left: 0.3rem; top: -0.4rem; font-weight: 800; font-size: 0.5rem; }
|
||||
.menu-checkbox-label { width: 1.3rem; height: 0.8rem; cursor: pointer; position: absolute; top: 0.1rem; left: 0.1rem; z-index: 1; background: ${theme.checkboxOff}; border-radius: var(--rounded); transition: left 0.6s ease; }
|
||||
.menu-checkbox-label { width: 1.3rem; height: 0.8rem; cursor: pointer; position: absolute; top: 0.1rem; left: 0.1rem; z-index: 1; background: ${theme.checkboxOff};
|
||||
border-radius: var(--rounded); transition: left 0.6s ease; }
|
||||
|
||||
input[type=checkbox] { visibility: hidden; }
|
||||
input[type=checkbox]:checked + label { left: 1.4rem; background: ${theme.checkboxOn}; }
|
||||
|
||||
.menu-range { margin: 0 0.8rem 0 0; width: 5rem; background: transparent; color: ${theme.rangeBackground}; }
|
||||
.menu-range:before { content: attr(value); color: ${theme.rangeLabel}; margin: 0 0.4rem 0 0; font-weight: 800; font-size: 0.6rem; position: relative; top: 0.3rem; }
|
||||
.menu-range:before { color: ${theme.rangeLabel}; margin: 0 0.4rem 0 0; font-weight: 800; font-size: 0.6rem; position: relative; top: 0.3rem; content: attr(value); }
|
||||
|
||||
input[type=range] { -webkit-appearance: none; }
|
||||
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 1rem; cursor: pointer; background: ${theme.itemBackground}; border-radius: var(--rounded); border: 1px; }
|
||||
input[type=range]::-moz-range-track { width: 100%; height: 1rem; cursor: pointer; background: ${theme.itemBackground}; border-radius: var(--rounded); border: 1px; }
|
||||
input[type=range]::-webkit-slider-thumb { border: 1px solid #000000; margin-top: 0.05rem; height: 0.9rem; width: 1.5rem; border-radius: var(--rounded); background: ${theme.rangeBackground}; cursor: pointer; -webkit-appearance: none; }
|
||||
input[type=range]::-moz-range-thumb { border: 1px solid #000000; margin-top: 0.05rem; height: 0.9rem; width: 1.5rem; border-radius: var(--rounded); background: ${theme.rangeBackground}; cursor: pointer; -webkit-appearance: none; }
|
||||
|
||||
.svg-background { fill:darkslategrey; cursor:pointer; opacity: 0.6; }
|
||||
.svg-foreground { fill:white; cursor:pointer; opacity: 0.8; }
|
||||
|
|
|
@ -66,7 +66,7 @@ async function build(f, msg) {
|
|||
platform: 'browser',
|
||||
target: 'es2018',
|
||||
format: 'esm',
|
||||
external: ['fs'],
|
||||
external: ['fs', 'buffer', 'util'],
|
||||
};
|
||||
// only rebuilding esm module and demo application
|
||||
// for full production build use "npm run build"
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"inputs": {
|
||||
"demo/browser.js": {
|
||||
"bytes": 18511,
|
||||
"bytes": 18516,
|
||||
"imports": [
|
||||
{
|
||||
"path": "dist/human.esm.js"
|
||||
|
@ -19,11 +19,11 @@
|
|||
"imports": []
|
||||
},
|
||||
"demo/menu.js": {
|
||||
"bytes": 13466,
|
||||
"bytes": 13845,
|
||||
"imports": []
|
||||
},
|
||||
"dist/human.esm.js": {
|
||||
"bytes": 1278581,
|
||||
"bytes": 3442260,
|
||||
"imports": []
|
||||
}
|
||||
},
|
||||
|
@ -31,28 +31,25 @@
|
|||
"dist/demo-browser-index.js.map": {
|
||||
"imports": [],
|
||||
"inputs": {},
|
||||
"bytes": 5534501
|
||||
"bytes": 5419827
|
||||
},
|
||||
"dist/demo-browser-index.js": {
|
||||
"imports": [],
|
||||
"inputs": {
|
||||
"dist/human.esm.js": {
|
||||
"bytesInOutput": 1665015
|
||||
},
|
||||
"dist/human.esm.js": {
|
||||
"bytesInOutput": 8716
|
||||
"bytesInOutput": 3431560
|
||||
},
|
||||
"demo/draw.js": {
|
||||
"bytesInOutput": 8896
|
||||
"bytesInOutput": 8898
|
||||
},
|
||||
"demo/menu.js": {
|
||||
"bytesInOutput": 13425
|
||||
"bytesInOutput": 13813
|
||||
},
|
||||
"demo/browser.js": {
|
||||
"bytesInOutput": 16157
|
||||
"bytesInOutput": 16215
|
||||
}
|
||||
},
|
||||
"bytes": 1712331
|
||||
"bytes": 3470608
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,15 +1,15 @@
|
|||
{
|
||||
"inputs": {
|
||||
"config.js": {
|
||||
"bytes": 8366,
|
||||
"bytes": 8483,
|
||||
"imports": []
|
||||
},
|
||||
"package.json": {
|
||||
"bytes": 3417,
|
||||
"bytes": 3557,
|
||||
"imports": []
|
||||
},
|
||||
"src/age/age.js": {
|
||||
"bytes": 1908,
|
||||
"bytes": 1926,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/profile.js"
|
||||
|
@ -58,11 +58,11 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/body/modelBase.js": {
|
||||
"bytes": 883,
|
||||
"bytes": 901,
|
||||
"imports": []
|
||||
},
|
||||
"src/body/modelMobileNet.js": {
|
||||
"bytes": 593,
|
||||
"bytes": 611,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/body/modelBase.js"
|
||||
|
@ -70,7 +70,7 @@
|
|||
]
|
||||
},
|
||||
"src/body/modelPoseNet.js": {
|
||||
"bytes": 1922,
|
||||
"bytes": 1940,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/body/modelMobileNet.js"
|
||||
|
@ -120,7 +120,7 @@
|
|||
]
|
||||
},
|
||||
"src/emotion/emotion.js": {
|
||||
"bytes": 2924,
|
||||
"bytes": 2942,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/profile.js"
|
||||
|
@ -128,15 +128,15 @@
|
|||
]
|
||||
},
|
||||
"src/face/blazeface.js": {
|
||||
"bytes": 6937,
|
||||
"bytes": 6955,
|
||||
"imports": []
|
||||
},
|
||||
"src/face/box.js": {
|
||||
"bytes": 1929,
|
||||
"bytes": 1947,
|
||||
"imports": []
|
||||
},
|
||||
"src/face/facemesh.js": {
|
||||
"bytes": 2603,
|
||||
"bytes": 2621,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/face/blazeface.js"
|
||||
|
@ -156,7 +156,7 @@
|
|||
]
|
||||
},
|
||||
"src/face/facepipeline.js": {
|
||||
"bytes": 13695,
|
||||
"bytes": 13713,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/face/box.js"
|
||||
|
@ -186,7 +186,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/gender/gender.js": {
|
||||
"bytes": 3189,
|
||||
"bytes": 3207,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/profile.js"
|
||||
|
@ -202,11 +202,11 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/hand/box.js": {
|
||||
"bytes": 3220,
|
||||
"bytes": 3238,
|
||||
"imports": []
|
||||
},
|
||||
"src/hand/handdetector.js": {
|
||||
"bytes": 4230,
|
||||
"bytes": 4248,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/hand/box.js"
|
||||
|
@ -214,7 +214,7 @@
|
|||
]
|
||||
},
|
||||
"src/hand/handpipeline.js": {
|
||||
"bytes": 7541,
|
||||
"bytes": 7559,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/hand/box.js"
|
||||
|
@ -225,7 +225,7 @@
|
|||
]
|
||||
},
|
||||
"src/hand/handpose.js": {
|
||||
"bytes": 3029,
|
||||
"bytes": 3047,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/hand/handdetector.js"
|
||||
|
@ -243,7 +243,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytes": 13918,
|
||||
"bytes": 14315,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/face/facemesh.js"
|
||||
|
@ -281,7 +281,7 @@
|
|||
]
|
||||
},
|
||||
"src/image.js": {
|
||||
"bytes": 4648,
|
||||
"bytes": 4666,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/imagefx.js"
|
||||
|
@ -301,121 +301,133 @@
|
|||
"dist/human.esm-nobundle.js.map": {
|
||||
"imports": [],
|
||||
"inputs": {},
|
||||
"bytes": 620819
|
||||
"bytes": 780280
|
||||
},
|
||||
"dist/human.esm-nobundle.js": {
|
||||
"imports": [],
|
||||
"inputs": {
|
||||
"src/face/blazeface.js": {
|
||||
"bytesInOutput": 3103
|
||||
"bytesInOutput": 7075
|
||||
},
|
||||
"src/face/keypoints.js": {
|
||||
"bytesInOutput": 1945
|
||||
"bytesInOutput": 2768
|
||||
},
|
||||
"src/face/box.js": {
|
||||
"bytesInOutput": 1021
|
||||
"bytesInOutput": 2122
|
||||
},
|
||||
"src/face/util.js": {
|
||||
"bytesInOutput": 1171
|
||||
"bytesInOutput": 3043
|
||||
},
|
||||
"src/face/facepipeline.js": {
|
||||
"bytesInOutput": 5432
|
||||
"bytesInOutput": 12482
|
||||
},
|
||||
"src/face/uvcoords.js": {
|
||||
"bytesInOutput": 16785
|
||||
},
|
||||
"src/face/triangulation.js": {
|
||||
"bytesInOutput": 9990
|
||||
"bytesInOutput": 20584
|
||||
},
|
||||
"src/face/facemesh.js": {
|
||||
"bytesInOutput": 1303
|
||||
"bytesInOutput": 2641
|
||||
},
|
||||
"src/profile.js": {
|
||||
"bytesInOutput": 642
|
||||
"bytesInOutput": 1118
|
||||
},
|
||||
"src/age/age.js": {
|
||||
"bytesInOutput": 994
|
||||
"bytesInOutput": 1947
|
||||
},
|
||||
"src/gender/gender.js": {
|
||||
"bytesInOutput": 1474
|
||||
"bytesInOutput": 3108
|
||||
},
|
||||
"src/emotion/emotion.js": {
|
||||
"bytesInOutput": 1439
|
||||
"bytesInOutput": 2828
|
||||
},
|
||||
"src/body/modelBase.js": {
|
||||
"bytesInOutput": 455
|
||||
"bytesInOutput": 924
|
||||
},
|
||||
"src/body/modelMobileNet.js": {
|
||||
"bytesInOutput": 267
|
||||
"bytesInOutput": 533
|
||||
},
|
||||
"src/body/heapSort.js": {
|
||||
"bytesInOutput": 1041
|
||||
"bytesInOutput": 1637
|
||||
},
|
||||
"src/body/buildParts.js": {
|
||||
"bytesInOutput": 546
|
||||
"bytesInOutput": 1764
|
||||
},
|
||||
"src/body/keypoints.js": {
|
||||
"bytesInOutput": 1621
|
||||
"bytesInOutput": 2277
|
||||
},
|
||||
"src/body/vectors.js": {
|
||||
"bytesInOutput": 607
|
||||
"bytesInOutput": 1420
|
||||
},
|
||||
"src/body/decodePose.js": {
|
||||
"bytesInOutput": 1016
|
||||
"bytesInOutput": 3797
|
||||
},
|
||||
"src/body/decodeMultiple.js": {
|
||||
"bytesInOutput": 603
|
||||
"bytesInOutput": 2026
|
||||
},
|
||||
"src/body/util.js": {
|
||||
"bytesInOutput": 1053
|
||||
"bytesInOutput": 2410
|
||||
},
|
||||
"src/body/modelPoseNet.js": {
|
||||
"bytesInOutput": 994
|
||||
"bytesInOutput": 2083
|
||||
},
|
||||
"src/body/posenet.js": {
|
||||
"bytesInOutput": 459
|
||||
},
|
||||
"src/hand/box.js": {
|
||||
"bytesInOutput": 1444
|
||||
"bytesInOutput": 963
|
||||
},
|
||||
"src/hand/handdetector.js": {
|
||||
"bytesInOutput": 1876
|
||||
},
|
||||
"src/hand/util.js": {
|
||||
"bytesInOutput": 997
|
||||
"bytesInOutput": 4486
|
||||
},
|
||||
"src/hand/handpipeline.js": {
|
||||
"bytesInOutput": 2781
|
||||
"bytesInOutput": 7243
|
||||
},
|
||||
"src/hand/anchors.js": {
|
||||
"bytesInOutput": 127000
|
||||
"bytesInOutput": 256590
|
||||
},
|
||||
"src/hand/handpose.js": {
|
||||
"bytesInOutput": 1219
|
||||
"bytesInOutput": 3135
|
||||
},
|
||||
"src/gesture.js": {
|
||||
"bytesInOutput": 1601
|
||||
"bytesInOutput": 3038
|
||||
},
|
||||
"src/imagefx.js": {
|
||||
"bytesInOutput": 11013
|
||||
"bytesInOutput": 20097
|
||||
},
|
||||
"src/image.js": {
|
||||
"bytesInOutput": 2343
|
||||
},
|
||||
"config.js": {
|
||||
"bytesInOutput": 1279
|
||||
},
|
||||
"package.json": {
|
||||
"bytesInOutput": 3047
|
||||
"bytesInOutput": 4558
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 7348
|
||||
"bytesInOutput": 133
|
||||
},
|
||||
"src/face/triangulation.js": {
|
||||
"bytesInOutput": 17898
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 227
|
||||
},
|
||||
"src/hand/box.js": {
|
||||
"bytesInOutput": 3096
|
||||
},
|
||||
"src/hand/util.js": {
|
||||
"bytesInOutput": 2884
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 187
|
||||
},
|
||||
"config.js": {
|
||||
"bytesInOutput": 1933
|
||||
},
|
||||
"package.json": {
|
||||
"bytesInOutput": 0
|
||||
},
|
||||
"package.json": {
|
||||
"bytesInOutput": 23
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 11792
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 0
|
||||
}
|
||||
},
|
||||
"bytes": 216907
|
||||
"bytes": 418961
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
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 it is too large
Load Diff
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 it is too large
Load Diff
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
|
@ -1,15 +1,15 @@
|
|||
{
|
||||
"inputs": {
|
||||
"config.js": {
|
||||
"bytes": 8366,
|
||||
"bytes": 8483,
|
||||
"imports": []
|
||||
},
|
||||
"package.json": {
|
||||
"bytes": 3417,
|
||||
"bytes": 3557,
|
||||
"imports": []
|
||||
},
|
||||
"src/age/age.js": {
|
||||
"bytes": 1908,
|
||||
"bytes": 1926,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/profile.js"
|
||||
|
@ -58,11 +58,11 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/body/modelBase.js": {
|
||||
"bytes": 883,
|
||||
"bytes": 901,
|
||||
"imports": []
|
||||
},
|
||||
"src/body/modelMobileNet.js": {
|
||||
"bytes": 593,
|
||||
"bytes": 611,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/body/modelBase.js"
|
||||
|
@ -70,7 +70,7 @@
|
|||
]
|
||||
},
|
||||
"src/body/modelPoseNet.js": {
|
||||
"bytes": 1922,
|
||||
"bytes": 1940,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/body/modelMobileNet.js"
|
||||
|
@ -120,7 +120,7 @@
|
|||
]
|
||||
},
|
||||
"src/emotion/emotion.js": {
|
||||
"bytes": 2924,
|
||||
"bytes": 2942,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/profile.js"
|
||||
|
@ -128,15 +128,15 @@
|
|||
]
|
||||
},
|
||||
"src/face/blazeface.js": {
|
||||
"bytes": 6937,
|
||||
"bytes": 6955,
|
||||
"imports": []
|
||||
},
|
||||
"src/face/box.js": {
|
||||
"bytes": 1929,
|
||||
"bytes": 1947,
|
||||
"imports": []
|
||||
},
|
||||
"src/face/facemesh.js": {
|
||||
"bytes": 2603,
|
||||
"bytes": 2621,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/face/blazeface.js"
|
||||
|
@ -156,7 +156,7 @@
|
|||
]
|
||||
},
|
||||
"src/face/facepipeline.js": {
|
||||
"bytes": 13695,
|
||||
"bytes": 13713,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/face/box.js"
|
||||
|
@ -186,7 +186,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/gender/gender.js": {
|
||||
"bytes": 3189,
|
||||
"bytes": 3207,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/profile.js"
|
||||
|
@ -202,11 +202,11 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/hand/box.js": {
|
||||
"bytes": 3220,
|
||||
"bytes": 3238,
|
||||
"imports": []
|
||||
},
|
||||
"src/hand/handdetector.js": {
|
||||
"bytes": 4230,
|
||||
"bytes": 4248,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/hand/box.js"
|
||||
|
@ -214,7 +214,7 @@
|
|||
]
|
||||
},
|
||||
"src/hand/handpipeline.js": {
|
||||
"bytes": 7541,
|
||||
"bytes": 7559,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/hand/box.js"
|
||||
|
@ -225,7 +225,7 @@
|
|||
]
|
||||
},
|
||||
"src/hand/handpose.js": {
|
||||
"bytes": 3029,
|
||||
"bytes": 3047,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/hand/handdetector.js"
|
||||
|
@ -243,7 +243,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytes": 13918,
|
||||
"bytes": 14315,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/face/facemesh.js"
|
||||
|
@ -281,7 +281,7 @@
|
|||
]
|
||||
},
|
||||
"src/image.js": {
|
||||
"bytes": 4648,
|
||||
"bytes": 4666,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/imagefx.js"
|
||||
|
@ -301,121 +301,133 @@
|
|||
"dist/human.node-nobundle.js.map": {
|
||||
"imports": [],
|
||||
"inputs": {},
|
||||
"bytes": 635150
|
||||
"bytes": 794759
|
||||
},
|
||||
"dist/human.node-nobundle.js": {
|
||||
"imports": [],
|
||||
"inputs": {
|
||||
"src/face/blazeface.js": {
|
||||
"bytesInOutput": 3103
|
||||
"bytesInOutput": 7083
|
||||
},
|
||||
"src/face/keypoints.js": {
|
||||
"bytesInOutput": 1945
|
||||
"bytesInOutput": 2771
|
||||
},
|
||||
"src/face/box.js": {
|
||||
"bytesInOutput": 1021
|
||||
"bytesInOutput": 2133
|
||||
},
|
||||
"src/face/util.js": {
|
||||
"bytesInOutput": 1171
|
||||
"bytesInOutput": 3054
|
||||
},
|
||||
"src/face/facepipeline.js": {
|
||||
"bytesInOutput": 5432
|
||||
"bytesInOutput": 12462
|
||||
},
|
||||
"src/face/uvcoords.js": {
|
||||
"bytesInOutput": 16785
|
||||
},
|
||||
"src/face/triangulation.js": {
|
||||
"bytesInOutput": 9989
|
||||
"bytesInOutput": 20586
|
||||
},
|
||||
"src/face/facemesh.js": {
|
||||
"bytesInOutput": 1308
|
||||
"bytesInOutput": 2651
|
||||
},
|
||||
"src/profile.js": {
|
||||
"bytesInOutput": 642
|
||||
"bytesInOutput": 1120
|
||||
},
|
||||
"src/age/age.js": {
|
||||
"bytesInOutput": 994
|
||||
"bytesInOutput": 1910
|
||||
},
|
||||
"src/gender/gender.js": {
|
||||
"bytesInOutput": 1474
|
||||
"bytesInOutput": 3070
|
||||
},
|
||||
"src/emotion/emotion.js": {
|
||||
"bytesInOutput": 1439
|
||||
"bytesInOutput": 2786
|
||||
},
|
||||
"src/body/modelBase.js": {
|
||||
"bytesInOutput": 455
|
||||
"bytesInOutput": 942
|
||||
},
|
||||
"src/body/modelMobileNet.js": {
|
||||
"bytesInOutput": 267
|
||||
"bytesInOutput": 548
|
||||
},
|
||||
"src/body/heapSort.js": {
|
||||
"bytesInOutput": 1041
|
||||
"bytesInOutput": 1639
|
||||
},
|
||||
"src/body/buildParts.js": {
|
||||
"bytesInOutput": 546
|
||||
"bytesInOutput": 1766
|
||||
},
|
||||
"src/body/keypoints.js": {
|
||||
"bytesInOutput": 1621
|
||||
"bytesInOutput": 2288
|
||||
},
|
||||
"src/body/vectors.js": {
|
||||
"bytesInOutput": 607
|
||||
"bytesInOutput": 1428
|
||||
},
|
||||
"src/body/decodePose.js": {
|
||||
"bytesInOutput": 1016
|
||||
"bytesInOutput": 3799
|
||||
},
|
||||
"src/body/decodeMultiple.js": {
|
||||
"bytesInOutput": 603
|
||||
"bytesInOutput": 2028
|
||||
},
|
||||
"src/body/util.js": {
|
||||
"bytesInOutput": 1053
|
||||
"bytesInOutput": 2418
|
||||
},
|
||||
"src/body/modelPoseNet.js": {
|
||||
"bytesInOutput": 994
|
||||
"bytesInOutput": 2092
|
||||
},
|
||||
"src/body/posenet.js": {
|
||||
"bytesInOutput": 459
|
||||
},
|
||||
"src/hand/box.js": {
|
||||
"bytesInOutput": 1443
|
||||
"bytesInOutput": 977
|
||||
},
|
||||
"src/hand/handdetector.js": {
|
||||
"bytesInOutput": 1876
|
||||
},
|
||||
"src/hand/util.js": {
|
||||
"bytesInOutput": 996
|
||||
"bytesInOutput": 4504
|
||||
},
|
||||
"src/hand/handpipeline.js": {
|
||||
"bytesInOutput": 2781
|
||||
"bytesInOutput": 7242
|
||||
},
|
||||
"src/hand/anchors.js": {
|
||||
"bytesInOutput": 127000
|
||||
"bytesInOutput": 256592
|
||||
},
|
||||
"src/hand/handpose.js": {
|
||||
"bytesInOutput": 1219
|
||||
"bytesInOutput": 3148
|
||||
},
|
||||
"src/gesture.js": {
|
||||
"bytesInOutput": 1601
|
||||
"bytesInOutput": 3042
|
||||
},
|
||||
"src/imagefx.js": {
|
||||
"bytesInOutput": 11013
|
||||
"bytesInOutput": 20099
|
||||
},
|
||||
"src/image.js": {
|
||||
"bytesInOutput": 2343
|
||||
"bytesInOutput": 4563
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 47
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 152
|
||||
},
|
||||
"src/face/triangulation.js": {
|
||||
"bytesInOutput": 17898
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 227
|
||||
},
|
||||
"src/hand/box.js": {
|
||||
"bytesInOutput": 3107
|
||||
},
|
||||
"src/hand/util.js": {
|
||||
"bytesInOutput": 2884
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 187
|
||||
},
|
||||
"config.js": {
|
||||
"bytesInOutput": 1278
|
||||
"bytesInOutput": 1933
|
||||
},
|
||||
"package.json": {
|
||||
"bytesInOutput": 3047
|
||||
"bytesInOutput": 0
|
||||
},
|
||||
"package.json": {
|
||||
"bytesInOutput": 23
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 28
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 7348
|
||||
"bytesInOutput": 11797
|
||||
}
|
||||
},
|
||||
"bytes": 216914
|
||||
"bytes": 419228
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,6 +180,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@tensorflow/tfjs-backend-wasm": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-wasm/-/tfjs-backend-wasm-2.7.0.tgz",
|
||||
"integrity": "sha512-q1p6vR99kvxNjPMH4SMzg5R43g2ACmp3GRMoS2JVCruMyBWroD3KrmgXX2f94t0bl8BysW0JBkGXihajifjd6Q==",
|
||||
"requires": {
|
||||
"@types/emscripten": "~0.0.34"
|
||||
}
|
||||
},
|
||||
"@tensorflow/tfjs-backend-webgl": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-2.7.0.tgz",
|
||||
|
@ -273,6 +281,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@types/emscripten": {
|
||||
"version": "0.0.34",
|
||||
"resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-0.0.34.tgz",
|
||||
"integrity": "sha512-QSb9ojDincskc+uKMI0KXp8e1NALFINCrMlp8VGKGcTSxeEyRTTKyjWw75NYrCZHUsVEEEpr1tYHpbtaC++/sQ=="
|
||||
},
|
||||
"@types/json5": {
|
||||
"version": "0.0.29",
|
||||
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||
|
|
16
package.json
16
package.json
|
@ -19,7 +19,9 @@
|
|||
"type": "git",
|
||||
"url": "git+https://github.com/vladmandic/human.git"
|
||||
},
|
||||
"dependencies": {},
|
||||
"dependencies": {
|
||||
"@tensorflow/tfjs-backend-wasm": "^2.7.0"
|
||||
},
|
||||
"peerDependencies": {},
|
||||
"devDependencies": {
|
||||
"@tensorflow/tfjs": "^2.7.0",
|
||||
|
@ -43,12 +45,12 @@
|
|||
"lint": "eslint src/*.js demo/*.js",
|
||||
"dev": "npm install && node --trace-warnings --unhandled-rejections=strict --trace-uncaught --no-deprecation dev-server/dev-server.js",
|
||||
"changelog": "node dev-server/changelog.js",
|
||||
"build-iife": "esbuild --bundle --minify --platform=browser --sourcemap --target=es2018 --format=iife --external:fs --global-name=Human --metafile=dist/human.json --outfile=dist/human.js src/human.js",
|
||||
"build-esm-bundle": "esbuild --bundle --minify --platform=browser --sourcemap --target=es2018 --format=esm --external:fs --metafile=dist/human.esm.json --outfile=dist/human.esm.js src/human.js",
|
||||
"build-esm-nobundle": "esbuild --bundle --minify --platform=browser --sourcemap --target=es2018 --format=esm --external:@tensorflow --external:fs --metafile=dist/human.esm-nobundle.json --outfile=dist/human.esm-nobundle.js src/human.js",
|
||||
"build-node": "esbuild --bundle --minify --platform=node --sourcemap --target=es2018 --format=cjs --metafile=dist/human.node.json --outfile=dist/human.node.js src/human.js",
|
||||
"build-node-nobundle": "esbuild --bundle --minify --platform=node --sourcemap --target=es2018 --format=cjs --external:@tensorflow --metafile=dist/human.node.json --outfile=dist/human.node-nobundle.js src/human.js",
|
||||
"build-demo": "esbuild --bundle --log-level=error --platform=browser --sourcemap --target=es2018 --format=esm --external:fs --metafile=dist/demo-browser-index.json --outfile=dist/demo-browser-index.js demo/browser.js",
|
||||
"build-iife": "esbuild --bundle --platform=browser --sourcemap --target=es2018 --format=iife --external:fs --external:buffer --external:util --global-name=Human --metafile=dist/human.json --outfile=dist/human.js src/human.js",
|
||||
"build-esm-bundle": "esbuild --bundle --platform=browser --sourcemap --target=es2018 --format=esm --external:fs --external:buffer --external:util --metafile=dist/human.esm.json --outfile=dist/human.esm.js src/human.js",
|
||||
"build-esm-nobundle": "esbuild --bundle --platform=browser --sourcemap --target=es2018 --format=esm --external:@tensorflow --external:fs --external:buffer --external:util --metafile=dist/human.esm-nobundle.json --outfile=dist/human.esm-nobundle.js src/human.js",
|
||||
"build-node": "esbuild --bundle --platform=node --sourcemap --target=es2018 --format=cjs --metafile=dist/human.node.json --outfile=dist/human.node.js src/human.js",
|
||||
"build-node-nobundle": "esbuild --bundle --platform=node --sourcemap --target=es2018 --format=cjs --external:@tensorflow --metafile=dist/human.node.json --outfile=dist/human.node-nobundle.js src/human.js",
|
||||
"build-demo": "esbuild --bundle --log-level=error --platform=browser --sourcemap --target=es2018 --format=esm --external:fs --external:buffer --external:util --metafile=dist/demo-browser-index.json --outfile=dist/demo-browser-index.js demo/browser.js",
|
||||
"build": "rimraf dist/* && npm run build-iife && npm run build-esm-bundle && npm run build-esm-nobundle && npm run build-node && npm run build-node-nobundle && npm run build-demo && npm run changelog",
|
||||
"update": "npm update --depth 20 --force && npm dedupe && npm prune && npm audit"
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
const profile = require('../profile.js');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as profile from '../profile.js';
|
||||
|
||||
const models = {};
|
||||
let last = { age: 0 };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const heapSort = require('./heapSort');
|
||||
import * as heapSort from './heapSort';
|
||||
|
||||
function scoreIsMaximumInLocalWindow(keypointId, score, heatmapY, heatmapX, localMaximumRadius, scores) {
|
||||
const [height, width] = scores.shape;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const buildParts = require('./buildParts');
|
||||
const decodePose = require('./decodePose');
|
||||
const vectors = require('./vectors');
|
||||
import * as buildParts from './buildParts';
|
||||
import * as decodePose from './decodePose';
|
||||
import * as vectors from './vectors';
|
||||
|
||||
function withinNmsRadiusOfCorrespondingPoint(poses, squaredNmsRadius, { x, y }, keypointId) {
|
||||
return poses.some(({ keypoints }) => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const keypoints = require('./keypoints');
|
||||
const vectors = require('./vectors');
|
||||
import * as keypoints from './keypoints';
|
||||
import * as vectors from './vectors';
|
||||
|
||||
const parentChildrenTuples = keypoints.poseChain.map(([parentJoinName, childJoinName]) => ([keypoints.partIds[parentJoinName], keypoints.partIds[childJoinName]]));
|
||||
const parentToChildEdges = parentChildrenTuples.map(([, childJointId]) => childJointId);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
const kpt = require('./keypoints');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as kpt from './keypoints';
|
||||
|
||||
function getPointsConfidence(heatmapScores, heatMapCoords) {
|
||||
const numKeypoints = heatMapCoords.shape[0];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
|
||||
class BaseModel {
|
||||
constructor(model, outputStride) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
const modelBase = require('./modelBase');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as modelBase from './modelBase';
|
||||
|
||||
class MobileNet extends modelBase.BaseModel {
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
const modelMobileNet = require('./modelMobileNet');
|
||||
const decodeMultiple = require('./decodeMultiple');
|
||||
const util = require('./util');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as modelMobileNet from './modelMobileNet';
|
||||
import * as decodeMultiple from './decodeMultiple';
|
||||
import * as util from './util';
|
||||
|
||||
class PoseNet {
|
||||
constructor(net) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const modelMobileNet = require('./modelMobileNet');
|
||||
const modelPoseNet = require('./modelPoseNet');
|
||||
const decodeMultiple = require('./decodeMultiple');
|
||||
const keypoints = require('./keypoints');
|
||||
const util = require('./util');
|
||||
import * as modelMobileNet from './modelMobileNet';
|
||||
import * as modelPoseNet from './modelPoseNet';
|
||||
import * as decodeMultiple from './decodeMultiple';
|
||||
import * as keypoints from './keypoints';
|
||||
import * as util from './util';
|
||||
|
||||
exports.load = modelPoseNet.load;
|
||||
exports.PoseNet = modelPoseNet.PoseNet;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const kpt = require('./keypoints');
|
||||
import * as kpt from './keypoints';
|
||||
|
||||
function eitherPointDoesntMeetConfidence(a, b, minConfidence) {
|
||||
return (a < minConfidence || b < minConfidence);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const kpt = require('./keypoints');
|
||||
import * as kpt from './keypoints';
|
||||
|
||||
function getOffsetPoint(y, x, keypoint, offsets) {
|
||||
return {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
const profile = require('../profile.js');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as profile from '../profile.js';
|
||||
|
||||
const annotations = ['angry', 'disgust', 'fear', 'happy', 'sad', 'surpise', 'neutral'];
|
||||
const models = {};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
|
||||
const NUM_LANDMARKS = 6;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
|
||||
function scaleBoxCoordinates(box, factor) {
|
||||
const startPoint = [box.startPoint[0] * factor[0], box.startPoint[1] * factor[1]];
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
const blazeface = require('./blazeface');
|
||||
const keypoints = require('./keypoints');
|
||||
const pipe = require('./facepipeline');
|
||||
const uv_coords = require('./uvcoords');
|
||||
const triangulation = require('./triangulation').default;
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as blazeface from './blazeface';
|
||||
import * as keypoints from './keypoints';
|
||||
import * as pipe from './facepipeline';
|
||||
import * as uv_coords from './uvcoords';
|
||||
import * as triangulation from './triangulation';
|
||||
|
||||
class MediaPipeFaceMesh {
|
||||
constructor(blazeFace, blazeMeshModel, irisModel, config) {
|
||||
|
@ -58,4 +58,4 @@ async function load(config) {
|
|||
exports.load = load;
|
||||
exports.MediaPipeFaceMesh = MediaPipeFaceMesh;
|
||||
exports.uv_coords = uv_coords;
|
||||
exports.triangulation = triangulation;
|
||||
exports.triangulation = triangulation.default;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable class-methods-use-this */
|
||||
const tf = require('@tensorflow/tfjs');
|
||||
const bounding = require('./box');
|
||||
const keypoints = require('./keypoints');
|
||||
const util = require('./util');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as bounding from './box';
|
||||
import * as keypoints from './keypoints';
|
||||
import * as util from './util';
|
||||
|
||||
const LANDMARKS_COUNT = 468;
|
||||
const MESH_MOUTH_INDEX = 13;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
const profile = require('../profile.js');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as profile from '../profile.js';
|
||||
|
||||
const models = {};
|
||||
let last = { gender: '' };
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
const tf = require('@tensorflow/tfjs');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
|
||||
function getBoxSize(box) {
|
||||
return [
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
* =============================================================================
|
||||
*/
|
||||
|
||||
const tf = require('@tensorflow/tfjs');
|
||||
const box = require('./box');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as box from './box';
|
||||
|
||||
class HandDetector {
|
||||
constructor(model, inputSize, anchorsAnnotated) {
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
* =============================================================================
|
||||
*/
|
||||
|
||||
const tf = require('@tensorflow/tfjs');
|
||||
const box = require('./box');
|
||||
const util = require('./util');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as box from './box';
|
||||
import * as util from './util';
|
||||
|
||||
const PALM_BOX_SHIFT_VECTOR = [0, -0.4];
|
||||
const PALM_BOX_ENLARGE_FACTOR = 3;
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
*/
|
||||
// https://storage.googleapis.com/tfjs-models/demos/handpose/index.html
|
||||
|
||||
const tf = require('@tensorflow/tfjs');
|
||||
const handdetector = require('./handdetector');
|
||||
const pipeline = require('./handpipeline');
|
||||
const anchors = require('./anchors');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as handdetector from './handdetector';
|
||||
import * as pipeline from './handpipeline';
|
||||
import * as anchors from './anchors';
|
||||
|
||||
const MESH_ANNOTATIONS = {
|
||||
thumb: [1, 2, 3, 4],
|
||||
|
|
38
src/human.js
38
src/human.js
|
@ -1,15 +1,16 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
const facemesh = require('./face/facemesh.js');
|
||||
const age = require('./age/age.js');
|
||||
const gender = require('./gender/gender.js');
|
||||
const emotion = require('./emotion/emotion.js');
|
||||
const posenet = require('./body/posenet.js');
|
||||
const handpose = require('./hand/handpose.js');
|
||||
const gesture = require('./gesture.js');
|
||||
const image = require('./image.js');
|
||||
const profile = require('./profile.js');
|
||||
const defaults = require('../config.js').default;
|
||||
const app = require('../package.json');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import { setWasmPaths } from '@tensorflow/tfjs-backend-wasm/dist/index.js';
|
||||
import * as facemesh from './face/facemesh.js';
|
||||
import * as age from './age/age.js';
|
||||
import * as gender from './gender/gender.js';
|
||||
import * as emotion from './emotion/emotion.js';
|
||||
import * as posenet from './body/posenet.js';
|
||||
import * as handpose from './hand/handpose.js';
|
||||
import * as gesture from './gesture.js';
|
||||
import * as image from './image.js';
|
||||
import * as profile from './profile.js';
|
||||
import * as config from '../config.js';
|
||||
import * as app from '../package.json';
|
||||
|
||||
// static config override for non-video detection
|
||||
const disableSkipFrames = {
|
||||
|
@ -45,7 +46,7 @@ class Human {
|
|||
constructor(userConfig = {}) {
|
||||
this.tf = tf;
|
||||
this.version = app.version;
|
||||
this.config = mergeDeep(defaults, userConfig);
|
||||
this.config = mergeDeep(config.default, userConfig);
|
||||
this.fx = null;
|
||||
this.state = 'idle';
|
||||
this.numTensors = 0;
|
||||
|
@ -163,7 +164,16 @@ class Human {
|
|||
this.log('Backend not registred:', this.config.backend);
|
||||
}
|
||||
*/
|
||||
|
||||
this.log('setting backend:', this.config.backend);
|
||||
|
||||
if (this.config.backend === 'wasm') {
|
||||
this.log('settings wasm path:', this.config.wasmPath);
|
||||
setWasmPaths(this.config.wasmPath);
|
||||
const simd = await tf.env().getAsync('WASM_HAS_SIMD_SUPPORT');
|
||||
if (!simd) this.log('warning: wasm simd support is not enabled');
|
||||
}
|
||||
|
||||
await tf.setBackend(this.config.backend);
|
||||
tf.enableProdMode();
|
||||
/* debug mode is really too mcuh
|
||||
|
@ -171,7 +181,7 @@ class Human {
|
|||
*/
|
||||
if (this.config.backend === 'webgl') {
|
||||
if (this.config.deallocate) {
|
||||
this.log('Changing WebGL: WEBGL_DELETE_TEXTURE_THRESHOLD:', this.config.deallocate);
|
||||
this.log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', this.config.deallocate);
|
||||
tf.ENV.set('WEBGL_DELETE_TEXTURE_THRESHOLD', this.config.deallocate ? 0 : -1);
|
||||
}
|
||||
// tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const tf = require('@tensorflow/tfjs');
|
||||
const fxImage = require('./imagefx.js');
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import * as fxImage from './imagefx.js';
|
||||
|
||||
// internal temp canvases
|
||||
let inCanvas = null;
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit 17d21d19953ab16616c4a07423c0eada76577686
|
||||
Subproject commit 6674208a10ed65d0737bb5c2b05b67f2b70fab19
|
Loading…
Reference in New Issue