mirror of https://github.com/vladmandic/human
embedding test
parent
e3e2d3267c
commit
0c8567bb1f
|
@ -9,8 +9,9 @@
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2022/08/31 mandic00@live.com
|
||||
### **HEAD -> main** 2022/09/01 mandic00@live.com
|
||||
|
||||
- add browser iife tests
|
||||
- minor bug fixes and increased test coverage
|
||||
- extend release tests
|
||||
- add model load exception handling
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
2022-09-01 09:05:06 [32mDATA: [39m Build {"name":"@vladmandic/human","version":"2.9.4"}
|
||||
2022-09-01 09:05:06 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"2.9.4"}
|
||||
2022-09-01 09:05:06 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2022-09-01 09:05:06 [36mINFO: [39m Toolchain: {"build":"0.7.11","esbuild":"0.15.6","typescript":"4.8.2","typedoc":"0.23.13","eslint":"8.23.0"}
|
||||
2022-09-01 09:05:06 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2022-09-01 09:05:06 [35mSTATE:[39m Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
|
||||
2022-09-01 09:05:06 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":159,"outputBytes":608}
|
||||
2022-09-01 09:05:06 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":655767,"outputBytes":308629}
|
||||
2022-09-01 09:05:06 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":167,"outputBytes":612}
|
||||
2022-09-01 09:05:06 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":655771,"outputBytes":308633}
|
||||
2022-09-01 09:05:06 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":206,"outputBytes":664}
|
||||
2022-09-01 09:05:06 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":655823,"outputBytes":308683}
|
||||
2022-09-01 09:05:06 [35mSTATE:[39m Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1125,"outputBytes":358}
|
||||
2022-09-01 09:05:06 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1088,"outputBytes":583}
|
||||
2022-09-01 09:05:06 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":655742,"outputBytes":307503}
|
||||
2022-09-01 09:05:07 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1344,"outputBytes":2821914}
|
||||
2022-09-01 09:05:07 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3477073,"outputBytes":1687675}
|
||||
2022-09-01 09:05:07 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3477073,"outputBytes":3108312}
|
||||
2022-09-01 09:05:11 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types/lib","files":30}
|
||||
2022-09-01 09:05:13 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
|
||||
2022-09-01 09:05:13 [35mSTATE:[39m Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6714,"outputBytes":3134}
|
||||
2022-09-01 09:05:13 [35mSTATE:[39m Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15488,"outputBytes":7788}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":113,"errors":0,"warnings":0}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m Copy: {"input":"tfjs/tfjs.esm.d.ts"}
|
||||
2022-09-01 09:05:24 [36mINFO: [39m Done...
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m API-Extractor: {"succeeeded":true,"errors":0,"warnings":198}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m Copy: {"input":"types/human.d.ts"}
|
||||
2022-09-01 09:05:24 [36mINFO: [39m Analyze models: {"folders":8,"result":"models/models.json"}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m Models {"folder":"./models","models":13}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m Models {"folder":"../human-models/models","models":42}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m Models {"folder":"../blazepose/model/","models":4}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m Models {"folder":"../anti-spoofing/model","models":1}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m Models {"folder":"../efficientpose/models","models":3}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m Models {"folder":"../insightface/models","models":5}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m Models {"folder":"../movenet/models","models":3}
|
||||
2022-09-01 09:05:24 [35mSTATE:[39m Models {"folder":"../nanodet/models","models":4}
|
||||
2022-09-01 09:05:25 [35mSTATE:[39m Models: {"count":57,"totalSize":383017442}
|
||||
2022-09-01 09:05:25 [36mINFO: [39m Human Build complete... {"logFile":"test/build.log"}
|
||||
2022-09-02 08:07:35 [32mDATA: [39m Build {"name":"@vladmandic/human","version":"2.9.4"}
|
||||
2022-09-02 08:07:35 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"2.9.4"}
|
||||
2022-09-02 08:07:35 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2022-09-02 08:07:35 [36mINFO: [39m Toolchain: {"build":"0.7.11","esbuild":"0.15.6","typescript":"4.8.2","typedoc":"0.23.13","eslint":"8.23.0"}
|
||||
2022-09-02 08:07:35 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":159,"outputBytes":608}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":655767,"outputBytes":308629}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":167,"outputBytes":612}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":655771,"outputBytes":308633}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":206,"outputBytes":664}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":655823,"outputBytes":308683}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1125,"outputBytes":358}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1088,"outputBytes":583}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":655742,"outputBytes":307503}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1344,"outputBytes":2821914}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3477073,"outputBytes":1687675}
|
||||
2022-09-02 08:07:35 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3477073,"outputBytes":3108312}
|
||||
2022-09-02 08:07:40 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types/lib","files":30}
|
||||
2022-09-02 08:07:42 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
|
||||
2022-09-02 08:07:42 [35mSTATE:[39m Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6714,"outputBytes":3134}
|
||||
2022-09-02 08:07:42 [35mSTATE:[39m Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15488,"outputBytes":7788}
|
||||
2022-09-02 08:07:53 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":113,"errors":0,"warnings":0}
|
||||
2022-09-02 08:07:53 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2022-09-02 08:07:53 [35mSTATE:[39m Copy: {"input":"tfjs/tfjs.esm.d.ts"}
|
||||
2022-09-02 08:07:53 [36mINFO: [39m Done...
|
||||
2022-09-02 08:07:54 [35mSTATE:[39m API-Extractor: {"succeeeded":true,"errors":0,"warnings":198}
|
||||
2022-09-02 08:07:54 [35mSTATE:[39m Copy: {"input":"types/human.d.ts"}
|
||||
2022-09-02 08:07:54 [36mINFO: [39m Analyze models: {"folders":8,"result":"models/models.json"}
|
||||
2022-09-02 08:07:54 [35mSTATE:[39m Models {"folder":"./models","models":13}
|
||||
2022-09-02 08:07:54 [35mSTATE:[39m Models {"folder":"../human-models/models","models":42}
|
||||
2022-09-02 08:07:54 [35mSTATE:[39m Models {"folder":"../blazepose/model/","models":4}
|
||||
2022-09-02 08:07:54 [35mSTATE:[39m Models {"folder":"../anti-spoofing/model","models":1}
|
||||
2022-09-02 08:07:54 [35mSTATE:[39m Models {"folder":"../efficientpose/models","models":3}
|
||||
2022-09-02 08:07:54 [35mSTATE:[39m Models {"folder":"../insightface/models","models":5}
|
||||
2022-09-02 08:07:54 [35mSTATE:[39m Models {"folder":"../movenet/models","models":3}
|
||||
2022-09-02 08:07:54 [35mSTATE:[39m Models {"folder":"../nanodet/models","models":4}
|
||||
2022-09-02 08:07:55 [35mSTATE:[39m Models: {"count":57,"totalSize":383017442}
|
||||
2022-09-02 08:07:55 [36mINFO: [39m Human Build complete... {"logFile":"test/build.log"}
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Human Embedding Tests</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, shrink-to-fit=yes">
|
||||
<style>
|
||||
html { font-size: 14px; font-variant: small-caps; }
|
||||
body { margin: 0; background: black; color: white; width: 100vw; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="log" style="line-height: 150%; overflow-x: hidden; white-space: pre-wrap"></pre>
|
||||
<script type="module">
|
||||
import { Human } from 'https://vladmandic.github.io/human/dist/human.esm.js';
|
||||
|
||||
const testConfig = {
|
||||
debug: true,
|
||||
async: false,
|
||||
modelBasePath: 'https://vladmandic.github.io/human-models/models/',
|
||||
cacheSensitivity: 0,
|
||||
warmup: 'face',
|
||||
face: { iris: { enabled: false }, emotion: { enabled: false } },
|
||||
body: { enabled: false },
|
||||
hand: { enabled: false },
|
||||
object: { enabled: false },
|
||||
segmentation: { enabled: false },
|
||||
gestures: { enabled: false },
|
||||
};
|
||||
|
||||
function str(...msg) {
|
||||
if (!Array.isArray(msg)) return msg;
|
||||
let line = '';
|
||||
for (const entry of msg) {
|
||||
if (typeof entry === 'object') line += ' ' + JSON.stringify(entry, null, 0).replace(/"/g, '').replace(/,/g, ', ').replace(/:/g, ': ');
|
||||
else line += ' ' + entry;
|
||||
}
|
||||
return line + '\n';
|
||||
}
|
||||
|
||||
async function log(...msgs) {
|
||||
document.getElementById('log').innerHTML += str(...msgs);
|
||||
document.documentElement.scrollTop = document.documentElement.scrollHeight;
|
||||
console.log(...msgs); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const human = new Human(testConfig);
|
||||
log('human', human.version, { config: human.config });
|
||||
for (const backend of ['wasm', 'webgl', 'humangl', 'webgpu', 'test1', 'test2', 'test3', 'test4']) {
|
||||
if (backend === 'test1') {
|
||||
human.config.backend = 'humangl';
|
||||
await human.init();
|
||||
human.tf.env().set('CPU_HANDOFF_SIZE_THRESHOLD', 256);
|
||||
human.tf.env().set('WEBGL_USE_SHAPES_UNIFORMS', true);
|
||||
human.tf.env().set('WEBGL_EXP_CONV', true);
|
||||
} else if (backend === 'test2') {
|
||||
human.config.backend = 'humangl';
|
||||
await human.init();
|
||||
human.tf.env().set('CPU_HANDOFF_SIZE_THRESHOLD', 256);
|
||||
human.tf.env().set('WEBGL_USE_SHAPES_UNIFORMS', true);
|
||||
// human.tf.env().set('WEBGL_EXP_CONV', true);
|
||||
} else if (backend === 'test3') {
|
||||
human.config.backend = 'humangl';
|
||||
await human.init();
|
||||
human.tf.env().set('CPU_HANDOFF_SIZE_THRESHOLD', 256);
|
||||
// human.tf.env().set('WEBGL_USE_SHAPES_UNIFORMS', true);
|
||||
// human.tf.env().set('WEBGL_EXP_CONV', true);
|
||||
} else if (backend === 'test4') {
|
||||
human.config.backend = 'humangl';
|
||||
await human.init();
|
||||
// human.tf.env().set('CPU_HANDOFF_SIZE_THRESHOLD', 256);
|
||||
// human.tf.env().set('WEBGL_USE_SHAPES_UNIFORMS', true);
|
||||
// human.tf.env().set('WEBGL_EXP_CONV', true);
|
||||
} else {
|
||||
human.config.backend = backend;
|
||||
await human.init();
|
||||
if (human.tf.getBackend() !== backend) {
|
||||
log(backend, { desired: backend, detected: human.tf.getBackend() });
|
||||
continue; // wrong backend
|
||||
}
|
||||
}
|
||||
human.reset();
|
||||
let res;
|
||||
for (const model of Object.keys(human.models)) {
|
||||
if (human.models[model]) human.models[model] = null;
|
||||
}
|
||||
await human.load(testConfig);
|
||||
const ops = await human.check();
|
||||
if (ops && ops.length > 0) log(backend, { backend: human.tf.getBackend(), ops });
|
||||
const env = JSON.parse(JSON.stringify(human.env));
|
||||
env.kernels = human.env.kernels.length;
|
||||
log(backend, { backend: human.tf.getBackend(), env });
|
||||
for (const warmup of ['none', 'face', 'body']) {
|
||||
testConfig.warmup = warmup;
|
||||
res = await human.warmup(testConfig);
|
||||
if (Array.isArray(res?.face?.[0]?.embedding) && (res?.face?.[0]?.embedding.length === 1024)) res.face[0].embedding.length = 10;
|
||||
log(backend, { backend: human.tf.getBackend(), warmup, gender: res?.face?.[0]?.gender, genderScore: res?.face?.[0]?.genderScore, age: res?.face?.[0]?.age, embedding: res?.face?.[0]?.embedding });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue