updated build platform and typedoc theme

pull/293/head
Vladimir Mandic 2021-09-18 19:09:02 -04:00
parent 6ced256a42
commit f59250bde6
5 changed files with 44 additions and 12 deletions

View File

@ -11,6 +11,7 @@
### **HEAD -> main** 2021/09/17 mandic00@live.com
- webgl exception handling
### **2.2.2** 2021/09/17 mandic00@live.com

View File

@ -23,7 +23,7 @@
"scripts": {
"start": "node --no-warnings demo/nodejs/node.js",
"dev": "build --profile development",
"build": "build --profile production",
"build": "rimraf test/build.log && build --profile production",
"test": "node --no-warnings --unhandled-rejections=strict --trace-uncaught test/test.js",
"lint": "eslint src demo test",
"scan": "npx auditjs@latest ossi --dev --quiet"
@ -69,7 +69,7 @@
"@types/node": "^16.9.2",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"@vladmandic/build": "^0.4.1",
"@vladmandic/build": "^0.5.1",
"@vladmandic/pilogger": "^0.3.2",
"canvas": "^2.8.0",
"dayjs": "^1.10.7",
@ -81,9 +81,10 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"node-fetch": "^3.0.0",
"rimraf": "^3.0.2",
"seedrandom": "^3.0.5",
"tslib": "^2.3.1",
"typedoc": "0.22.3",
"typedoc": "0.22.4",
"typescript": "4.4.3"
}
}

View File

@ -34,10 +34,7 @@ export function reset(instance) {
};
}
/** Load method preloads all instance.configured models on-demand
* - Not explicitly required as any required model is load implicitly on it's first run
* @param userinstance.config?: {@link instance.config}
*/
/** Load method preloads all instance.configured models on-demand */
export async function load(instance) {
if (env.initial) reset(instance);
if (instance.config.async) { // load models concurrently

View File

@ -181,7 +181,7 @@ export interface Result {
hand: Array<HandResult>,
/** {@link GestureResult}: detection & analysis results */
gesture: Array<GestureResult>,
/** {@link ItemResult}: detection & analysis results */
/** {@link ObjectResult}: detection & analysis results */
object: Array<ObjectResult>
/** global performance object with timing values for each operation */
performance: Record<string, unknown>,

View File

@ -144,12 +144,15 @@ async function test(Human, inputConfig) {
return;
}
const t0 = process.hrtime.bigint();
const human = new Human(config);
let human;
// test event emitter
human = new Human(config);
human.events.addEventListener('warmup', () => events('warmup'));
human.events.addEventListener('image', () => events('image'));
human.events.addEventListener('detect', () => events('detect'));
// await human.tf.ready();
// test warmup sequences
await testInstance(human);
config.warmup = 'none';
await testWarmup(human, 'default');
@ -158,33 +161,63 @@ async function test(Human, inputConfig) {
config.warmup = 'body';
await testWarmup(human, 'default');
// test default config
log('info', 'test default');
human = new Human(config);
await testDetect(human, 'samples/ai-body.jpg', 'default');
// test detectors only
log('info', 'test detectors');
config.face = { mesh: { enabled: false }, iris: { enabled: false }, hand: { landmarks: false } };
human = new Human(config);
await testDetect(human, 'samples/ai-body.jpg', 'default');
// test posenet and movenet
log('info', 'test body variants');
config.body = { modelPath: 'posenet.json' };
await testDetect(human, 'samples/ai-body.jpg', 'posenet');
config.body = { modelPath: 'movenet-lightning.json' };
await testDetect(human, 'samples/ai-body.jpg', 'movenet');
// test multiple instances
const first = new Human(config);
const second = new Human(config);
await testDetect(human, null, 'default');
log('info', 'test: first instance');
await testDetect(human, 'samples/ai-upper.jpg', 'default');
await testDetect(first, 'samples/ai-upper.jpg', 'default');
log('info', 'test: second instance');
const second = new Human(config);
await testDetect(second, 'samples/ai-upper.jpg', 'default');
// test async multiple instances
log('info', 'test: concurrent');
await Promise.all([
testDetect(human, 'samples/ai-face.jpg', 'default'),
testDetect(first, 'samples/ai-face.jpg', 'default'),
testDetect(second, 'samples/ai-face.jpg', 'default'),
testDetect(human, 'samples/ai-body.jpg', 'default'),
testDetect(first, 'samples/ai-body.jpg', 'default'),
testDetect(second, 'samples/ai-body.jpg', 'default'),
testDetect(human, 'samples/ai-upper.jpg', 'default'),
testDetect(first, 'samples/ai-upper.jpg', 'default'),
testDetect(second, 'samples/ai-upper.jpg', 'default'),
]);
// tests end
const t1 = process.hrtime.bigint();
// check tensor leaks
const leak = human.tf.engine().state.numTensors - tensors;
if (leak === 0) log('state', 'passeed: no memory leak');
else log('error', 'failed: memory leak', leak);
// check if all instances reported same
const tensors1 = human.tf.engine().state.numTensors;
const tensors2 = first.tf.engine().state.numTensors;
const tensors3 = second.tf.engine().state.numTensors;
if (tensors1 === tensors2 && tensors1 === tensors3 && tensors2 === tensors3) log('state', 'passeed: equal usage');
else log('error', 'failed: equal usage', tensors1, tensors2, tensors3);
// report end
log('info', 'events:', evt);
log('info', 'test complete:', Math.trunc(Number(t1 - t0) / 1000 / 1000), 'ms');
}