use explicit tensor interface

pull/134/head
Vladimir Mandic 2021-05-22 21:54:18 -04:00
parent a5da0b3b3b
commit d94c1d1513
9 changed files with 202 additions and 135 deletions

View File

@ -11,6 +11,7 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
### **HEAD -> main** 2021/05/22 mandic00@live.com
- enhance strong typing
- rebuild all for release
### **1.9.2** 2021/05/22 mandic00@live.com

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -69,3 +69,20 @@
2021-05-22 21:47:06 INFO:  Generate types: ["src/human.ts"]
2021-05-22 21:47:11 INFO:  Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
2021-05-22 21:47:11 INFO:  Generate TypeDocs: ["src/human.ts"]
2021-05-22 21:52:11 INFO:  @vladmandic/human version 1.9.2
2021-05-22 21:52:11 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.0.0
2021-05-22 21:52:11 INFO:  Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
2021-05-22 21:52:11 STATE: Build for: node type: tfjs: {"imports":1,"importBytes":39,"outputBytes":1292,"outputFiles":"dist/tfjs.esm.js"}
2021-05-22 21:52:11 STATE: Build for: node type: node: {"imports":36,"importBytes":420846,"outputBytes":378274,"outputFiles":"dist/human.node.js"}
2021-05-22 21:52:11 STATE: Build for: nodeGPU type: tfjs: {"imports":1,"importBytes":43,"outputBytes":1300,"outputFiles":"dist/tfjs.esm.js"}
2021-05-22 21:52:11 STATE: Build for: nodeGPU type: node: {"imports":36,"importBytes":420854,"outputBytes":378278,"outputFiles":"dist/human.node-gpu.js"}
2021-05-22 21:52:11 STATE: Build for: nodeWASM type: tfjs: {"imports":1,"importBytes":81,"outputBytes":1367,"outputFiles":"dist/tfjs.esm.js"}
2021-05-22 21:52:11 STATE: Build for: nodeWASM type: node: {"imports":36,"importBytes":420921,"outputBytes":378350,"outputFiles":"dist/human.node-wasm.js"}
2021-05-22 21:52:11 STATE: Build for: browserNoBundle type: tfjs: {"imports":1,"importBytes":2488,"outputBytes":1394,"outputFiles":"dist/tfjs.esm.js"}
2021-05-22 21:52:11 STATE: Build for: browserNoBundle type: esm: {"imports":36,"importBytes":420948,"outputBytes":232338,"outputFiles":"dist/human.esm-nobundle.js"}
2021-05-22 21:52:12 STATE: Build for: browserBundle type: tfjs: {"modules":1274,"moduleBytes":4114813,"imports":7,"importBytes":2488,"outputBytes":1111414,"outputFiles":"dist/tfjs.esm.js"}
2021-05-22 21:52:12 STATE: Build for: browserBundle type: iife: {"imports":36,"importBytes":1530968,"outputBytes":1340202,"outputFiles":"dist/human.js"}
2021-05-22 21:52:13 STATE: Build for: browserBundle type: esm: {"imports":36,"importBytes":1530968,"outputBytes":1340194,"outputFiles":"dist/human.esm.js"}
2021-05-22 21:52:13 INFO:  Generate types: ["src/human.ts"]
2021-05-22 21:52:18 INFO:  Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
2021-05-22 21:52:18 INFO:  Generate TypeDocs: ["src/human.ts"]

View File

@ -6,10 +6,10 @@ import { Tensor, GraphModel } from '../tfjs/types';
export class HandDetector {
model: GraphModel;
anchors: number[][];
anchorsTensor: typeof tf.Tensor;
anchorsTensor: Tensor;
inputSize: number;
inputSizeTensor: typeof tf.Tensor;
doubleInputSizeTensor: typeof tf.Tensor;
inputSizeTensor: Tensor;
doubleInputSizeTensor: Tensor;
constructor(model) {
this.model = model;

View File

@ -1,5 +1,6 @@
import * as tf from '../../dist/tfjs.esm.js';
import * as fxImage from './imagefx';
import { Tensor } from '../tfjs/types';
const maxSize = 2048;
// internal temp canvases
@ -11,7 +12,7 @@ let fx;
// process input image and return tensor
// input can be tensor, imagedata, htmlimageelement, htmlvideoelement
// input is resized and run through imagefx filter
export function process(input, config): { tensor: typeof tf.Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement } {
export function process(input, config): { tensor: Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement } {
let tensor;
if (!input) throw new Error('Human: Input is missing');
// sanity checks since different browsers do not implement all dom elements

View File

@ -1,120 +1,169 @@
2021-05-22 13:15:45 INFO:  @vladmandic/human version 1.9.2
2021-05-22 13:15:45 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.0.0
2021-05-22 13:15:45 INFO:  tests: ["test-node.js","test-node-gpu.js","test-node-wasm.js"]
2021-05-22 13:15:45 INFO:  test-node.js start
2021-05-22 13:15:47 STATE: test-node.js passed: create human
2021-05-22 13:15:47 INFO:  test-node.js human version: 1.9.2
2021-05-22 13:15:47 INFO:  test-node.js platform: linux x64 agent: NodeJS v16.0.0
2021-05-22 13:15:47 INFO:  test-node.js tfjs version: 3.6.0
2021-05-22 13:15:48 STATE: test-node.js passed: set backend: tensorflow
2021-05-22 13:15:48 STATE: test-node.js passed: load models
2021-05-22 13:15:48 STATE: test-node.js result: defined models: 13 loaded models: 6
2021-05-22 13:15:48 STATE: test-node.js passed: warmup: none default
2021-05-22 13:15:49 STATE: test-node.js passed: warmup: face default
2021-05-22 13:15:49 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 5 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8246909379959106,"class":"person"} {"score":0.96,"keypoints":5}
2021-05-22 13:15:49 DATA:  test-node.js result: performance: load: 316 total: 1750
2021-05-22 13:15:51 STATE: test-node.js passed: warmup: body default
2021-05-22 13:15:51 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":29.5,"gender":"female"} {"score":0.7261000871658325,"class":"person"} {"score":0.92,"keypoints":17}
2021-05-22 13:15:51 DATA:  test-node.js result: performance: load: 316 total: 1623
2021-05-22 13:15:51 INFO:  test-node.js test body variants
2021-05-22 13:15:52 STATE: test-node.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 13:15:53 STATE: test-node.js passed: detect: assets/human-sample-body.jpg posenet
2021-05-22 13:15:53 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1} {"score":0.7261000871658325,"class":"person"} {"score":0.91,"keypoints":17}
2021-05-22 13:15:53 DATA:  test-node.js result: performance: load: 316 total: 986
2021-05-22 13:15:54 STATE: test-node.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 13:15:55 STATE: test-node.js passed: detect: assets/human-sample-body.jpg blazepose
2021-05-22 13:15:55 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1} {"score":0.7261000871658325,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:15:55 DATA:  test-node.js result: performance: load: 316 total: 447
2021-05-22 13:15:56 STATE: test-node.js passed: detect: random default
2021-05-22 13:15:56 DATA:  test-node.js result: face: 0 body: 1 hand: 0 gesture: 1 object: 0 {} {} {"score":1,"keypoints":39}
2021-05-22 13:15:56 DATA:  test-node.js result: performance: load: 316 total: 855
2021-05-22 13:15:56 INFO:  test-node.js test: first instance
2021-05-22 13:15:56 STATE: test-node.js passed: load image: assets/sample-me.jpg [1,700,700,3]
2021-05-22 13:15:58 STATE: test-node.js passed: detect: assets/sample-me.jpg default
2021-05-22 13:15:58 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 2 {"confidence":1,"age":39.2,"gender":"male"} {"score":0.6820425987243652,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:15:58 DATA:  test-node.js result: performance: load: 316 total: 1698
2021-05-22 13:15:58 INFO:  test-node.js test: second instance
2021-05-22 13:15:58 STATE: test-node.js passed: load image: assets/sample-me.jpg [1,700,700,3]
2021-05-22 13:16:00 STATE: test-node.js passed: detect: assets/sample-me.jpg default
2021-05-22 13:16:00 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 2 {"confidence":1,"age":39.2,"gender":"male"} {"score":0.6820425987243652,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:00 DATA:  test-node.js result: performance: load: 6 total: 1565
2021-05-22 13:16:00 INFO:  test-node.js test: concurrent
2021-05-22 13:16:00 STATE: test-node.js passed: load image: assets/human-sample-face.jpg [1,256,256,3]
2021-05-22 13:16:00 STATE: test-node.js passed: load image: assets/human-sample-face.jpg [1,256,256,3]
2021-05-22 13:16:01 STATE: test-node.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 13:16:02 STATE: test-node.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 13:16:08 STATE: test-node.js passed: detect: assets/human-sample-face.jpg default
2021-05-22 13:16:08 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8257162570953369,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:08 DATA:  test-node.js result: performance: load: 316 total: 5968
2021-05-22 13:16:08 STATE: test-node.js passed: detect: assets/human-sample-face.jpg default
2021-05-22 13:16:08 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8257162570953369,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:08 DATA:  test-node.js result: performance: load: 6 total: 5968
2021-05-22 13:16:08 STATE: test-node.js passed: detect: assets/human-sample-body.jpg default
2021-05-22 13:16:08 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":28.5,"gender":"female"} {"score":0.7273815870285034,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:08 DATA:  test-node.js result: performance: load: 316 total: 5968
2021-05-22 13:16:08 STATE: test-node.js passed: detect: assets/human-sample-body.jpg default
2021-05-22 13:16:08 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":28.5,"gender":"female"} {"score":0.7273815870285034,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:08 DATA:  test-node.js result: performance: load: 6 total: 5968
2021-05-22 13:16:08 INFO:  test-node.js test complete: 20457 ms
2021-05-22 13:16:08 INFO:  test-node-gpu.js start
2021-05-22 13:16:09 WARN:  test-node-gpu.js stderr: 2021-05-22 13:16:09.343674: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] 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-05-22 13:16:09 WARN:  test-node-gpu.js stderr: 2021-05-22 13:16:09.549356: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2021-05-22 13:16:09 WARN:  test-node-gpu.js stderr: 2021-05-22 13:16:09.549556: 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-05-22 13:16:09 STATE: test-node-gpu.js passed: create human
2021-05-22 13:16:09 INFO:  test-node-gpu.js human version: 1.9.2
2021-05-22 13:16:09 INFO:  test-node-gpu.js platform: linux x64 agent: NodeJS v16.0.0
2021-05-22 13:16:09 INFO:  test-node-gpu.js tfjs version: 3.6.0
2021-05-22 13:16:10 STATE: test-node-gpu.js passed: set backend: tensorflow
2021-05-22 13:16:10 STATE: test-node-gpu.js passed: load models
2021-05-22 13:16:10 STATE: test-node-gpu.js result: defined models: 13 loaded models: 6
2021-05-22 13:16:10 STATE: test-node-gpu.js passed: warmup: none default
2021-05-22 13:16:11 STATE: test-node-gpu.js passed: warmup: face default
2021-05-22 13:16:11 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 5 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8246909379959106,"class":"person"} {"score":0.96,"keypoints":5}
2021-05-22 13:16:11 DATA:  test-node-gpu.js result: performance: load: 349 total: 1851
2021-05-22 13:16:13 STATE: test-node-gpu.js passed: warmup: body default
2021-05-22 13:16:13 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":29.5,"gender":"female"} {"score":0.7261000871658325,"class":"person"} {"score":0.92,"keypoints":17}
2021-05-22 13:16:13 DATA:  test-node-gpu.js result: performance: load: 349 total: 1702
2021-05-22 13:16:13 INFO:  test-node-gpu.js test body variants
2021-05-22 13:16:14 STATE: test-node-gpu.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 13:16:15 STATE: test-node-gpu.js passed: detect: assets/human-sample-body.jpg posenet
2021-05-22 13:16:15 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1} {"score":0.7261000871658325,"class":"person"} {"score":0.91,"keypoints":17}
2021-05-22 13:16:15 DATA:  test-node-gpu.js result: performance: load: 349 total: 1075
2021-05-22 13:16:16 STATE: test-node-gpu.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 13:16:17 STATE: test-node-gpu.js passed: detect: assets/human-sample-body.jpg blazepose
2021-05-22 13:16:17 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1} {"score":0.7261000871658325,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:17 DATA:  test-node-gpu.js result: performance: load: 349 total: 403
2021-05-22 13:16:18 STATE: test-node-gpu.js passed: detect: random default
2021-05-22 13:16:18 DATA:  test-node-gpu.js result: face: 0 body: 1 hand: 0 gesture: 1 object: 0 {} {} {"score":1,"keypoints":39}
2021-05-22 13:16:18 DATA:  test-node-gpu.js result: performance: load: 349 total: 865
2021-05-22 13:16:18 INFO:  test-node-gpu.js test: first instance
2021-05-22 13:16:18 STATE: test-node-gpu.js passed: load image: assets/sample-me.jpg [1,700,700,3]
2021-05-22 13:16:20 STATE: test-node-gpu.js passed: detect: assets/sample-me.jpg default
2021-05-22 13:16:20 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 2 {"confidence":1,"age":39.2,"gender":"male"} {"score":0.6820425987243652,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:20 DATA:  test-node-gpu.js result: performance: load: 349 total: 1689
2021-05-22 13:16:20 INFO:  test-node-gpu.js test: second instance
2021-05-22 13:16:20 STATE: test-node-gpu.js passed: load image: assets/sample-me.jpg [1,700,700,3]
2021-05-22 13:16:22 STATE: test-node-gpu.js passed: detect: assets/sample-me.jpg default
2021-05-22 13:16:22 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 2 {"confidence":1,"age":39.2,"gender":"male"} {"score":0.6820425987243652,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:22 DATA:  test-node-gpu.js result: performance: load: 4 total: 1609
2021-05-22 13:16:22 INFO:  test-node-gpu.js test: concurrent
2021-05-22 13:16:22 STATE: test-node-gpu.js passed: load image: assets/human-sample-face.jpg [1,256,256,3]
2021-05-22 13:16:22 STATE: test-node-gpu.js passed: load image: assets/human-sample-face.jpg [1,256,256,3]
2021-05-22 13:16:23 STATE: test-node-gpu.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 13:16:24 STATE: test-node-gpu.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 13:16:30 STATE: test-node-gpu.js passed: detect: assets/human-sample-face.jpg default
2021-05-22 13:16:30 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8257162570953369,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:30 DATA:  test-node-gpu.js result: performance: load: 349 total: 6142
2021-05-22 13:16:30 STATE: test-node-gpu.js passed: detect: assets/human-sample-face.jpg default
2021-05-22 13:16:30 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8257162570953369,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:30 DATA:  test-node-gpu.js result: performance: load: 4 total: 6142
2021-05-22 13:16:30 STATE: test-node-gpu.js passed: detect: assets/human-sample-body.jpg default
2021-05-22 13:16:30 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":28.5,"gender":"female"} {"score":0.7273815870285034,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:30 DATA:  test-node-gpu.js result: performance: load: 349 total: 6142
2021-05-22 13:16:30 STATE: test-node-gpu.js passed: detect: assets/human-sample-body.jpg default
2021-05-22 13:16:30 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":28.5,"gender":"female"} {"score":0.7273815870285034,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 13:16:30 DATA:  test-node-gpu.js result: performance: load: 4 total: 6142
2021-05-22 13:16:30 INFO:  test-node-gpu.js test complete: 20887 ms
2021-05-22 13:16:30 INFO:  test-node-wasm.js start
2021-05-22 13:16:30 ERROR: test-node-wasm.js failed: model server: request to http://localhost:10030/models/ failed, reason: connect ECONNREFUSED 127.0.0.1:10030
2021-05-22 13:16:30 ERROR: test-node-wasm.js aborting test
2021-05-22 13:16:31 INFO:  status: {"passed":46,"failed":1}
2021-05-22 21:52:51 INFO:  @vladmandic/human version 1.9.2
2021-05-22 21:52:51 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.0.0
2021-05-22 21:52:51 INFO:  tests: ["test-node.js","test-node-gpu.js","test-node-wasm.js"]
2021-05-22 21:52:51 INFO:  test-node.js start
2021-05-22 21:52:52 STATE: test-node.js passed: create human
2021-05-22 21:52:52 INFO:  test-node.js human version: 1.9.2
2021-05-22 21:52:52 INFO:  test-node.js platform: linux x64 agent: NodeJS v16.0.0
2021-05-22 21:52:52 INFO:  test-node.js tfjs version: 3.6.0
2021-05-22 21:52:52 STATE: test-node.js passed: set backend: tensorflow
2021-05-22 21:52:52 STATE: test-node.js passed: load models
2021-05-22 21:52:52 STATE: test-node.js result: defined models: 13 loaded models: 6
2021-05-22 21:52:52 STATE: test-node.js passed: warmup: none default
2021-05-22 21:52:54 STATE: test-node.js passed: warmup: face default
2021-05-22 21:52:54 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 5 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8246909379959106,"class":"person"} {"score":0.96,"keypoints":5}
2021-05-22 21:52:54 DATA:  test-node.js result: performance: load: 400 total: 1668
2021-05-22 21:52:55 STATE: test-node.js passed: warmup: body default
2021-05-22 21:52:55 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":29.5,"gender":"female"} {"score":0.7261000871658325,"class":"person"} {"score":0.92,"keypoints":17}
2021-05-22 21:52:55 DATA:  test-node.js result: performance: load: 400 total: 1611
2021-05-22 21:52:55 INFO:  test-node.js test body variants
2021-05-22 21:52:56 STATE: test-node.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:52:57 STATE: test-node.js passed: detect: assets/human-sample-body.jpg posenet
2021-05-22 21:52:57 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1} {"score":0.7261000871658325,"class":"person"} {"score":0.91,"keypoints":17}
2021-05-22 21:52:57 DATA:  test-node.js result: performance: load: 400 total: 1031
2021-05-22 21:52:58 STATE: test-node.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:52:59 STATE: test-node.js passed: detect: assets/human-sample-body.jpg blazepose
2021-05-22 21:52:59 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1} {"score":0.7261000871658325,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:52:59 DATA:  test-node.js result: performance: load: 400 total: 466
2021-05-22 21:53:00 STATE: test-node.js passed: detect: random default
2021-05-22 21:53:00 DATA:  test-node.js result: face: 0 body: 1 hand: 0 gesture: 1 object: 0 {} {} {"score":1,"keypoints":39}
2021-05-22 21:53:00 DATA:  test-node.js result: performance: load: 400 total: 921
2021-05-22 21:53:00 INFO:  test-node.js test: first instance
2021-05-22 21:53:00 STATE: test-node.js passed: load image: assets/sample-me.jpg [1,700,700,3]
2021-05-22 21:53:02 STATE: test-node.js passed: detect: assets/sample-me.jpg default
2021-05-22 21:53:02 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 2 {"confidence":1,"age":39.2,"gender":"male"} {"score":0.6820425987243652,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:02 DATA:  test-node.js result: performance: load: 400 total: 1652
2021-05-22 21:53:02 INFO:  test-node.js test: second instance
2021-05-22 21:53:02 STATE: test-node.js passed: load image: assets/sample-me.jpg [1,700,700,3]
2021-05-22 21:53:04 STATE: test-node.js passed: detect: assets/sample-me.jpg default
2021-05-22 21:53:04 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 2 {"confidence":1,"age":39.2,"gender":"male"} {"score":0.6820425987243652,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:04 DATA:  test-node.js result: performance: load: 1 total: 1529
2021-05-22 21:53:04 INFO:  test-node.js test: concurrent
2021-05-22 21:53:04 STATE: test-node.js passed: load image: assets/human-sample-face.jpg [1,256,256,3]
2021-05-22 21:53:04 STATE: test-node.js passed: load image: assets/human-sample-face.jpg [1,256,256,3]
2021-05-22 21:53:05 STATE: test-node.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:53:06 STATE: test-node.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:53:12 STATE: test-node.js passed: detect: assets/human-sample-face.jpg default
2021-05-22 21:53:12 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8257162570953369,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:12 DATA:  test-node.js result: performance: load: 400 total: 5889
2021-05-22 21:53:12 STATE: test-node.js passed: detect: assets/human-sample-face.jpg default
2021-05-22 21:53:12 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8257162570953369,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:12 DATA:  test-node.js result: performance: load: 1 total: 5889
2021-05-22 21:53:12 STATE: test-node.js passed: detect: assets/human-sample-body.jpg default
2021-05-22 21:53:12 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":28.5,"gender":"female"} {"score":0.7273815870285034,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:12 DATA:  test-node.js result: performance: load: 400 total: 5889
2021-05-22 21:53:12 STATE: test-node.js passed: detect: assets/human-sample-body.jpg default
2021-05-22 21:53:12 DATA:  test-node.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":28.5,"gender":"female"} {"score":0.7273815870285034,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:12 DATA:  test-node.js result: performance: load: 1 total: 5889
2021-05-22 21:53:12 INFO:  test-node.js test complete: 20467 ms
2021-05-22 21:53:12 INFO:  test-node-gpu.js start
2021-05-22 21:53:13 WARN:  test-node-gpu.js stderr: 2021-05-22 21:53:13.374497: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] 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-05-22 21:53:13 WARN:  test-node-gpu.js stderr: 2021-05-22 21:53:13.489445: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2021-05-22 21:53:13 WARN:  test-node-gpu.js stderr: 2021-05-22 21:53:13.489654: 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-05-22 21:53:13 STATE: test-node-gpu.js passed: create human
2021-05-22 21:53:13 INFO:  test-node-gpu.js human version: 1.9.2
2021-05-22 21:53:13 INFO:  test-node-gpu.js platform: linux x64 agent: NodeJS v16.0.0
2021-05-22 21:53:13 INFO:  test-node-gpu.js tfjs version: 3.6.0
2021-05-22 21:53:13 STATE: test-node-gpu.js passed: set backend: tensorflow
2021-05-22 21:53:13 STATE: test-node-gpu.js passed: load models
2021-05-22 21:53:13 STATE: test-node-gpu.js result: defined models: 13 loaded models: 6
2021-05-22 21:53:13 STATE: test-node-gpu.js passed: warmup: none default
2021-05-22 21:53:15 STATE: test-node-gpu.js passed: warmup: face default
2021-05-22 21:53:15 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 5 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8246909379959106,"class":"person"} {"score":0.96,"keypoints":5}
2021-05-22 21:53:15 DATA:  test-node-gpu.js result: performance: load: 330 total: 1688
2021-05-22 21:53:17 STATE: test-node-gpu.js passed: warmup: body default
2021-05-22 21:53:17 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":29.5,"gender":"female"} {"score":0.7261000871658325,"class":"person"} {"score":0.92,"keypoints":17}
2021-05-22 21:53:17 DATA:  test-node-gpu.js result: performance: load: 330 total: 1650
2021-05-22 21:53:17 INFO:  test-node-gpu.js test body variants
2021-05-22 21:53:18 STATE: test-node-gpu.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:53:19 STATE: test-node-gpu.js passed: detect: assets/human-sample-body.jpg posenet
2021-05-22 21:53:19 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1} {"score":0.7261000871658325,"class":"person"} {"score":0.91,"keypoints":17}
2021-05-22 21:53:19 DATA:  test-node-gpu.js result: performance: load: 330 total: 1058
2021-05-22 21:53:20 STATE: test-node-gpu.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:53:20 STATE: test-node-gpu.js passed: detect: assets/human-sample-body.jpg blazepose
2021-05-22 21:53:20 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1} {"score":0.7261000871658325,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:20 DATA:  test-node-gpu.js result: performance: load: 330 total: 437
2021-05-22 21:53:21 STATE: test-node-gpu.js passed: detect: random default
2021-05-22 21:53:21 DATA:  test-node-gpu.js result: face: 0 body: 1 hand: 0 gesture: 1 object: 0 {} {} {"score":1,"keypoints":39}
2021-05-22 21:53:21 DATA:  test-node-gpu.js result: performance: load: 330 total: 951
2021-05-22 21:53:21 INFO:  test-node-gpu.js test: first instance
2021-05-22 21:53:22 STATE: test-node-gpu.js passed: load image: assets/sample-me.jpg [1,700,700,3]
2021-05-22 21:53:24 STATE: test-node-gpu.js passed: detect: assets/sample-me.jpg default
2021-05-22 21:53:24 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 2 {"confidence":1,"age":39.2,"gender":"male"} {"score":0.6820425987243652,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:24 DATA:  test-node-gpu.js result: performance: load: 330 total: 1968
2021-05-22 21:53:24 INFO:  test-node-gpu.js test: second instance
2021-05-22 21:53:24 STATE: test-node-gpu.js passed: load image: assets/sample-me.jpg [1,700,700,3]
2021-05-22 21:53:26 STATE: test-node-gpu.js passed: detect: assets/sample-me.jpg default
2021-05-22 21:53:26 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 2 {"confidence":1,"age":39.2,"gender":"male"} {"score":0.6820425987243652,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:26 DATA:  test-node-gpu.js result: performance: load: 2 total: 1975
2021-05-22 21:53:26 INFO:  test-node-gpu.js test: concurrent
2021-05-22 21:53:26 STATE: test-node-gpu.js passed: load image: assets/human-sample-face.jpg [1,256,256,3]
2021-05-22 21:53:26 STATE: test-node-gpu.js passed: load image: assets/human-sample-face.jpg [1,256,256,3]
2021-05-22 21:53:27 STATE: test-node-gpu.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:53:28 STATE: test-node-gpu.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:53:35 STATE: test-node-gpu.js passed: detect: assets/human-sample-face.jpg default
2021-05-22 21:53:35 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8257162570953369,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:35 DATA:  test-node-gpu.js result: performance: load: 330 total: 6500
2021-05-22 21:53:35 STATE: test-node-gpu.js passed: detect: assets/human-sample-face.jpg default
2021-05-22 21:53:35 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 1 {"confidence":1,"age":23.6,"gender":"female"} {"score":0.8257162570953369,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:35 DATA:  test-node-gpu.js result: performance: load: 2 total: 6500
2021-05-22 21:53:35 STATE: test-node-gpu.js passed: detect: assets/human-sample-body.jpg default
2021-05-22 21:53:35 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":28.5,"gender":"female"} {"score":0.7273815870285034,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:35 DATA:  test-node-gpu.js result: performance: load: 330 total: 6500
2021-05-22 21:53:35 STATE: test-node-gpu.js passed: detect: assets/human-sample-body.jpg default
2021-05-22 21:53:35 DATA:  test-node-gpu.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 1 {"confidence":1,"age":28.5,"gender":"female"} {"score":0.7273815870285034,"class":"person"} {"score":1,"keypoints":39}
2021-05-22 21:53:35 DATA:  test-node-gpu.js result: performance: load: 2 total: 6500
2021-05-22 21:53:35 INFO:  test-node-gpu.js test complete: 21880 ms
2021-05-22 21:53:35 INFO:  test-node-wasm.js start
2021-05-22 21:53:35 STATE: test-node-wasm.js passed: model server: http://localhost:10030/models/
2021-05-22 21:53:35 STATE: test-node-wasm.js passed: create human
2021-05-22 21:53:35 INFO:  test-node-wasm.js human version: 1.9.2
2021-05-22 21:53:35 INFO:  test-node-wasm.js platform: linux x64 agent: NodeJS v16.0.0
2021-05-22 21:53:35 INFO:  test-node-wasm.js tfjs version: 3.6.0
2021-05-22 21:53:36 STATE: test-node-wasm.js passed: set backend: wasm
2021-05-22 21:53:36 STATE: test-node-wasm.js passed: load models
2021-05-22 21:53:36 STATE: test-node-wasm.js result: defined models: 13 loaded models: 5
2021-05-22 21:53:36 STATE: test-node-wasm.js passed: warmup: none default
2021-05-22 21:53:36 ERROR: test-node-wasm.js failed: warmup: face default
2021-05-22 21:53:36 ERROR: test-node-wasm.js failed: warmup: body default
2021-05-22 21:53:36 INFO:  test-node-wasm.js test body variants
2021-05-22 21:53:38 STATE: test-node-wasm.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:53:41 STATE: test-node-wasm.js passed: detect: assets/human-sample-body.jpg posenet
2021-05-22 21:53:41 DATA:  test-node-wasm.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 0 {"confidence":1,"age":28.5,"gender":"female"} {} {"score":0.91,"keypoints":17}
2021-05-22 21:53:41 DATA:  test-node-wasm.js result: performance: load: 655 total: 3191
2021-05-22 21:53:43 STATE: test-node-wasm.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:53:45 STATE: test-node-wasm.js passed: detect: assets/human-sample-body.jpg blazepose
2021-05-22 21:53:45 DATA:  test-node-wasm.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 0 {"confidence":1} {} {"score":1,"keypoints":39}
2021-05-22 21:53:45 DATA:  test-node-wasm.js result: performance: load: 655 total: 2321
2021-05-22 21:53:47 STATE: test-node-wasm.js passed: detect: random default
2021-05-22 21:53:47 DATA:  test-node-wasm.js result: face: 0 body: 1 hand: 0 gesture: 1 object: 0 {} {} {"score":1,"keypoints":39}
2021-05-22 21:53:47 DATA:  test-node-wasm.js result: performance: load: 655 total: 1791
2021-05-22 21:53:47 INFO:  test-node-wasm.js test: first instance
2021-05-22 21:53:48 STATE: test-node-wasm.js passed: load image: assets/sample-me.jpg [1,700,700,3]
2021-05-22 21:53:51 STATE: test-node-wasm.js passed: detect: assets/sample-me.jpg default
2021-05-22 21:53:51 DATA:  test-node-wasm.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 0 {"confidence":1,"age":39.2,"gender":"male"} {} {"score":1,"keypoints":39}
2021-05-22 21:53:51 DATA:  test-node-wasm.js result: performance: load: 655 total: 2478
2021-05-22 21:53:51 INFO:  test-node-wasm.js test: second instance
2021-05-22 21:53:51 STATE: test-node-wasm.js passed: load image: assets/sample-me.jpg [1,700,700,3]
2021-05-22 21:53:54 STATE: test-node-wasm.js passed: detect: assets/sample-me.jpg default
2021-05-22 21:53:54 DATA:  test-node-wasm.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 0 {"confidence":1,"age":39.2,"gender":"male"} {} {"score":1,"keypoints":39}
2021-05-22 21:53:54 DATA:  test-node-wasm.js result: performance: load: 5 total: 2418
2021-05-22 21:53:54 INFO:  test-node-wasm.js test: concurrent
2021-05-22 21:53:54 STATE: test-node-wasm.js passed: load image: assets/human-sample-face.jpg [1,256,256,3]
2021-05-22 21:53:54 STATE: test-node-wasm.js passed: load image: assets/human-sample-face.jpg [1,256,256,3]
2021-05-22 21:53:56 STATE: test-node-wasm.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:53:58 STATE: test-node-wasm.js passed: load image: assets/human-sample-body.jpg [1,1200,1200,3]
2021-05-22 21:54:07 STATE: test-node-wasm.js passed: detect: assets/human-sample-face.jpg default
2021-05-22 21:54:07 DATA:  test-node-wasm.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 0 {"confidence":1,"age":23.6,"gender":"female"} {} {"score":1,"keypoints":39}
2021-05-22 21:54:07 DATA:  test-node-wasm.js result: performance: load: 655 total: 9455
2021-05-22 21:54:07 STATE: test-node-wasm.js passed: detect: assets/human-sample-face.jpg default
2021-05-22 21:54:07 DATA:  test-node-wasm.js result: face: 1 body: 1 hand: 0 gesture: 6 object: 0 {"confidence":1,"age":23.6,"gender":"female"} {} {"score":1,"keypoints":39}
2021-05-22 21:54:07 DATA:  test-node-wasm.js result: performance: load: 5 total: 9455
2021-05-22 21:54:07 STATE: test-node-wasm.js passed: detect: assets/human-sample-body.jpg default
2021-05-22 21:54:07 DATA:  test-node-wasm.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 0 {"confidence":1,"age":28.5,"gender":"female"} {} {"score":1,"keypoints":39}
2021-05-22 21:54:07 DATA:  test-node-wasm.js result: performance: load: 655 total: 9455
2021-05-22 21:54:07 STATE: test-node-wasm.js passed: detect: assets/human-sample-body.jpg default
2021-05-22 21:54:07 DATA:  test-node-wasm.js result: face: 1 body: 1 hand: 0 gesture: 3 object: 0 {"confidence":1,"age":28.5,"gender":"female"} {} {"score":1,"keypoints":39}
2021-05-22 21:54:07 DATA:  test-node-wasm.js result: performance: load: 5 total: 9455
2021-05-22 21:54:07 INFO:  test-node-wasm.js test complete: 31722 ms
2021-05-22 21:54:07 INFO:  status: {"passed":68,"failed":2}

View File

@ -1,12 +1,11 @@
import * as tf from '../../dist/tfjs.esm.js';
import { GraphModel } from '../tfjs/types';
import { Tensor, GraphModel } from '../tfjs/types';
export declare class HandDetector {
model: GraphModel;
anchors: number[][];
anchorsTensor: typeof tf.Tensor;
anchorsTensor: Tensor;
inputSize: number;
inputSizeTensor: typeof tf.Tensor;
doubleInputSizeTensor: typeof tf.Tensor;
inputSizeTensor: Tensor;
doubleInputSizeTensor: Tensor;
constructor(model: any);
normalizeBoxes(boxes: any): any;
normalizeLandmarks(rawPalmLandmarks: any, index: any): any;

View File

@ -1,5 +1,5 @@
import * as tf from '../../dist/tfjs.esm.js';
import { Tensor } from '../tfjs/types';
export declare function process(input: any, config: any): {
tensor: typeof tf.Tensor | null;
tensor: Tensor | null;
canvas: OffscreenCanvas | HTMLCanvasElement;
};