switched to minified build

pull/50/head
Vladimir Mandic 2020-11-16 15:51:46 -05:00
parent 85bf9e953f
commit 917e01779d
21 changed files with 3186 additions and 455206 deletions

View File

@ -67,8 +67,10 @@ function str(...msg) {
// helper function: wrapper around console output
const log = (...msg) => {
const dt = new Date();
const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;
// eslint-disable-next-line no-console
if (ui.console) console.log(...msg);
if (ui.console) console.log(ts, ...msg);
};
const status = (msg) => {
@ -472,7 +474,7 @@ async function setupMonitor() {
}
async function main() {
log('Human: demo starting ...');
log('demo starting ...');
setupMenu();
setupMonitor();
document.getElementById('log').innerText = `Human: version ${human.version} TensorFlow/JS: version ${human.tf.version_core}`;
@ -490,6 +492,7 @@ async function main() {
status('human: ready');
document.getElementById('loader').style.display = 'none';
document.getElementById('play').style.display = 'block';
log('ready');
}
window.onload = main;

View File

@ -59,7 +59,8 @@ async function build(f, msg) {
if (!es) es = await esbuild.startService();
// common build options
const cfg = {
minify: false,
// minify: false,
minifyWhitespace: true,
bundle: true,
sourcemap: true,
logLevel: 'error',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
"imports": []
},
"demo/browser.js": {
"bytes": 22640,
"bytes": 22885,
"imports": [
{
"path": "dist/human.esm.js"
@ -30,7 +30,7 @@
"imports": []
},
"dist/human.esm.js": {
"bytes": 3455898,
"bytes": 1933724,
"imports": []
}
},
@ -38,28 +38,31 @@
"dist/demo-browser-index.js.map": {
"imports": [],
"inputs": {},
"bytes": 5445813
"bytes": 5414452
},
"dist/demo-browser-index.js": {
"imports": [],
"inputs": {
"dist/human.esm.js": {
"bytesInOutput": 3445224
"bytesInOutput": 1926649
},
"dist/human.esm.js": {
"bytesInOutput": 0
},
"demo/draw.js": {
"bytesInOutput": 9599
"bytesInOutput": 7341
},
"demo/menu.js": {
"bytesInOutput": 13813
"bytesInOutput": 12020
},
"assets/gl-bench.js": {
"bytesInOutput": 9727
"bytesInOutput": 7809
},
"demo/browser.js": {
"bytesInOutput": 20090
"bytesInOutput": 17327
}
},
"bytes": 3498598
"bytes": 1978411
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
"imports": []
},
"package.json": {
"bytes": 3629,
"bytes": 3749,
"imports": []
},
"src/age/age.js": {
@ -286,7 +286,7 @@
"imports": []
},
"src/human.js": {
"bytes": 15714,
"bytes": 15693,
"imports": [
{
"path": "src/tf.js"
@ -349,7 +349,7 @@
"imports": []
},
"src/tf.js": {
"bytes": 1137,
"bytes": 1178,
"imports": []
}
},
@ -357,130 +357,130 @@
"dist/human.esm-nobundle.js.map": {
"imports": [],
"inputs": {},
"bytes": 784414
"bytes": 670719
},
"dist/human.esm-nobundle.js": {
"imports": [],
"inputs": {
"src/face/blazeface.js": {
"bytesInOutput": 6972
"bytesInOutput": 5445
},
"src/face/box.js": {
"bytesInOutput": 2052
"bytesInOutput": 1666
},
"src/face/util.js": {
"bytesInOutput": 3043
"bytesInOutput": 2480
},
"src/face/coords.js": {
"bytesInOutput": 51519
"bytesInOutput": 30878
},
"src/face/facepipeline.js": {
"bytesInOutput": 12480
"bytesInOutput": 9779
},
"src/face/facemesh.js": {
"bytesInOutput": 2461
"bytesInOutput": 1938
},
"src/profile.js": {
"bytesInOutput": 1118
"bytesInOutput": 895
},
"src/age/age.js": {
"bytesInOutput": 1589
"bytesInOutput": 1209
},
"src/gender/gender.js": {
"bytesInOutput": 2762
"bytesInOutput": 2029
},
"src/emotion/emotion.js": {
"bytesInOutput": 2464
"bytesInOutput": 1881
},
"src/embedding/embedding.js": {
"bytesInOutput": 1769
"bytesInOutput": 1403
},
"src/body/modelBase.js": {
"bytesInOutput": 866
"bytesInOutput": 640
},
"src/body/modelMobileNet.js": {
"bytesInOutput": 471
"bytesInOutput": 387
},
"src/body/heapSort.js": {
"bytesInOutput": 1637
"bytesInOutput": 1145
},
"src/body/buildParts.js": {
"bytesInOutput": 1764
"bytesInOutput": 1353
},
"src/body/keypoints.js": {
"bytesInOutput": 2276
"bytesInOutput": 1822
},
"src/body/vectors.js": {
"bytesInOutput": 1419
"bytesInOutput": 1079
},
"src/body/decodePose.js": {
"bytesInOutput": 3796
"bytesInOutput": 3229
},
"src/body/decodeMultiple.js": {
"bytesInOutput": 2026
"bytesInOutput": 1732
},
"src/body/util.js": {
"bytesInOutput": 2409
"bytesInOutput": 1955
},
"src/body/modelPoseNet.js": {
"bytesInOutput": 2014
"bytesInOutput": 1668
},
"src/body/posenet.js": {
"bytesInOutput": 962
"bytesInOutput": 863
},
"src/hand/handdetector.js": {
"bytesInOutput": 4402
"bytesInOutput": 2929
},
"src/hand/handpipeline.js": {
"bytesInOutput": 7192
"bytesInOutput": 4885
},
"src/hand/anchors.js": {
"bytesInOutput": 256590
"bytesInOutput": 127037
},
"src/hand/handpose.js": {
"bytesInOutput": 3066
"bytesInOutput": 1825
},
"src/gesture.js": {
"bytesInOutput": 3038
"bytesInOutput": 2328
},
"src/imagefx.js": {
"bytesInOutput": 20097
"bytesInOutput": 13872
},
"src/image.js": {
"bytesInOutput": 5382
"bytesInOutput": 4061
},
"src/tf.js": {
"bytesInOutput": 174
"bytesInOutput": 163
},
"src/human.js": {
"bytesInOutput": 278
"bytesInOutput": 260
},
"src/hand/box.js": {
"bytesInOutput": 3037
"bytesInOutput": 1979
},
"src/hand/util.js": {
"bytesInOutput": 2884
"bytesInOutput": 1854
},
"src/human.js": {
"bytesInOutput": 186
"bytesInOutput": 174
},
"config.js": {
"bytesInOutput": 2072
"bytesInOutput": 1431
},
"package.json": {
"bytesInOutput": 0
},
"package.json": {
"bytesInOutput": 23
"bytesInOutput": 20
},
"src/human.js": {
"bytesInOutput": 13221
"bytesInOutput": 10149
},
"src/human.js": {
"bytesInOutput": 0
}
},
"bytes": 431572
"bytes": 250185
}
}
}

96104
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

922
dist/human.esm.json vendored

File diff suppressed because it is too large Load Diff

96331
dist/human.js vendored

File diff suppressed because one or more lines are too long

4
dist/human.js.map vendored

File diff suppressed because one or more lines are too long

718
dist/human.json vendored

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

117523
dist/human.node.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

86
dist/human.node.json vendored
View File

@ -5,7 +5,7 @@
"imports": []
},
"package.json": {
"bytes": 3629,
"bytes": 3749,
"imports": []
},
"src/age/age.js": {
@ -286,7 +286,7 @@
"imports": []
},
"src/human.js": {
"bytes": 15714,
"bytes": 15693,
"imports": [
{
"path": "src/tf.js"
@ -349,7 +349,7 @@
"imports": []
},
"src/tf.js": {
"bytes": 1137,
"bytes": 1178,
"imports": []
}
},
@ -357,130 +357,130 @@
"dist/human.node-nobundle.js.map": {
"imports": [],
"inputs": {},
"bytes": 800609
"bytes": 686879
},
"dist/human.node-nobundle.js": {
"imports": [],
"inputs": {
"src/face/blazeface.js": {
"bytesInOutput": 6976
"bytesInOutput": 5449
},
"src/face/box.js": {
"bytesInOutput": 2059
"bytesInOutput": 1673
},
"src/face/util.js": {
"bytesInOutput": 3054
"bytesInOutput": 2491
},
"src/face/coords.js": {
"bytesInOutput": 51530
"bytesInOutput": 30889
},
"src/face/facepipeline.js": {
"bytesInOutput": 12482
"bytesInOutput": 9781
},
"src/face/facemesh.js": {
"bytesInOutput": 2465
"bytesInOutput": 1942
},
"src/profile.js": {
"bytesInOutput": 1120
"bytesInOutput": 897
},
"src/age/age.js": {
"bytesInOutput": 1592
"bytesInOutput": 1212
},
"src/gender/gender.js": {
"bytesInOutput": 2765
"bytesInOutput": 2032
},
"src/emotion/emotion.js": {
"bytesInOutput": 2467
"bytesInOutput": 1884
},
"src/embedding/embedding.js": {
"bytesInOutput": 1773
"bytesInOutput": 1407
},
"src/body/modelBase.js": {
"bytesInOutput": 868
"bytesInOutput": 642
},
"src/body/modelMobileNet.js": {
"bytesInOutput": 473
"bytesInOutput": 389
},
"src/body/heapSort.js": {
"bytesInOutput": 1639
"bytesInOutput": 1147
},
"src/body/buildParts.js": {
"bytesInOutput": 1766
"bytesInOutput": 1355
},
"src/body/keypoints.js": {
"bytesInOutput": 2287
"bytesInOutput": 1833
},
"src/body/vectors.js": {
"bytesInOutput": 1427
"bytesInOutput": 1087
},
"src/body/decodePose.js": {
"bytesInOutput": 3798
"bytesInOutput": 3231
},
"src/body/decodeMultiple.js": {
"bytesInOutput": 2028
"bytesInOutput": 1734
},
"src/body/util.js": {
"bytesInOutput": 2417
"bytesInOutput": 1963
},
"src/body/modelPoseNet.js": {
"bytesInOutput": 2017
"bytesInOutput": 1671
},
"src/body/posenet.js": {
"bytesInOutput": 976
"bytesInOutput": 877
},
"src/hand/handdetector.js": {
"bytesInOutput": 4404
"bytesInOutput": 2931
},
"src/hand/handpipeline.js": {
"bytesInOutput": 7194
"bytesInOutput": 4887
},
"src/hand/anchors.js": {
"bytesInOutput": 256592
"bytesInOutput": 127039
},
"src/hand/handpose.js": {
"bytesInOutput": 3069
"bytesInOutput": 1828
},
"src/gesture.js": {
"bytesInOutput": 3042
"bytesInOutput": 2332
},
"src/imagefx.js": {
"bytesInOutput": 20099
"bytesInOutput": 13874
},
"src/image.js": {
"bytesInOutput": 5384
"bytesInOutput": 4063
},
"src/human.js": {
"bytesInOutput": 47
"bytesInOutput": 38
},
"src/tf.js": {
"bytesInOutput": 193
"bytesInOutput": 184
},
"src/human.js": {
"bytesInOutput": 278
"bytesInOutput": 260
},
"src/hand/box.js": {
"bytesInOutput": 3037
"bytesInOutput": 1979
},
"src/hand/util.js": {
"bytesInOutput": 2884
"bytesInOutput": 1854
},
"src/human.js": {
"bytesInOutput": 186
"bytesInOutput": 174
},
"config.js": {
"bytesInOutput": 2072
"bytesInOutput": 1431
},
"package.json": {
"bytesInOutput": 0
},
"package.json": {
"bytesInOutput": 23
"bytesInOutput": 20
},
"src/human.js": {
"bytesInOutput": 13226
"bytesInOutput": 10154
}
},
"bytes": 431928
"bytes": 250498
}
}
}

View File

@ -44,12 +44,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 --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-iife": "esbuild --bundle --minify-whitespace --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 --minify-whitespace --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 --minify-whitespace --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 --minify-whitespace --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-whitespace --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 --minify-whitespace --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"
},

View File

@ -3,7 +3,8 @@ import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
import { setWasmPaths } from '@tensorflow/tfjs-backend-wasm/dist/index.js';
const loadGraphModel = tf.loadGraphModel;
export { tf, setWasmPaths, loadGraphModel };
// const setWasmPaths = tf.setWasmPaths;
export { tf, loadGraphModel, setWasmPaths };
// modular: bundle 4.2M
/*