mirror of https://github.com/vladmandic/human
code cleanup and enable minification
parent
01aeb1cd30
commit
f9c0e8cd41
10
config.js
10
config.js
|
@ -144,16 +144,6 @@ export default {
|
|||
modelType: 'MobileNet', // Human includes MobileNet version, but you can switch to ResNet
|
||||
},
|
||||
|
||||
pose: { // TBD: not currently in use
|
||||
enabled: false,
|
||||
scoreThreshold: 0.6, // threshold for deciding when to remove boxes based on score
|
||||
// in non-maximum suppression
|
||||
iouThreshold: 0.3, // threshold for deciding whether boxes overlap too much
|
||||
// in non-maximum suppression
|
||||
modelPath: '../models/blazepose.json',
|
||||
inputSize: 256, // fixed value
|
||||
},
|
||||
|
||||
hand: {
|
||||
enabled: true,
|
||||
rotation: false, // use best-guess rotated hand image or just box with rotation as-is
|
||||
|
|
|
@ -512,7 +512,8 @@ function setupMenu() {
|
|||
}
|
||||
|
||||
async function main() {
|
||||
log('demo starting ...');
|
||||
log('Demo starting ...');
|
||||
log('Browser:', navigator?.userAgent);
|
||||
setupMenu();
|
||||
document.getElementById('log').innerText = `Human: version ${human.version}`;
|
||||
if (ui.modelsPreload && !ui.useWorker) {
|
||||
|
@ -526,7 +527,7 @@ async function main() {
|
|||
status('human: ready');
|
||||
document.getElementById('loader').style.display = 'none';
|
||||
document.getElementById('play').style.display = 'block';
|
||||
log('ready');
|
||||
log('Demo ready...');
|
||||
}
|
||||
|
||||
window.onload = main;
|
||||
|
|
|
@ -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 & Gesture Recognition; Author: Vladimir Mandic <https://github.com/vladmandic>">
|
||||
<meta name="description" content="Human: 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.3, maximum-scale=3.0, shrink-to-fit=yes, user-scalable=yes">
|
||||
<meta name="theme-color" content="#000000"/>
|
||||
<meta name="application-name" content="Human">
|
||||
|
@ -39,7 +39,7 @@
|
|||
.canvas { margin: 0 auto; }
|
||||
.bench { position: absolute; right: 0; bottom: 0; }
|
||||
.compare-image { width: 200px; position: absolute; top: 150px; left: 30px; box-shadow: 0 0 2px 2px black; background: black; }
|
||||
.loader { width: 300px; height: 300px; border: 3px solid transparent; border-radius: 50%; border-top: 4px solid #f15e41; animation: spin 4s linear infinite; position: absolute; top: 30%; left: 50%; margin-left: -150px; z-index: 15; }
|
||||
.loader { width: 300px; height: 300px; border: 3px solid transparent; border-radius: 50%; border-top: 4px solid #f15e41; animation: spin 4s linear infinite; position: absolute; bottom: 25%; left: 50%; margin-left: -150px; z-index: 15; }
|
||||
.loader::before, .loader::after { content: ""; position: absolute; top: 6px; bottom: 6px; left: 6px; right: 6px; border-radius: 50%; border: 4px solid transparent; }
|
||||
.loader::before { border-top-color: #bad375; animation: 3s spin linear infinite; }
|
||||
.loader::after { border-top-color: #26a9e0; animation: spin 1.5s linear infinite; }
|
||||
|
|
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": {
|
||||
"dist/human.esm.js": {
|
||||
"bytes": 1907681,
|
||||
"bytes": 1356931,
|
||||
"imports": []
|
||||
},
|
||||
"demo/draw.js": {
|
||||
|
@ -17,7 +17,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"demo/browser.js": {
|
||||
"bytes": 25500,
|
||||
"bytes": 25549,
|
||||
"imports": [
|
||||
{
|
||||
"path": "dist/human.esm.js"
|
||||
|
@ -38,29 +38,29 @@
|
|||
"dist/demo-browser-index.js.map": {
|
||||
"imports": [],
|
||||
"inputs": {},
|
||||
"bytes": 2030116
|
||||
"bytes": 2031083
|
||||
},
|
||||
"dist/demo-browser-index.js": {
|
||||
"imports": [],
|
||||
"exports": [],
|
||||
"inputs": {
|
||||
"dist/human.esm.js": {
|
||||
"bytesInOutput": 1900306
|
||||
"bytesInOutput": 1348397
|
||||
},
|
||||
"demo/draw.js": {
|
||||
"bytesInOutput": 7736
|
||||
"bytesInOutput": 6175
|
||||
},
|
||||
"demo/menu.js": {
|
||||
"bytesInOutput": 11792
|
||||
"bytesInOutput": 10696
|
||||
},
|
||||
"demo/gl-bench.js": {
|
||||
"bytesInOutput": 7367
|
||||
"bytesInOutput": 6759
|
||||
},
|
||||
"demo/browser.js": {
|
||||
"bytesInOutput": 19424
|
||||
"bytesInOutput": 16815
|
||||
}
|
||||
},
|
||||
"bytes": 1954010
|
||||
"bytes": 1396227
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
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
|
@ -5,7 +5,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"dist/tfjs.esm.js": {
|
||||
"bytes": 1592080,
|
||||
"bytes": 1082102,
|
||||
"imports": []
|
||||
},
|
||||
"src/tfjs/backend.js": {
|
||||
|
@ -263,17 +263,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"src/blazepose/blazepose.js": {
|
||||
"bytes": 856,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/log.js"
|
||||
},
|
||||
{
|
||||
"path": "dist/tfjs.esm.js"
|
||||
}
|
||||
]
|
||||
},
|
||||
"src/handpose/box.js": {
|
||||
"bytes": 2522,
|
||||
"imports": [
|
||||
|
@ -361,7 +350,7 @@
|
|||
]
|
||||
},
|
||||
"config.js": {
|
||||
"bytes": 10110,
|
||||
"bytes": 9644,
|
||||
"imports": []
|
||||
},
|
||||
"src/sample.js": {
|
||||
|
@ -373,7 +362,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytes": 18921,
|
||||
"bytes": 18179,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/log.js"
|
||||
|
@ -402,9 +391,6 @@
|
|||
{
|
||||
"path": "src/posenet/posenet.js"
|
||||
},
|
||||
{
|
||||
"path": "src/blazepose/blazepose.js"
|
||||
},
|
||||
{
|
||||
"path": "src/handpose/handpose.js"
|
||||
},
|
||||
|
@ -433,7 +419,7 @@
|
|||
"dist/human.esm.js.map": {
|
||||
"imports": [],
|
||||
"inputs": {},
|
||||
"bytes": 1934763
|
||||
"bytes": 1935222
|
||||
},
|
||||
"dist/human.esm.js": {
|
||||
"imports": [],
|
||||
|
@ -442,124 +428,121 @@
|
|||
],
|
||||
"inputs": {
|
||||
"src/blazeface/blazeface.js": {
|
||||
"bytesInOutput": 5039
|
||||
"bytesInOutput": 2915
|
||||
},
|
||||
"src/blazeface/box.js": {
|
||||
"bytesInOutput": 1567
|
||||
"bytesInOutput": 987
|
||||
},
|
||||
"src/blazeface/util.js": {
|
||||
"bytesInOutput": 2418
|
||||
"bytesInOutput": 1197
|
||||
},
|
||||
"src/blazeface/coords.js": {
|
||||
"bytesInOutput": 30718
|
||||
"bytesInOutput": 30534
|
||||
},
|
||||
"src/blazeface/facepipeline.js": {
|
||||
"bytesInOutput": 9386
|
||||
"bytesInOutput": 5598
|
||||
},
|
||||
"src/blazeface/facemesh.js": {
|
||||
"bytesInOutput": 2322
|
||||
"bytesInOutput": 1518
|
||||
},
|
||||
"src/profile.js": {
|
||||
"bytesInOutput": 851
|
||||
"bytesInOutput": 637
|
||||
},
|
||||
"src/age/age.js": {
|
||||
"bytesInOutput": 1193
|
||||
"bytesInOutput": 813
|
||||
},
|
||||
"src/gender/gender.js": {
|
||||
"bytesInOutput": 1922
|
||||
"bytesInOutput": 1283
|
||||
},
|
||||
"src/emotion/emotion.js": {
|
||||
"bytesInOutput": 1820
|
||||
"bytesInOutput": 1247
|
||||
},
|
||||
"src/embedding/embedding.js": {
|
||||
"bytesInOutput": 1330
|
||||
"bytesInOutput": 870
|
||||
},
|
||||
"src/posenet/modelBase.js": {
|
||||
"bytesInOutput": 1055
|
||||
"bytesInOutput": 679
|
||||
},
|
||||
"src/posenet/heapSort.js": {
|
||||
"bytesInOutput": 1144
|
||||
"bytesInOutput": 1048
|
||||
},
|
||||
"src/posenet/buildParts.js": {
|
||||
"bytesInOutput": 1287
|
||||
"bytesInOutput": 529
|
||||
},
|
||||
"src/posenet/keypoints.js": {
|
||||
"bytesInOutput": 1813
|
||||
"bytesInOutput": 1638
|
||||
},
|
||||
"src/posenet/vectors.js": {
|
||||
"bytesInOutput": 1055
|
||||
},
|
||||
"src/posenet/decoders.js": {
|
||||
"bytesInOutput": 1709
|
||||
},
|
||||
"src/posenet/decodePose.js": {
|
||||
"bytesInOutput": 4098
|
||||
},
|
||||
"src/posenet/decodeMultiple.js": {
|
||||
"bytesInOutput": 1643
|
||||
},
|
||||
"src/posenet/util.js": {
|
||||
"bytesInOutput": 1892
|
||||
},
|
||||
"src/posenet/modelPoseNet.js": {
|
||||
"bytesInOutput": 1997
|
||||
},
|
||||
"src/posenet/posenet.js": {
|
||||
"bytesInOutput": 627
|
||||
},
|
||||
"src/posenet/decoders.js": {
|
||||
"bytesInOutput": 875
|
||||
},
|
||||
"src/posenet/decodePose.js": {
|
||||
"bytesInOutput": 1482
|
||||
},
|
||||
"src/posenet/decodeMultiple.js": {
|
||||
"bytesInOutput": 704
|
||||
},
|
||||
"src/posenet/util.js": {
|
||||
"bytesInOutput": 1065
|
||||
},
|
||||
"src/posenet/modelPoseNet.js": {
|
||||
"bytesInOutput": 1167
|
||||
},
|
||||
"src/posenet/posenet.js": {
|
||||
"bytesInOutput": 401
|
||||
},
|
||||
"src/handpose/handdetector.js": {
|
||||
"bytesInOutput": 2747
|
||||
"bytesInOutput": 1704
|
||||
},
|
||||
"src/handpose/handpipeline.js": {
|
||||
"bytesInOutput": 4484
|
||||
"bytesInOutput": 2485
|
||||
},
|
||||
"src/handpose/anchors.js": {
|
||||
"bytesInOutput": 127037
|
||||
"bytesInOutput": 127006
|
||||
},
|
||||
"src/handpose/handpose.js": {
|
||||
"bytesInOutput": 2023
|
||||
"bytesInOutput": 1331
|
||||
},
|
||||
"src/gesture/gesture.js": {
|
||||
"bytesInOutput": 3162
|
||||
"bytesInOutput": 2424
|
||||
},
|
||||
"src/imagefx.js": {
|
||||
"bytesInOutput": 13630
|
||||
"bytesInOutput": 11004
|
||||
},
|
||||
"src/image.js": {
|
||||
"bytesInOutput": 3652
|
||||
"bytesInOutput": 2479
|
||||
},
|
||||
"src/log.js": {
|
||||
"bytesInOutput": 266
|
||||
"bytesInOutput": 252
|
||||
},
|
||||
"dist/tfjs.esm.js": {
|
||||
"bytesInOutput": 1591040
|
||||
"bytesInOutput": 1073222
|
||||
},
|
||||
"src/tfjs/backend.js": {
|
||||
"bytesInOutput": 918
|
||||
"bytesInOutput": 720
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 12660
|
||||
},
|
||||
"src/blazepose/blazepose.js": {
|
||||
"bytesInOutput": 572
|
||||
"bytesInOutput": 9950
|
||||
},
|
||||
"src/handpose/box.js": {
|
||||
"bytesInOutput": 1420
|
||||
"bytesInOutput": 938
|
||||
},
|
||||
"src/handpose/util.js": {
|
||||
"bytesInOutput": 1796
|
||||
"bytesInOutput": 816
|
||||
},
|
||||
"config.js": {
|
||||
"bytesInOutput": 1617
|
||||
"bytesInOutput": 1460
|
||||
},
|
||||
"src/sample.js": {
|
||||
"bytesInOutput": 55299
|
||||
"bytesInOutput": 55295
|
||||
},
|
||||
"package.json": {
|
||||
"bytesInOutput": 23
|
||||
"bytesInOutput": 16
|
||||
}
|
||||
},
|
||||
"bytes": 1907681
|
||||
"bytes": 1356931
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -5,7 +5,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"dist/tfjs.esm.js": {
|
||||
"bytes": 1592080,
|
||||
"bytes": 1082102,
|
||||
"imports": []
|
||||
},
|
||||
"src/tfjs/backend.js": {
|
||||
|
@ -263,17 +263,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"src/blazepose/blazepose.js": {
|
||||
"bytes": 856,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/log.js"
|
||||
},
|
||||
{
|
||||
"path": "dist/tfjs.esm.js"
|
||||
}
|
||||
]
|
||||
},
|
||||
"src/handpose/box.js": {
|
||||
"bytes": 2522,
|
||||
"imports": [
|
||||
|
@ -361,7 +350,7 @@
|
|||
]
|
||||
},
|
||||
"config.js": {
|
||||
"bytes": 10110,
|
||||
"bytes": 9644,
|
||||
"imports": []
|
||||
},
|
||||
"src/sample.js": {
|
||||
|
@ -373,7 +362,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytes": 18921,
|
||||
"bytes": 18179,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/log.js"
|
||||
|
@ -402,9 +391,6 @@
|
|||
{
|
||||
"path": "src/posenet/posenet.js"
|
||||
},
|
||||
{
|
||||
"path": "src/blazepose/blazepose.js"
|
||||
},
|
||||
{
|
||||
"path": "src/handpose/handpose.js"
|
||||
},
|
||||
|
@ -433,131 +419,128 @@
|
|||
"dist/human.js.map": {
|
||||
"imports": [],
|
||||
"inputs": {},
|
||||
"bytes": 1934780
|
||||
"bytes": 1935239
|
||||
},
|
||||
"dist/human.js": {
|
||||
"imports": [],
|
||||
"exports": [],
|
||||
"inputs": {
|
||||
"src/blazeface/blazeface.js": {
|
||||
"bytesInOutput": 5039
|
||||
"bytesInOutput": 2915
|
||||
},
|
||||
"src/blazeface/box.js": {
|
||||
"bytesInOutput": 1567
|
||||
"bytesInOutput": 987
|
||||
},
|
||||
"src/blazeface/util.js": {
|
||||
"bytesInOutput": 2418
|
||||
"bytesInOutput": 1197
|
||||
},
|
||||
"src/blazeface/coords.js": {
|
||||
"bytesInOutput": 30718
|
||||
"bytesInOutput": 30534
|
||||
},
|
||||
"src/blazeface/facepipeline.js": {
|
||||
"bytesInOutput": 9386
|
||||
"bytesInOutput": 5598
|
||||
},
|
||||
"src/blazeface/facemesh.js": {
|
||||
"bytesInOutput": 2322
|
||||
"bytesInOutput": 1518
|
||||
},
|
||||
"src/profile.js": {
|
||||
"bytesInOutput": 851
|
||||
"bytesInOutput": 637
|
||||
},
|
||||
"src/age/age.js": {
|
||||
"bytesInOutput": 1193
|
||||
"bytesInOutput": 813
|
||||
},
|
||||
"src/gender/gender.js": {
|
||||
"bytesInOutput": 1922
|
||||
"bytesInOutput": 1283
|
||||
},
|
||||
"src/emotion/emotion.js": {
|
||||
"bytesInOutput": 1820
|
||||
"bytesInOutput": 1247
|
||||
},
|
||||
"src/embedding/embedding.js": {
|
||||
"bytesInOutput": 1330
|
||||
"bytesInOutput": 870
|
||||
},
|
||||
"src/posenet/modelBase.js": {
|
||||
"bytesInOutput": 1055
|
||||
"bytesInOutput": 679
|
||||
},
|
||||
"src/posenet/heapSort.js": {
|
||||
"bytesInOutput": 1144
|
||||
"bytesInOutput": 1048
|
||||
},
|
||||
"src/posenet/buildParts.js": {
|
||||
"bytesInOutput": 1287
|
||||
"bytesInOutput": 529
|
||||
},
|
||||
"src/posenet/keypoints.js": {
|
||||
"bytesInOutput": 1813
|
||||
"bytesInOutput": 1638
|
||||
},
|
||||
"src/posenet/vectors.js": {
|
||||
"bytesInOutput": 1055
|
||||
},
|
||||
"src/posenet/decoders.js": {
|
||||
"bytesInOutput": 1709
|
||||
},
|
||||
"src/posenet/decodePose.js": {
|
||||
"bytesInOutput": 4098
|
||||
},
|
||||
"src/posenet/decodeMultiple.js": {
|
||||
"bytesInOutput": 1643
|
||||
},
|
||||
"src/posenet/util.js": {
|
||||
"bytesInOutput": 1892
|
||||
},
|
||||
"src/posenet/modelPoseNet.js": {
|
||||
"bytesInOutput": 1997
|
||||
},
|
||||
"src/posenet/posenet.js": {
|
||||
"bytesInOutput": 627
|
||||
},
|
||||
"src/posenet/decoders.js": {
|
||||
"bytesInOutput": 875
|
||||
},
|
||||
"src/posenet/decodePose.js": {
|
||||
"bytesInOutput": 1482
|
||||
},
|
||||
"src/posenet/decodeMultiple.js": {
|
||||
"bytesInOutput": 704
|
||||
},
|
||||
"src/posenet/util.js": {
|
||||
"bytesInOutput": 1065
|
||||
},
|
||||
"src/posenet/modelPoseNet.js": {
|
||||
"bytesInOutput": 1167
|
||||
},
|
||||
"src/posenet/posenet.js": {
|
||||
"bytesInOutput": 401
|
||||
},
|
||||
"src/handpose/handdetector.js": {
|
||||
"bytesInOutput": 2747
|
||||
"bytesInOutput": 1704
|
||||
},
|
||||
"src/handpose/handpipeline.js": {
|
||||
"bytesInOutput": 4484
|
||||
"bytesInOutput": 2485
|
||||
},
|
||||
"src/handpose/anchors.js": {
|
||||
"bytesInOutput": 127037
|
||||
"bytesInOutput": 127006
|
||||
},
|
||||
"src/handpose/handpose.js": {
|
||||
"bytesInOutput": 2023
|
||||
"bytesInOutput": 1331
|
||||
},
|
||||
"src/gesture/gesture.js": {
|
||||
"bytesInOutput": 3162
|
||||
"bytesInOutput": 2424
|
||||
},
|
||||
"src/imagefx.js": {
|
||||
"bytesInOutput": 13630
|
||||
"bytesInOutput": 11004
|
||||
},
|
||||
"src/image.js": {
|
||||
"bytesInOutput": 3652
|
||||
"bytesInOutput": 2479
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 12725
|
||||
"bytesInOutput": 9986
|
||||
},
|
||||
"src/log.js": {
|
||||
"bytesInOutput": 266
|
||||
"bytesInOutput": 252
|
||||
},
|
||||
"dist/tfjs.esm.js": {
|
||||
"bytesInOutput": 1591040
|
||||
"bytesInOutput": 1073222
|
||||
},
|
||||
"src/tfjs/backend.js": {
|
||||
"bytesInOutput": 918
|
||||
},
|
||||
"src/blazepose/blazepose.js": {
|
||||
"bytesInOutput": 572
|
||||
"bytesInOutput": 720
|
||||
},
|
||||
"src/handpose/box.js": {
|
||||
"bytesInOutput": 1420
|
||||
"bytesInOutput": 938
|
||||
},
|
||||
"src/handpose/util.js": {
|
||||
"bytesInOutput": 1796
|
||||
"bytesInOutput": 816
|
||||
},
|
||||
"config.js": {
|
||||
"bytesInOutput": 1617
|
||||
"bytesInOutput": 1460
|
||||
},
|
||||
"src/sample.js": {
|
||||
"bytesInOutput": 55299
|
||||
"bytesInOutput": 55295
|
||||
},
|
||||
"package.json": {
|
||||
"bytesInOutput": 23
|
||||
"bytesInOutput": 16
|
||||
}
|
||||
},
|
||||
"bytes": 1907759
|
||||
"bytes": 1356973
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
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
|
@ -5,7 +5,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"dist/tfjs.esm.js": {
|
||||
"bytes": 1056,
|
||||
"bytes": 681,
|
||||
"imports": []
|
||||
},
|
||||
"src/tfjs/backend.js": {
|
||||
|
@ -263,17 +263,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"src/blazepose/blazepose.js": {
|
||||
"bytes": 856,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/log.js"
|
||||
},
|
||||
{
|
||||
"path": "dist/tfjs.esm.js"
|
||||
}
|
||||
]
|
||||
},
|
||||
"src/handpose/box.js": {
|
||||
"bytes": 2522,
|
||||
"imports": [
|
||||
|
@ -361,7 +350,7 @@
|
|||
]
|
||||
},
|
||||
"config.js": {
|
||||
"bytes": 10110,
|
||||
"bytes": 9644,
|
||||
"imports": []
|
||||
},
|
||||
"src/sample.js": {
|
||||
|
@ -373,7 +362,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytes": 18921,
|
||||
"bytes": 18179,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/log.js"
|
||||
|
@ -402,9 +391,6 @@
|
|||
{
|
||||
"path": "src/posenet/posenet.js"
|
||||
},
|
||||
{
|
||||
"path": "src/blazepose/blazepose.js"
|
||||
},
|
||||
{
|
||||
"path": "src/handpose/handpose.js"
|
||||
},
|
||||
|
@ -433,131 +419,128 @@
|
|||
"dist/human.node-gpu.js.map": {
|
||||
"imports": [],
|
||||
"inputs": {},
|
||||
"bytes": 711946
|
||||
"bytes": 708268
|
||||
},
|
||||
"dist/human.node-gpu.js": {
|
||||
"imports": [],
|
||||
"exports": [],
|
||||
"inputs": {
|
||||
"dist/tfjs.esm.js": {
|
||||
"bytesInOutput": 971
|
||||
"bytesInOutput": 545
|
||||
},
|
||||
"src/blazeface/blazeface.js": {
|
||||
"bytesInOutput": 5194
|
||||
"bytesInOutput": 3077
|
||||
},
|
||||
"src/blazeface/box.js": {
|
||||
"bytesInOutput": 1617
|
||||
"bytesInOutput": 998
|
||||
},
|
||||
"src/blazeface/util.js": {
|
||||
"bytesInOutput": 2429
|
||||
"bytesInOutput": 1173
|
||||
},
|
||||
"src/blazeface/coords.js": {
|
||||
"bytesInOutput": 30729
|
||||
"bytesInOutput": 30504
|
||||
},
|
||||
"src/blazeface/facepipeline.js": {
|
||||
"bytesInOutput": 9436
|
||||
"bytesInOutput": 5611
|
||||
},
|
||||
"src/blazeface/facemesh.js": {
|
||||
"bytesInOutput": 2365
|
||||
"bytesInOutput": 1556
|
||||
},
|
||||
"src/profile.js": {
|
||||
"bytesInOutput": 851
|
||||
"bytesInOutput": 631
|
||||
},
|
||||
"src/age/age.js": {
|
||||
"bytesInOutput": 1251
|
||||
"bytesInOutput": 852
|
||||
},
|
||||
"src/gender/gender.js": {
|
||||
"bytesInOutput": 2004
|
||||
"bytesInOutput": 1348
|
||||
},
|
||||
"src/emotion/emotion.js": {
|
||||
"bytesInOutput": 1895
|
||||
"bytesInOutput": 1306
|
||||
},
|
||||
"src/embedding/embedding.js": {
|
||||
"bytesInOutput": 1381
|
||||
"bytesInOutput": 908
|
||||
},
|
||||
"src/posenet/modelBase.js": {
|
||||
"bytesInOutput": 1091
|
||||
"bytesInOutput": 688
|
||||
},
|
||||
"src/posenet/heapSort.js": {
|
||||
"bytesInOutput": 1144
|
||||
},
|
||||
"src/posenet/buildParts.js": {
|
||||
"bytesInOutput": 1289
|
||||
},
|
||||
"src/posenet/keypoints.js": {
|
||||
"bytesInOutput": 1824
|
||||
},
|
||||
"src/posenet/vectors.js": {
|
||||
"bytesInOutput": 1047
|
||||
},
|
||||
"src/posenet/buildParts.js": {
|
||||
"bytesInOutput": 523
|
||||
},
|
||||
"src/posenet/keypoints.js": {
|
||||
"bytesInOutput": 1624
|
||||
},
|
||||
"src/posenet/vectors.js": {
|
||||
"bytesInOutput": 615
|
||||
},
|
||||
"src/posenet/decoders.js": {
|
||||
"bytesInOutput": 1780
|
||||
"bytesInOutput": 925
|
||||
},
|
||||
"src/posenet/decodePose.js": {
|
||||
"bytesInOutput": 4101
|
||||
"bytesInOutput": 1465
|
||||
},
|
||||
"src/posenet/decodeMultiple.js": {
|
||||
"bytesInOutput": 1645
|
||||
"bytesInOutput": 694
|
||||
},
|
||||
"src/posenet/util.js": {
|
||||
"bytesInOutput": 1895
|
||||
"bytesInOutput": 1051
|
||||
},
|
||||
"src/posenet/modelPoseNet.js": {
|
||||
"bytesInOutput": 2025
|
||||
"bytesInOutput": 1180
|
||||
},
|
||||
"src/posenet/posenet.js": {
|
||||
"bytesInOutput": 639
|
||||
"bytesInOutput": 379
|
||||
},
|
||||
"src/handpose/handdetector.js": {
|
||||
"bytesInOutput": 2881
|
||||
"bytesInOutput": 1844
|
||||
},
|
||||
"src/handpose/handpipeline.js": {
|
||||
"bytesInOutput": 4524
|
||||
"bytesInOutput": 2503
|
||||
},
|
||||
"src/handpose/anchors.js": {
|
||||
"bytesInOutput": 127039
|
||||
"bytesInOutput": 127005
|
||||
},
|
||||
"src/handpose/handpose.js": {
|
||||
"bytesInOutput": 2065
|
||||
"bytesInOutput": 1363
|
||||
},
|
||||
"src/gesture/gesture.js": {
|
||||
"bytesInOutput": 3167
|
||||
"bytesInOutput": 2423
|
||||
},
|
||||
"src/imagefx.js": {
|
||||
"bytesInOutput": 13612
|
||||
"bytesInOutput": 10999
|
||||
},
|
||||
"src/image.js": {
|
||||
"bytesInOutput": 3669
|
||||
"bytesInOutput": 2478
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 12754
|
||||
"bytesInOutput": 10086
|
||||
},
|
||||
"src/log.js": {
|
||||
"bytesInOutput": 266
|
||||
"bytesInOutput": 251
|
||||
},
|
||||
"src/tfjs/backend.js": {
|
||||
"bytesInOutput": 985
|
||||
},
|
||||
"src/blazepose/blazepose.js": {
|
||||
"bytesInOutput": 627
|
||||
"bytesInOutput": 844
|
||||
},
|
||||
"src/handpose/box.js": {
|
||||
"bytesInOutput": 1463
|
||||
"bytesInOutput": 958
|
||||
},
|
||||
"src/handpose/util.js": {
|
||||
"bytesInOutput": 1790
|
||||
"bytesInOutput": 812
|
||||
},
|
||||
"config.js": {
|
||||
"bytesInOutput": 1617
|
||||
"bytesInOutput": 1460
|
||||
},
|
||||
"src/sample.js": {
|
||||
"bytesInOutput": 55299
|
||||
"bytesInOutput": 55295
|
||||
},
|
||||
"package.json": {
|
||||
"bytesInOutput": 21
|
||||
"bytesInOutput": 16
|
||||
}
|
||||
},
|
||||
"bytes": 311613
|
||||
"bytes": 277817
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
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
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -550,10 +550,9 @@
|
|||
}
|
||||
},
|
||||
"call-bind": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.1.tgz",
|
||||
"integrity": "sha512-tvAvUwNcRikl3RVF20X9lsYmmepsovzTWeJiXjO0PkJp15uy/6xKFZOQtuiSULwYW+6ToZBprphCgWXC2dSgcQ==",
|
||||
"dev": true,
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
||||
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"get-intrinsic": "^1.0.2"
|
||||
|
@ -1281,8 +1280,7 @@
|
|||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||
"dev": true
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
|
||||
},
|
||||
"functional-red-black-tree": {
|
||||
"version": "1.0.1",
|
||||
|
@ -1353,7 +1351,6 @@
|
|||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.2.tgz",
|
||||
"integrity": "sha512-aeX0vrFm21ILl3+JpFFRNe9aUvp6VFZb2/CTbgLb8j75kOhvoNYjt9d8KA/tJG4gSo8nzEDedRl0h7vDmBYRVg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
|
@ -1408,7 +1405,6 @@
|
|||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1"
|
||||
}
|
||||
|
@ -1422,8 +1418,7 @@
|
|||
"has-symbols": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
|
||||
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg=="
|
||||
},
|
||||
"has-unicode": {
|
||||
"version": "2.0.1",
|
||||
|
|
|
@ -18,6 +18,7 @@ const banner = `
|
|||
const common = {
|
||||
banner,
|
||||
minifyWhitespace: true,
|
||||
minifyIdentifiers: true,
|
||||
minifySyntax: true,
|
||||
bundle: true,
|
||||
sourcemap: true,
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
import { log } from '../log.js';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
// import * as profile from '../profile.js';
|
||||
|
||||
const models = {};
|
||||
|
||||
export async function load(config) {
|
||||
if (!models.blazepose) {
|
||||
models.blazepose = await tf.loadGraphModel(config.pose.modelPath);
|
||||
log(`load model: ${config.pose.modelPath.match(/\/(.*)\./)[1]}`);
|
||||
}
|
||||
return models.blazepose;
|
||||
}
|
||||
|
||||
export async function predict(image, config) {
|
||||
if (!models.blazepose) return null;
|
||||
return new Promise(async (resolve) => {
|
||||
const resize = tf.image.resizeBilinear(image, [config.pose.inputSize, config.pose.inputSize], false);
|
||||
const enhance = tf.div(resize, 127.5).sub(1);
|
||||
tf.dispose(resize);
|
||||
const logits = await models.blazepose.predict(enhance);
|
||||
//
|
||||
tf.dispose(enhance);
|
||||
logits.map((logit) => logit.dispose());
|
||||
resolve(logits);
|
||||
});
|
||||
}
|
31
src/human.js
31
src/human.js
|
@ -7,7 +7,6 @@ import * as gender from './gender/gender.js';
|
|||
import * as emotion from './emotion/emotion.js';
|
||||
import * as embedding from './embedding/embedding.js';
|
||||
import * as posenet from './posenet/posenet.js';
|
||||
import * as blazepose from './blazepose/blazepose.js';
|
||||
import * as handpose from './handpose/handpose.js';
|
||||
import * as gesture from './gesture/gesture.js';
|
||||
import * as image from './image.js';
|
||||
|
@ -120,7 +119,6 @@ class Human {
|
|||
log('configuration:', this.config);
|
||||
log('tf flags:', tf.ENV.flags);
|
||||
}
|
||||
this.firstRun = false;
|
||||
}
|
||||
|
||||
if (this.config.async) {
|
||||
|
@ -132,7 +130,6 @@ class Human {
|
|||
this.models.embedding,
|
||||
this.models.posenet,
|
||||
this.models.handpose,
|
||||
this.models.blazepose,
|
||||
] = await Promise.all([
|
||||
this.models.facemesh || (this.config.face.enabled ? facemesh.load(this.config) : null),
|
||||
this.models.age || ((this.config.face.enabled && this.config.face.age.enabled) ? age.load(this.config) : null),
|
||||
|
@ -141,7 +138,6 @@ class Human {
|
|||
this.models.embedding || ((this.config.face.enabled && this.config.face.embedding.enabled) ? embedding.load(this.config) : null),
|
||||
this.models.posenet || (this.config.body.enabled ? posenet.load(this.config) : null),
|
||||
this.models.handpose || (this.config.hand.enabled ? handpose.load(this.config) : null),
|
||||
this.models.blazepose || (this.config.pose.enabled ? blazepose.load(this.config) : null),
|
||||
]);
|
||||
} else {
|
||||
if (this.config.face.enabled && !this.models.facemesh) this.models.facemesh = await facemesh.load(this.config);
|
||||
|
@ -151,8 +147,13 @@ class Human {
|
|||
if (this.config.face.enabled && this.config.face.embedding.enabled && !this.models.embedding) this.models.embedding = await embedding.load(this.config);
|
||||
if (this.config.body.enabled && !this.models.posenet) this.models.posenet = await posenet.load(this.config);
|
||||
if (this.config.hand.enabled && !this.models.handpose) this.models.handpose = await handpose.load(this.config);
|
||||
if (this.config.pose.enabled && !this.models.blazepose) this.models.blazepose = await blazepose.load(this.config);
|
||||
}
|
||||
|
||||
if (this.firstRun) {
|
||||
log('tf engine state:', tf.engine().state.numBytes, 'bytes', tf.engine().state.numTensors, 'tensors');
|
||||
this.firstRun = false;
|
||||
}
|
||||
|
||||
const current = Math.trunc(now() - timeStamp);
|
||||
if (current > (this.perf.load || 0)) this.perf.load = current;
|
||||
}
|
||||
|
@ -348,7 +349,6 @@ class Human {
|
|||
}
|
||||
|
||||
let poseRes;
|
||||
let blazeposeRes;
|
||||
let handRes;
|
||||
let faceRes;
|
||||
|
||||
|
@ -397,19 +397,6 @@ class Human {
|
|||
}
|
||||
this.analyze('End Body:');
|
||||
|
||||
// run posenet
|
||||
this.analyze('Start Pose:');
|
||||
if (this.config.async) {
|
||||
blazeposeRes = this.config.pose.enabled ? blazepose.predict(process.tensor, this.config) : [];
|
||||
if (this.perf.pose) delete this.perf.pose;
|
||||
} else {
|
||||
this.state = 'run:pose';
|
||||
timeStamp = now();
|
||||
blazeposeRes = this.config.pose.enabled ? await blazepose.predict(process.tensor, this.config) : [];
|
||||
this.perf.pose = Math.trunc(now() - timeStamp);
|
||||
}
|
||||
this.analyze('End Pose:');
|
||||
|
||||
// run handpose
|
||||
this.analyze('Start Hand:');
|
||||
if (this.config.async) {
|
||||
|
@ -425,7 +412,7 @@ class Human {
|
|||
|
||||
// if async wait for results
|
||||
if (this.config.async) {
|
||||
[faceRes, poseRes, blazeposeRes, handRes] = await Promise.all([faceRes, poseRes, blazeposeRes, handRes]);
|
||||
[faceRes, poseRes, handRes] = await Promise.all([faceRes, poseRes, handRes]);
|
||||
}
|
||||
process.tensor.dispose();
|
||||
|
||||
|
@ -442,7 +429,7 @@ class Human {
|
|||
|
||||
this.perf.total = Math.trunc(now() - timeStart);
|
||||
this.state = 'idle';
|
||||
resolve({ face: faceRes, body: poseRes, hand: handRes, pose: blazeposeRes, gesture: gestureRes, performance: this.perf, canvas: process.canvas });
|
||||
resolve({ face: faceRes, body: poseRes, hand: handRes, gesture: gestureRes, performance: this.perf, canvas: process.canvas });
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -504,7 +491,7 @@ class Human {
|
|||
else res = await this.warmupCanvas();
|
||||
this.config.videoOptimized = video;
|
||||
const t1 = now();
|
||||
log('Warmup', this.config.warmup, (t1 - t0), res);
|
||||
log('Warmup', this.config.warmup, Math.round(t1 - t0), 'ms', res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit f31fa056967450ba8427bb2768db92cbe9b8cd8e
|
||||
Subproject commit 0ce580ced2bdf5f2f231dfae6c3d3f90053af6f6
|
Loading…
Reference in New Issue