add browser test

pull/356/head
Vladimir Mandic 2022-08-19 09:15:29 -04:00
parent 3af503b508
commit 65c9a45f61
7 changed files with 1031 additions and 1027 deletions

View File

@ -11,6 +11,8 @@
### **HEAD -> main** 2022/08/15 mandic00@live.com ### **HEAD -> main** 2022/08/15 mandic00@live.com
- add tensorflow library detection
- fix wasm detection
- enumerate additional models - enumerate additional models
- release refresh - release refresh

View File

@ -63,8 +63,8 @@ Model is supported using `WebGL` backend in browser
- Host models in <human-models> - Host models in <human-models>
Models can be directly used without downloading to local storage Models can be directly used without downloading to local storage
Example: `modelPath: 'https://vladmandic.github.io/human-models/models/facemesh.json'` Example: `modelPath: 'https://vladmandic.github.io/human-models/models/facemesh.json'`
- Host models in **Google Cloud Bucket** - Allow hosting models in **Google Cloud Bucket**
Models can be directly used without downloading to local storage Hosted models can be directly used without downloading to local storage
Example: `modelPath: 'https://storage.googleapis.com/human-models/facemesh.json'` Example: `modelPath: 'https://storage.googleapis.com/human-models/facemesh.json'`
- Fix **MobileFaceNet** model as alternative for face embedding/descriptor detection - Fix **MobileFaceNet** model as alternative for face embedding/descriptor detection
Configurable using `config.face.mobilefacenet` config section Configurable using `config.face.mobilefacenet` config section

View File

@ -66,7 +66,7 @@
"node-webcam": "^0.8.1" "node-webcam": "^0.8.1"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/api-extractor": "^7.29.2", "@microsoft/api-extractor": "^7.29.3",
"@tensorflow/tfjs": "^3.19.0", "@tensorflow/tfjs": "^3.19.0",
"@tensorflow/tfjs-backend-cpu": "^3.19.0", "@tensorflow/tfjs-backend-cpu": "^3.19.0",
"@tensorflow/tfjs-backend-wasm": "^3.19.0", "@tensorflow/tfjs-backend-wasm": "^3.19.0",
@ -79,15 +79,15 @@
"@tensorflow/tfjs-node": "^3.19.0", "@tensorflow/tfjs-node": "^3.19.0",
"@tensorflow/tfjs-node-gpu": "^3.19.0", "@tensorflow/tfjs-node-gpu": "^3.19.0",
"@tensorflow/tfjs-tflite": "0.0.1-alpha.8", "@tensorflow/tfjs-tflite": "0.0.1-alpha.8",
"@types/node": "^18.7.4", "@types/node": "^18.7.6",
"@types/offscreencanvas": "^2019.7.0", "@types/offscreencanvas": "^2019.7.0",
"@typescript-eslint/eslint-plugin": "^5.33.0", "@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.0", "@typescript-eslint/parser": "^5.33.1",
"@vladmandic/build": "^0.7.9", "@vladmandic/build": "^0.7.10",
"@vladmandic/pilogger": "^0.4.6", "@vladmandic/pilogger": "^0.4.6",
"@vladmandic/tfjs": "github:vladmandic/tfjs", "@vladmandic/tfjs": "github:vladmandic/tfjs",
"@webgpu/types": "^0.1.21", "@webgpu/types": "^0.1.21",
"esbuild": "^0.15.3", "esbuild": "^0.15.5",
"eslint": "8.22.0", "eslint": "8.22.0",
"eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-html": "^7.1.0", "eslint-plugin-html": "^7.1.0",

View File

@ -14,10 +14,10 @@
@font-face { font-family: 'Lato'; font-display: swap; font-style: normal; font-weight: 100; src: local('Lato'), url('../../assets/lato-light.woff2') } @font-face { font-family: 'Lato'; font-display: swap; font-style: normal; font-weight: 100; src: local('Lato'), url('../../assets/lato-light.woff2') }
html { font-family: 'Lato', 'Segoe UI'; font-size: 14px; font-variant: small-caps; } html { font-family: 'Lato', 'Segoe UI'; font-size: 14px; font-variant: small-caps; }
body { margin: 0; background: black; color: white; width: 100vw; overflow-x: hidden; } body { margin: 0; background: black; color: white; width: 100vw; overflow-x: hidden; }
.canvas { position: absolute; bottom: 10px; right: 10px; width: 256px; height: 256px; z-index: 99; } .canvas { position: fixed; bottom: 10px; right: 10px; width: 256px; height: 256px; z-index: 99; }
.events { position: fixed; top: 10px; right: 10px; width: 12rem; height: 1.25rem; background-color: grey; padding: 8px; z-index: 99; }
.state { position: fixed; top: 60px; right: 10px; width: 12rem; height: 1.25rem; background-color: grey; padding: 8px; z-index: 99; }
.pre { line-height: 150%; white-space: break-spaces; } .pre { line-height: 150%; white-space: break-spaces; }
.events { position: absolute; top: 10px; right: 10px; width: 12rem; height: 1.25rem; background-color: grey; padding: 8px; z-index: 99; }
.state { position: absolute; top: 60px; right: 10px; width: 12rem; height: 1.25rem; background-color: grey; padding: 8px; z-index: 99; }
</style> </style>
</head> </head>
<body> <body>
@ -56,7 +56,7 @@
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')}`; 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')}`;
const elap = (dt - last).toString().padStart(5, '0'); const elap = (dt - last).toString().padStart(5, '0');
document.getElementById('log').innerHTML += ts + ' +' + elap + 'ms &nbsp' + str(false, ...msgs); document.getElementById('log').innerHTML += ts + ' +' + elap + 'ms &nbsp' + str(false, ...msgs);
document.documentElement.scrollTop = document.documentElement.scrollHeight document.documentElement.scrollTop = document.documentElement.scrollHeight;
console.log(ts, elap, ...msgs); // eslint-disable-line no-console console.log(ts, elap, ...msgs); // eslint-disable-line no-console
last = dt; last = dt;
} }
@ -66,7 +66,7 @@
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')}`; 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')}`;
const elap = (dt - last).toString().padStart(5, '0'); const elap = (dt - last).toString().padStart(5, '0');
document.getElementById('log').innerHTML += ts + ' +' + elap + 'ms &nbsp' + str(true, ...msgs); document.getElementById('log').innerHTML += ts + ' +' + elap + 'ms &nbsp' + str(true, ...msgs);
document.documentElement.scrollTop = document.documentElement.scrollHeight document.documentElement.scrollTop = document.documentElement.scrollHeight;
console.log(ts, elap, ...msgs); // eslint-disable-line no-console console.log(ts, elap, ...msgs); // eslint-disable-line no-console
last = dt; last = dt;
} }

2
test/browser.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
"/mnt/c/Users/mandi/AppData/Local/Google/Chrome SxS/Application/chrome.exe" --enable-unsafe-gpu --allow-insecure-localhost --auto-open-devtools-for-tabs https://localhost:10031/test/browser.html

View File

@ -1,39 +1,39 @@
2022-08-15 11:36:04 DATA:  Build {"name":"@vladmandic/human","version":"2.9.3"} 2022-08-19 09:12:22 DATA:  Build {"name":"@vladmandic/human","version":"2.9.3"}
2022-08-15 11:36:04 INFO:  Application: {"name":"@vladmandic/human","version":"2.9.3"} 2022-08-19 09:12:22 INFO:  Application: {"name":"@vladmandic/human","version":"2.9.3"}
2022-08-15 11:36:04 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true} 2022-08-19 09:12:22 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2022-08-15 11:36:04 INFO:  Toolchain: {"build":"0.7.9","esbuild":"0.15.3","typescript":"4.7.4","typedoc":"0.23.10","eslint":"8.22.0"} 2022-08-19 09:12:22 INFO:  Toolchain: {"build":"0.7.10","esbuild":"0.15.5","typescript":"4.7.4","typedoc":"0.23.10","eslint":"8.22.0"}
2022-08-15 11:36:04 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]} 2022-08-19 09:12:22 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2022-08-15 11:36:04 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]} 2022-08-19 09:12:22 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
2022-08-15 11:36:04 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":608} 2022-08-19 09:12:22 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":608}
2022-08-15 11:36:04 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":655451,"outputBytes":307474} 2022-08-19 09:12:22 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":655452,"outputBytes":307474}
2022-08-15 11:36:04 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":612} 2022-08-19 09:12:22 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":612}
2022-08-15 11:36:04 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":655455,"outputBytes":307478} 2022-08-19 09:12:22 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":655456,"outputBytes":307478}
2022-08-15 11:36:04 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":664} 2022-08-19 09:12:22 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":664}
2022-08-15 11:36:04 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":655507,"outputBytes":307528} 2022-08-19 09:12:22 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":655508,"outputBytes":307528}
2022-08-15 11:36:04 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1069,"outputBytes":358} 2022-08-19 09:12:22 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1069,"outputBytes":358}
2022-08-15 11:36:04 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1032,"outputBytes":583} 2022-08-19 09:12:22 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1032,"outputBytes":583}
2022-08-15 11:36:04 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":655426,"outputBytes":306323} 2022-08-19 09:12:22 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":655427,"outputBytes":306323}
2022-08-15 11:36:04 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1271,"outputBytes":2787569} 2022-08-19 09:12:22 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1271,"outputBytes":2787569}
2022-08-15 11:36:04 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3442412,"outputBytes":1669183} 2022-08-19 09:12:22 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3442413,"outputBytes":1669183}
2022-08-15 11:36:04 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3442412,"outputBytes":3073108} 2022-08-19 09:12:22 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3442413,"outputBytes":3073108}
2022-08-15 11:36:09 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":30} 2022-08-19 09:12:27 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":30}
2022-08-15 11:36:11 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true} 2022-08-19 09:12:29 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
2022-08-15 11:36:11 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6716,"outputBytes":3141} 2022-08-19 09:12:29 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6716,"outputBytes":3141}
2022-08-15 11:36:11 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15629,"outputBytes":7798} 2022-08-19 09:12:29 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15629,"outputBytes":7798}
2022-08-15 11:36:19 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":109,"errors":0,"warnings":0} 2022-08-19 09:12:37 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":109,"errors":0,"warnings":0}
2022-08-15 11:36:19 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"} 2022-08-19 09:12:37 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2022-08-15 11:36:19 STATE: Copy: {"input":"tfjs/tfjs.esm.d.ts"} 2022-08-19 09:12:37 STATE: Copy: {"input":"tfjs/tfjs.esm.d.ts"}
2022-08-15 11:36:19 INFO:  Done... 2022-08-19 09:12:37 INFO:  Done...
2022-08-15 11:36:20 STATE: API-Extractor: {"succeeeded":true,"errors":0,"warnings":198} 2022-08-19 09:12:37 STATE: API-Extractor: {"succeeeded":true,"errors":0,"warnings":198}
2022-08-15 11:36:20 STATE: Copy: {"input":"types/human.d.ts"} 2022-08-19 09:12:37 STATE: Copy: {"input":"types/human.d.ts"}
2022-08-15 11:36:20 INFO:  Analyze models: {"folders":8,"result":"models/models.json"} 2022-08-19 09:12:37 INFO:  Analyze models: {"folders":8,"result":"models/models.json"}
2022-08-15 11:36:20 STATE: Models {"folder":"./models","models":13} 2022-08-19 09:12:37 STATE: Models {"folder":"./models","models":13}
2022-08-15 11:36:20 STATE: Models {"folder":"../human-models/models","models":42} 2022-08-19 09:12:37 STATE: Models {"folder":"../human-models/models","models":42}
2022-08-15 11:36:20 STATE: Models {"folder":"../blazepose/model/","models":4} 2022-08-19 09:12:37 STATE: Models {"folder":"../blazepose/model/","models":4}
2022-08-15 11:36:20 STATE: Models {"folder":"../anti-spoofing/model","models":1} 2022-08-19 09:12:37 STATE: Models {"folder":"../anti-spoofing/model","models":1}
2022-08-15 11:36:20 STATE: Models {"folder":"../efficientpose/models","models":3} 2022-08-19 09:12:37 STATE: Models {"folder":"../efficientpose/models","models":3}
2022-08-15 11:36:20 STATE: Models {"folder":"../insightface/models","models":5} 2022-08-19 09:12:37 STATE: Models {"folder":"../insightface/models","models":5}
2022-08-15 11:36:20 STATE: Models {"folder":"../movenet/models","models":3} 2022-08-19 09:12:37 STATE: Models {"folder":"../movenet/models","models":3}
2022-08-15 11:36:20 STATE: Models {"folder":"../nanodet/models","models":4} 2022-08-19 09:12:37 STATE: Models {"folder":"../nanodet/models","models":4}
2022-08-15 11:36:20 STATE: Models: {"count":57,"totalSize":383017442} 2022-08-19 09:12:38 STATE: Models: {"count":57,"totalSize":383017442}
2022-08-15 11:36:20 INFO:  Human Build complete... {"logFile":"test/build.log"} 2022-08-19 09:12:38 INFO:  Human Build complete... {"logFile":"test/build.log"}

File diff suppressed because it is too large Load Diff