From 69d0212555afce286daefcc5191f96fbe249d108 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Tue, 31 Aug 2021 13:29:29 -0400 Subject: [PATCH] update node-fetch --- demo/nodejs/node-canvas.js | 218 +++++++++++++++++++++++++++++++++ demo/nodejs/node.js | 4 +- package.json | 2 +- test/test-main.js | 4 +- test/test.log | 240 ++++++++++++++++++------------------- 5 files changed, 345 insertions(+), 123 deletions(-) create mode 100644 demo/nodejs/node-canvas.js diff --git a/demo/nodejs/node-canvas.js b/demo/nodejs/node-canvas.js new file mode 100644 index 00000000..8cc75ce5 --- /dev/null +++ b/demo/nodejs/node-canvas.js @@ -0,0 +1,218 @@ +/** + * Human demo for NodeJS + */ + +const log = require('@vladmandic/pilogger'); +const fs = require('fs'); +const path = require('path'); +const process = require('process'); + +let fetch; // fetch is dynamically imported later + +// const canvas = require('canvas'); + +// for NodeJS, `tfjs-node` or `tfjs-node-gpu` should be loaded before using Human +// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars +const tf = require('@tensorflow/tfjs-node'); // or const tf = require('@tensorflow/tfjs-node-gpu'); + +// load specific version of Human library that matches TensorFlow mode +const Human = require('../../dist/human.node.js').default; // or const Human = require('../dist/human.node-gpu.js').default; + +let human = null; + +const myConfig = { + backend: 'tensorflow', + modelBasePath: 'file://models/', + debug: true, + async: false, + filter: { + enabled: true, + flip: true, + }, + face: { + enabled: true, + detector: { enabled: true, rotation: false }, + mesh: { enabled: true }, + iris: { enabled: true }, + description: { enabled: true }, + emotion: { enabled: true }, + }, + hand: { + enabled: true, + }, + // body: { modelPath: 'blazepose.json', enabled: true }, + body: { enabled: true }, + object: { enabled: true }, +}; + +async function init() { + // create instance of human + human = new Human(myConfig); + // wait until tf is ready + await human.tf.ready(); + // pre-load models + log.info('Human:', human.version); + log.info('Active Configuration', human.config); + await human.load(); + const loaded = Object.keys(human.models).filter((a) => human.models[a]); + log.info('Loaded:', loaded); + log.info('Memory state:', human.tf.engine().memory()); +} + +async function detect(input) { + // read input image file and create tensor to be used for processing + let buffer; + log.info('Loading image:', input); + if (input.startsWith('http:') || input.startsWith('https:')) { + const res = await fetch(input); + if (res && res.ok) buffer = await res.buffer(); + else log.error('Invalid image URL:', input, res.status, res.statusText, res.headers.get('content-type')); + } else { + buffer = fs.readFileSync(input); + } + + // decode image using tfjs-node so we don't need external depenencies + // can also be done using canvas.js or some other 3rd party image library + if (!buffer) return {}; + const tensor = human.tf.tidy(() => { + const decode = human.tf.node.decodeImage(buffer, 3); + let expand; + if (decode.shape[2] === 4) { // input is in rgba format, need to convert to rgb + const channels = human.tf.split(decode, 4, 2); // tf.split(tensor, 4, 2); // split rgba to channels + const rgb = human.tf.stack([channels[0], channels[1], channels[2]], 2); // stack channels back to rgb and ignore alpha + expand = human.tf.reshape(rgb, [1, decode.shape[0], decode.shape[1], 3]); // move extra dim from the end of tensor and use it as batch number instead + } else { + expand = human.tf.expandDims(decode, 0); + } + const cast = human.tf.cast(expand, 'float32'); + return cast; + }); + + // image shape contains image dimensions and depth + log.state('Processing:', tensor['shape']); + + // run actual detection + let result; + try { + result = await human.detect(tensor, myConfig); + } catch (err) { + log.error('caught'); + } + + // dispose image tensor as we no longer need it + human.tf.dispose(tensor); + + // print data to console + log.data('Results:'); + if (result && result.face && result.face.length > 0) { + for (let i = 0; i < result.face.length; i++) { + const face = result.face[i]; + const emotion = face.emotion.reduce((prev, curr) => (prev.score > curr.score ? prev : curr)); + log.data(` Face: #${i} boxScore:${face.boxScore} faceScore:${face.faceScore} age:${face.age} genderScore:${face.genderScore} gender:${face.gender} emotionScore:${emotion.score} emotion:${emotion.emotion} iris:${face.iris}`); + } + } else { + log.data(' Face: N/A'); + } + if (result && result.body && result.body.length > 0) { + for (let i = 0; i < result.body.length; i++) { + const body = result.body[i]; + log.data(` Body: #${i} score:${body.score} keypoints:${body.keypoints?.length}`); + } + } else { + log.data(' Body: N/A'); + } + if (result && result.hand && result.hand.length > 0) { + for (let i = 0; i < result.hand.length; i++) { + const hand = result.hand[i]; + log.data(` Hand: #${i} score:${hand.score} keypoints:${hand.keypoints?.length}`); + } + } else { + log.data(' Hand: N/A'); + } + if (result && result.gesture && result.gesture.length > 0) { + for (let i = 0; i < result.gesture.length; i++) { + const [key, val] = Object.entries(result.gesture[i]); + log.data(` Gesture: ${key[0]}#${key[1]} gesture:${val[1]}`); + } + } else { + log.data(' Gesture: N/A'); + } + if (result && result.object && result.object.length > 0) { + for (let i = 0; i < result.object.length; i++) { + const object = result.object[i]; + log.data(` Object: #${i} score:${object.score} label:${object.label}`); + } + } else { + log.data(' Object: N/A'); + } + + // print data to console + if (result) { + // invoke persons getter + const persons = result.persons; + + // write result objects to file + // fs.writeFileSync('result.json', JSON.stringify(result, null, 2)); + + log.data('Persons:'); + for (let i = 0; i < persons.length; i++) { + const face = persons[i].face; + const faceTxt = face ? `score:${face.score} age:${face.age} gender:${face.gender} iris:${face.iris}` : null; + const body = persons[i].body; + const bodyTxt = body ? `score:${body.score} keypoints:${body.keypoints?.length}` : null; + log.data(` #${i}: Face:${faceTxt} Body:${bodyTxt} LeftHand:${persons[i].hands.left ? 'yes' : 'no'} RightHand:${persons[i].hands.right ? 'yes' : 'no'} Gestures:${persons[i].gestures.length}`); + } + } + + return result; +} + +async function test() { + process.on('unhandledRejection', (err) => { + // @ts-ignore // no idea if exception message is compelte + log.error(err?.message || err || 'no error message'); + }); + + // test with embedded full body image + let result; + + log.state('Processing embedded warmup image: face'); + myConfig.warmup = 'face'; + result = await human.warmup(myConfig); + + log.state('Processing embedded warmup image: full'); + myConfig.warmup = 'full'; + result = await human.warmup(myConfig); + // no need to print results as they are printed to console during detection from within the library due to human.config.debug set + return result; +} + +async function main() { + log.header(); + log.info('Current folder:', process.env.PWD); + fetch = (await import('node-fetch')).default; + await init(); + const f = process.argv[2]; + if (process.argv.length !== 3) { + log.warn('Parameters: missing'); + await test(); + } else if (!fs.existsSync(f) && !f.startsWith('http')) { + log.error(`File not found: ${process.argv[2]}`); + } else { + if (fs.existsSync(f)) { + const stat = fs.statSync(f); + if (stat.isDirectory()) { + const dir = fs.readdirSync(f); + for (const file of dir) { + await detect(path.join(f, file)); + } + } else { + await detect(f); + } + } else { + await detect(f); + } + } +} + +main(); diff --git a/demo/nodejs/node.js b/demo/nodejs/node.js index 3cbb85f1..ae3987e6 100644 --- a/demo/nodejs/node.js +++ b/demo/nodejs/node.js @@ -6,7 +6,8 @@ const log = require('@vladmandic/pilogger'); const fs = require('fs'); const path = require('path'); const process = require('process'); -const fetch = require('node-fetch').default; + +let fetch; // fetch is dynamically imported later // for NodeJS, `tfjs-node` or `tfjs-node-gpu` should be loaded before using Human // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars @@ -187,6 +188,7 @@ async function test() { async function main() { log.header(); log.info('Current folder:', process.env.PWD); + fetch = (await import('node-fetch')).default; await init(); const f = process.argv[2]; if (process.argv.length !== 3) { diff --git a/package.json b/package.json index a181a8a5..836e2390 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "dev": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught server/serve.js", "build": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught --no-deprecation server/build.js", "lint": "eslint src server demo test", - "test": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught test/test.js", + "test": "node --no-warnings --unhandled-rejections=strict --trace-uncaught test/test.js", "scan": "npx auditjs@latest ossi --dev --quiet" }, "keywords": [ diff --git a/test/test-main.js b/test/test-main.js index 5c010315..d3b109fc 100644 --- a/test/test-main.js +++ b/test/test-main.js @@ -1,6 +1,7 @@ const process = require('process'); const canvasJS = require('canvas'); -const fetch = require('node-fetch').default; + +let fetch; // fetch is dynamically imported later let config; @@ -123,6 +124,7 @@ async function testDetect(human, input, title) { async function test(Human, inputConfig) { config = inputConfig; + fetch = (await import('node-fetch')).default; const ok = await testHTTP(); if (!ok) { log('error', 'aborting test'); diff --git a/test/test.log b/test/test.log index 727c56f1..d6e2a1f3 100644 --- a/test/test.log +++ b/test/test.log @@ -1,120 +1,120 @@ -2021-08-23 08:38:00 INFO:  @vladmandic/human version 2.1.4 -2021-08-23 08:38:00 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.5.0 -2021-08-23 08:38:00 INFO:  tests: ["test-node.js","test-node-gpu.js","test-node-wasm.js"] -2021-08-23 08:38:00 INFO:  test-node.js start -2021-08-23 08:38:01 STATE: test-node.js passed: create human -2021-08-23 08:38:01 INFO:  test-node.js human version: 2.1.4 -2021-08-23 08:38:01 INFO:  test-node.js platform: linux x64 agent: NodeJS v16.5.0 -2021-08-23 08:38:01 INFO:  test-node.js tfjs version: 3.8.0 -2021-08-23 08:38:01 STATE: test-node.js passed: set backend: tensorflow -2021-08-23 08:38:01 STATE: test-node.js passed: load models -2021-08-23 08:38:01 STATE: test-node.js result: defined models: 14 loaded models: 7 -2021-08-23 08:38:01 STATE: test-node.js passed: warmup: none default -2021-08-23 08:38:02 STATE: test-node.js passed: warmup: face default -2021-08-23 08:38:02 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.42,"keypoints":4} -2021-08-23 08:38:02 DATA:  test-node.js result: performance: load: 365 total: 1246 -2021-08-23 08:38:04 STATE: test-node.js passed: warmup: body default -2021-08-23 08:38:04 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} -2021-08-23 08:38:04 DATA:  test-node.js result: performance: load: 365 total: 1077 -2021-08-23 08:38:04 INFO:  test-node.js test body variants -2021-08-23 08:38:04 STATE: test-node.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] -2021-08-23 08:38:05 STATE: test-node.js passed: detect: samples/ai-body.jpg posenet -2021-08-23 08:38:05 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.96,"keypoints":16} -2021-08-23 08:38:05 DATA:  test-node.js result: performance: load: 365 total: 738 -2021-08-23 08:38:06 STATE: test-node.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] -2021-08-23 08:38:06 STATE: test-node.js passed: detect: samples/ai-body.jpg movenet -2021-08-23 08:38:06 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} -2021-08-23 08:38:06 DATA:  test-node.js result: performance: load: 365 total: 194 -2021-08-23 08:38:06 STATE: test-node.js passed: detect: random default -2021-08-23 08:38:06 DATA:  test-node.js result: face: 0 body: 1 hand: 0 gesture: 0 object: 1 person: 0 {} {"score":0.72,"class":"person"} {"score":0,"keypoints":0} -2021-08-23 08:38:06 DATA:  test-node.js result: performance: load: 365 total: 164 -2021-08-23 08:38:07 INFO:  test-node.js test: first instance -2021-08-23 08:38:07 STATE: test-node.js passed: load image: samples/ai-upper.jpg [1,720,688,3] -2021-08-23 08:38:07 STATE: test-node.js passed: detect: samples/ai-upper.jpg default -2021-08-23 08:38:07 DATA:  test-node.js result: face: 0 body: 1 hand: 0 gesture: 1 object: 1 person: 0 {} {"score":0.72,"class":"person"} {"score":0.69,"keypoints":10} -2021-08-23 08:38:07 DATA:  test-node.js result: performance: load: 365 total: 144 -2021-08-23 08:38:07 INFO:  test-node.js test: second instance -2021-08-23 08:38:07 STATE: test-node.js passed: load image: samples/ai-upper.jpg [1,720,688,3] -2021-08-23 08:38:08 STATE: test-node.js passed: detect: samples/ai-upper.jpg default -2021-08-23 08:38:08 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.71,"class":"person"} {"score":0.69,"keypoints":10} -2021-08-23 08:38:08 DATA:  test-node.js result: performance: load: 4 total: 912 -2021-08-23 08:38:08 INFO:  test-node.js test: concurrent -2021-08-23 08:38:08 STATE: test-node.js passed: load image: samples/ai-face.jpg [1,256,256,3] -2021-08-23 08:38:08 STATE: test-node.js passed: load image: samples/ai-face.jpg [1,256,256,3] -2021-08-23 08:38:09 STATE: test-node.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] -2021-08-23 08:38:10 STATE: test-node.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] -2021-08-23 08:38:14 STATE: test-node.js passed: detect: samples/ai-face.jpg default -2021-08-23 08:38:14 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 4 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.47,"keypoints":17} -2021-08-23 08:38:14 DATA:  test-node.js result: performance: load: 365 total: 4268 -2021-08-23 08:38:14 STATE: test-node.js passed: detect: samples/ai-face.jpg default -2021-08-23 08:38:14 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 5 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.47,"keypoints":17} -2021-08-23 08:38:14 DATA:  test-node.js result: performance: load: 4 total: 4268 -2021-08-23 08:38:14 STATE: test-node.js passed: detect: samples/ai-body.jpg default -2021-08-23 08:38:14 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":28.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} -2021-08-23 08:38:14 DATA:  test-node.js result: performance: load: 365 total: 4268 -2021-08-23 08:38:14 STATE: test-node.js passed: detect: samples/ai-body.jpg default -2021-08-23 08:38:14 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":28.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} -2021-08-23 08:38:14 DATA:  test-node.js result: performance: load: 4 total: 4268 -2021-08-23 08:38:14 INFO:  test-node.js test complete: 13405 ms -2021-08-23 08:38:14 INFO:  test-node-gpu.js start -2021-08-23 08:38:15 WARN:  test-node-gpu.js stderr: 2021-08-23 08:38:15.460311: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory -2021-08-23 08:38:15 WARN:  test-node-gpu.js stderr: 2021-08-23 08:38:15.631761: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory -2021-08-23 08:38:15 WARN:  test-node-gpu.js stderr: 2021-08-23 08:38:15.631814: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (wyse): /proc/driver/nvidia/version does not exist -2021-08-23 08:38:15 STATE: test-node-gpu.js passed: create human -2021-08-23 08:38:15 INFO:  test-node-gpu.js human version: 2.1.4 -2021-08-23 08:38:15 INFO:  test-node-gpu.js platform: linux x64 agent: NodeJS v16.5.0 -2021-08-23 08:38:15 INFO:  test-node-gpu.js tfjs version: 3.8.0 -2021-08-23 08:38:15 STATE: test-node-gpu.js passed: set backend: tensorflow -2021-08-23 08:38:15 STATE: test-node-gpu.js passed: load models -2021-08-23 08:38:15 STATE: test-node-gpu.js result: defined models: 14 loaded models: 7 -2021-08-23 08:38:15 STATE: test-node-gpu.js passed: warmup: none default -2021-08-23 08:38:17 STATE: test-node-gpu.js passed: warmup: face default -2021-08-23 08:38:17 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.42,"keypoints":4} -2021-08-23 08:38:17 DATA:  test-node-gpu.js result: performance: load: 282 total: 1241 -2021-08-23 08:38:18 STATE: test-node-gpu.js passed: warmup: body default -2021-08-23 08:38:18 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} -2021-08-23 08:38:18 DATA:  test-node-gpu.js result: performance: load: 282 total: 1054 -2021-08-23 08:38:18 INFO:  test-node-gpu.js test body variants -2021-08-23 08:38:19 STATE: test-node-gpu.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] -2021-08-23 08:38:19 STATE: test-node-gpu.js passed: detect: samples/ai-body.jpg posenet -2021-08-23 08:38:19 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.96,"keypoints":16} -2021-08-23 08:38:19 DATA:  test-node-gpu.js result: performance: load: 282 total: 739 -2021-08-23 08:38:20 STATE: test-node-gpu.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] -2021-08-23 08:38:20 STATE: test-node-gpu.js passed: detect: samples/ai-body.jpg movenet -2021-08-23 08:38:20 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} -2021-08-23 08:38:20 DATA:  test-node-gpu.js result: performance: load: 282 total: 203 -2021-08-23 08:38:21 STATE: test-node-gpu.js passed: detect: random default -2021-08-23 08:38:21 DATA:  test-node-gpu.js result: face: 0 body: 1 hand: 0 gesture: 0 object: 1 person: 0 {} {"score":0.72,"class":"person"} {"score":0,"keypoints":0} -2021-08-23 08:38:21 DATA:  test-node-gpu.js result: performance: load: 282 total: 168 -2021-08-23 08:38:21 INFO:  test-node-gpu.js test: first instance -2021-08-23 08:38:21 STATE: test-node-gpu.js passed: load image: samples/ai-upper.jpg [1,720,688,3] -2021-08-23 08:38:21 STATE: test-node-gpu.js passed: detect: samples/ai-upper.jpg default -2021-08-23 08:38:21 DATA:  test-node-gpu.js result: face: 0 body: 1 hand: 0 gesture: 1 object: 1 person: 0 {} {"score":0.72,"class":"person"} {"score":0.69,"keypoints":10} -2021-08-23 08:38:21 DATA:  test-node-gpu.js result: performance: load: 282 total: 127 -2021-08-23 08:38:21 INFO:  test-node-gpu.js test: second instance -2021-08-23 08:38:21 STATE: test-node-gpu.js passed: load image: samples/ai-upper.jpg [1,720,688,3] -2021-08-23 08:38:22 STATE: test-node-gpu.js passed: detect: samples/ai-upper.jpg default -2021-08-23 08:38:22 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.71,"class":"person"} {"score":0.69,"keypoints":10} -2021-08-23 08:38:22 DATA:  test-node-gpu.js result: performance: load: 2 total: 884 -2021-08-23 08:38:22 INFO:  test-node-gpu.js test: concurrent -2021-08-23 08:38:22 STATE: test-node-gpu.js passed: load image: samples/ai-face.jpg [1,256,256,3] -2021-08-23 08:38:22 STATE: test-node-gpu.js passed: load image: samples/ai-face.jpg [1,256,256,3] -2021-08-23 08:38:23 STATE: test-node-gpu.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] -2021-08-23 08:38:24 STATE: test-node-gpu.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] -2021-08-23 08:38:28 STATE: test-node-gpu.js passed: detect: samples/ai-face.jpg default -2021-08-23 08:38:28 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 4 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.47,"keypoints":17} -2021-08-23 08:38:28 DATA:  test-node-gpu.js result: performance: load: 282 total: 4167 -2021-08-23 08:38:28 STATE: test-node-gpu.js passed: detect: samples/ai-face.jpg default -2021-08-23 08:38:28 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 5 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.47,"keypoints":17} -2021-08-23 08:38:28 DATA:  test-node-gpu.js result: performance: load: 2 total: 4167 -2021-08-23 08:38:28 STATE: test-node-gpu.js passed: detect: samples/ai-body.jpg default -2021-08-23 08:38:28 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":28.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} -2021-08-23 08:38:28 DATA:  test-node-gpu.js result: performance: load: 282 total: 4167 -2021-08-23 08:38:28 STATE: test-node-gpu.js passed: detect: samples/ai-body.jpg default -2021-08-23 08:38:28 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":28.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} -2021-08-23 08:38:28 DATA:  test-node-gpu.js result: performance: load: 2 total: 4167 -2021-08-23 08:38:28 INFO:  test-node-gpu.js test complete: 13105 ms -2021-08-23 08:38:28 INFO:  test-node-wasm.js start -2021-08-23 08:38:29 ERROR: test-node-wasm.js failed: model server: request to http://localhost:10030/models/ failed, reason: connect ECONNREFUSED 127.0.0.1:10030 -2021-08-23 08:38:29 ERROR: test-node-wasm.js aborting test -2021-08-23 08:38:29 INFO:  status: {"passed":46,"failed":1} +2021-08-31 13:28:42 INFO:  @vladmandic/human version 2.1.4 +2021-08-31 13:28:42 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.5.0 +2021-08-31 13:28:42 INFO:  tests: ["test-node.js","test-node-gpu.js","test-node-wasm.js"] +2021-08-31 13:28:42 INFO:  test-node.js start +2021-08-31 13:28:42 STATE: test-node.js passed: create human +2021-08-31 13:28:42 INFO:  test-node.js human version: 2.1.4 +2021-08-31 13:28:42 INFO:  test-node.js platform: linux x64 agent: NodeJS v16.5.0 +2021-08-31 13:28:42 INFO:  test-node.js tfjs version: 3.9.0 +2021-08-31 13:28:42 STATE: test-node.js passed: set backend: tensorflow +2021-08-31 13:28:42 STATE: test-node.js passed: load models +2021-08-31 13:28:42 STATE: test-node.js result: defined models: 14 loaded models: 7 +2021-08-31 13:28:42 STATE: test-node.js passed: warmup: none default +2021-08-31 13:28:44 STATE: test-node.js passed: warmup: face default +2021-08-31 13:28:44 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.42,"keypoints":4} +2021-08-31 13:28:44 DATA:  test-node.js result: performance: load: 291 total: 1167 +2021-08-31 13:28:45 STATE: test-node.js passed: warmup: body default +2021-08-31 13:28:45 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} +2021-08-31 13:28:45 DATA:  test-node.js result: performance: load: 291 total: 1085 +2021-08-31 13:28:45 INFO:  test-node.js test body variants +2021-08-31 13:28:46 STATE: test-node.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] +2021-08-31 13:28:46 STATE: test-node.js passed: detect: samples/ai-body.jpg posenet +2021-08-31 13:28:46 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.96,"keypoints":16} +2021-08-31 13:28:46 DATA:  test-node.js result: performance: load: 291 total: 731 +2021-08-31 13:28:47 STATE: test-node.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] +2021-08-31 13:28:47 STATE: test-node.js passed: detect: samples/ai-body.jpg movenet +2021-08-31 13:28:47 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} +2021-08-31 13:28:47 DATA:  test-node.js result: performance: load: 291 total: 202 +2021-08-31 13:28:48 STATE: test-node.js passed: detect: random default +2021-08-31 13:28:48 DATA:  test-node.js result: face: 0 body: 1 hand: 0 gesture: 0 object: 0 person: 0 {} {} {"score":0,"keypoints":0} +2021-08-31 13:28:48 DATA:  test-node.js result: performance: load: 291 total: 593 +2021-08-31 13:28:48 INFO:  test-node.js test: first instance +2021-08-31 13:28:48 STATE: test-node.js passed: load image: samples/ai-upper.jpg [1,720,688,3] +2021-08-31 13:28:49 STATE: test-node.js passed: detect: samples/ai-upper.jpg default +2021-08-31 13:28:49 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.71,"class":"person"} {"score":0.69,"keypoints":10} +2021-08-31 13:28:49 DATA:  test-node.js result: performance: load: 291 total: 944 +2021-08-31 13:28:49 INFO:  test-node.js test: second instance +2021-08-31 13:28:50 STATE: test-node.js passed: load image: samples/ai-upper.jpg [1,720,688,3] +2021-08-31 13:28:51 STATE: test-node.js passed: detect: samples/ai-upper.jpg default +2021-08-31 13:28:51 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.71,"class":"person"} {"score":0.69,"keypoints":10} +2021-08-31 13:28:51 DATA:  test-node.js result: performance: load: 4 total: 990 +2021-08-31 13:28:51 INFO:  test-node.js test: concurrent +2021-08-31 13:28:51 STATE: test-node.js passed: load image: samples/ai-face.jpg [1,256,256,3] +2021-08-31 13:28:51 STATE: test-node.js passed: load image: samples/ai-face.jpg [1,256,256,3] +2021-08-31 13:28:52 STATE: test-node.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] +2021-08-31 13:28:52 STATE: test-node.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] +2021-08-31 13:28:57 STATE: test-node.js passed: detect: samples/ai-face.jpg default +2021-08-31 13:28:57 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 4 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.47,"keypoints":17} +2021-08-31 13:28:57 DATA:  test-node.js result: performance: load: 291 total: 4433 +2021-08-31 13:28:57 STATE: test-node.js passed: detect: samples/ai-face.jpg default +2021-08-31 13:28:57 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 5 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.47,"keypoints":17} +2021-08-31 13:28:57 DATA:  test-node.js result: performance: load: 4 total: 4433 +2021-08-31 13:28:57 STATE: test-node.js passed: detect: samples/ai-body.jpg default +2021-08-31 13:28:57 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":28.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} +2021-08-31 13:28:57 DATA:  test-node.js result: performance: load: 291 total: 4433 +2021-08-31 13:28:57 STATE: test-node.js passed: detect: samples/ai-body.jpg default +2021-08-31 13:28:57 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":28.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} +2021-08-31 13:28:57 DATA:  test-node.js result: performance: load: 4 total: 4433 +2021-08-31 13:28:57 INFO:  test-node.js test complete: 14689 ms +2021-08-31 13:28:57 INFO:  test-node-gpu.js start +2021-08-31 13:28:57 WARN:  test-node-gpu.js stderr: 2021-08-31 13:28:57.815122: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory +2021-08-31 13:28:57 WARN:  test-node-gpu.js stderr: 2021-08-31 13:28:57.864126: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory +2021-08-31 13:28:57 WARN:  test-node-gpu.js stderr: 2021-08-31 13:28:57.864159: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (wyse): /proc/driver/nvidia/version does not exist +2021-08-31 13:28:57 STATE: test-node-gpu.js passed: create human +2021-08-31 13:28:57 INFO:  test-node-gpu.js human version: 2.1.4 +2021-08-31 13:28:57 INFO:  test-node-gpu.js platform: linux x64 agent: NodeJS v16.5.0 +2021-08-31 13:28:57 INFO:  test-node-gpu.js tfjs version: 3.9.0 +2021-08-31 13:28:58 STATE: test-node-gpu.js passed: set backend: tensorflow +2021-08-31 13:28:58 STATE: test-node-gpu.js passed: load models +2021-08-31 13:28:58 STATE: test-node-gpu.js result: defined models: 14 loaded models: 7 +2021-08-31 13:28:58 STATE: test-node-gpu.js passed: warmup: none default +2021-08-31 13:28:59 STATE: test-node-gpu.js passed: warmup: face default +2021-08-31 13:28:59 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.42,"keypoints":4} +2021-08-31 13:28:59 DATA:  test-node-gpu.js result: performance: load: 300 total: 1133 +2021-08-31 13:29:00 STATE: test-node-gpu.js passed: warmup: body default +2021-08-31 13:29:00 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} +2021-08-31 13:29:00 DATA:  test-node-gpu.js result: performance: load: 300 total: 1090 +2021-08-31 13:29:00 INFO:  test-node-gpu.js test body variants +2021-08-31 13:29:01 STATE: test-node-gpu.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] +2021-08-31 13:29:02 STATE: test-node-gpu.js passed: detect: samples/ai-body.jpg posenet +2021-08-31 13:29:02 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.96,"keypoints":16} +2021-08-31 13:29:02 DATA:  test-node-gpu.js result: performance: load: 300 total: 797 +2021-08-31 13:29:03 STATE: test-node-gpu.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] +2021-08-31 13:29:03 STATE: test-node-gpu.js passed: detect: samples/ai-body.jpg movenet +2021-08-31 13:29:03 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} +2021-08-31 13:29:03 DATA:  test-node-gpu.js result: performance: load: 300 total: 213 +2021-08-31 13:29:03 STATE: test-node-gpu.js passed: detect: random default +2021-08-31 13:29:04 DATA:  test-node-gpu.js result: face: 0 body: 1 hand: 0 gesture: 0 object: 0 person: 0 {} {} {"score":0,"keypoints":0} +2021-08-31 13:29:04 DATA:  test-node-gpu.js result: performance: load: 300 total: 611 +2021-08-31 13:29:04 INFO:  test-node-gpu.js test: first instance +2021-08-31 13:29:04 STATE: test-node-gpu.js passed: load image: samples/ai-upper.jpg [1,720,688,3] +2021-08-31 13:29:05 STATE: test-node-gpu.js passed: detect: samples/ai-upper.jpg default +2021-08-31 13:29:05 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.71,"class":"person"} {"score":0.69,"keypoints":10} +2021-08-31 13:29:05 DATA:  test-node-gpu.js result: performance: load: 300 total: 899 +2021-08-31 13:29:05 INFO:  test-node-gpu.js test: second instance +2021-08-31 13:29:05 STATE: test-node-gpu.js passed: load image: samples/ai-upper.jpg [1,720,688,3] +2021-08-31 13:29:06 STATE: test-node-gpu.js passed: detect: samples/ai-upper.jpg default +2021-08-31 13:29:06 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":29.5,"gender":"female"} {"score":0.71,"class":"person"} {"score":0.69,"keypoints":10} +2021-08-31 13:29:06 DATA:  test-node-gpu.js result: performance: load: 2 total: 882 +2021-08-31 13:29:06 INFO:  test-node-gpu.js test: concurrent +2021-08-31 13:29:06 STATE: test-node-gpu.js passed: load image: samples/ai-face.jpg [1,256,256,3] +2021-08-31 13:29:06 STATE: test-node-gpu.js passed: load image: samples/ai-face.jpg [1,256,256,3] +2021-08-31 13:29:07 STATE: test-node-gpu.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] +2021-08-31 13:29:08 STATE: test-node-gpu.js passed: load image: samples/ai-body.jpg [1,1200,1200,3] +2021-08-31 13:29:12 STATE: test-node-gpu.js passed: detect: samples/ai-face.jpg default +2021-08-31 13:29:12 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 4 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.47,"keypoints":17} +2021-08-31 13:29:12 DATA:  test-node-gpu.js result: performance: load: 300 total: 4339 +2021-08-31 13:29:12 STATE: test-node-gpu.js passed: detect: samples/ai-face.jpg default +2021-08-31 13:29:12 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 5 object: 1 person: 1 {"age":23.6,"gender":"female"} {"score":0.82,"class":"person"} {"score":0.47,"keypoints":17} +2021-08-31 13:29:12 DATA:  test-node-gpu.js result: performance: load: 2 total: 4339 +2021-08-31 13:29:12 STATE: test-node-gpu.js passed: detect: samples/ai-body.jpg default +2021-08-31 13:29:12 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":28.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} +2021-08-31 13:29:12 DATA:  test-node-gpu.js result: performance: load: 300 total: 4339 +2021-08-31 13:29:12 STATE: test-node-gpu.js passed: detect: samples/ai-body.jpg default +2021-08-31 13:29:12 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 person: 1 {"age":28.5,"gender":"female"} {"score":0.72,"class":"person"} {"score":0.92,"keypoints":17} +2021-08-31 13:29:12 DATA:  test-node-gpu.js result: performance: load: 2 total: 4339 +2021-08-31 13:29:12 INFO:  test-node-gpu.js test complete: 14636 ms +2021-08-31 13:29:12 INFO:  test-node-wasm.js start +2021-08-31 13:29:12 ERROR: test-node-wasm.js failed: model server: request to http://localhost:10030/models/ failed, reason: connect ECONNREFUSED 127.0.0.1:10030 +2021-08-31 13:29:12 ERROR: test-node-wasm.js aborting test +2021-08-31 13:29:12 INFO:  status: {"passed":46,"failed":1}