add curve draw output and update nodejs demos

master
Vladimir Mandic 2021-03-06 10:37:52 -05:00
parent ce4f3e12bd
commit 562a698dae
3 changed files with 82 additions and 11 deletions

@ -12,8 +12,9 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
### **HEAD -> main** 2021/03/05 mandic00@live.com ### **HEAD -> main** 2021/03/05 mandic00@live.com
### **origin/main** 2021/03/05 mandic00@live.com ### **0.40.5** 2021/03/05 mandic00@live.com
- fix human.draw
### **0.40.4** 2021/03/05 mandic00@live.com ### **0.40.4** 2021/03/05 mandic00@live.com

@ -4,7 +4,7 @@ Demos are included in `/demo`:
<br> <br>
**Browser**: ## Browser
- `index.html`: Full demo using Browser with ESM module, includes selectable backends and webworkers - `index.html`: Full demo using Browser with ESM module, includes selectable backends and webworkers
@ -13,7 +13,7 @@ included micro http2 server with source file monitoring and dynamic rebuild*
<br> <br>
## Changing Demo Target ### Changing Demo Target
Demo in `demo/index.html` loads `dist/demo-browser-index.js` which is built from sources in `demo`, starting with `demo/browser` Demo in `demo/index.html` loads `dist/demo-browser-index.js` which is built from sources in `demo`, starting with `demo/browser`
This bundled version is needed since mobile browsers (e.g. Chrome on Android) do not support native modules loading yet This bundled version is needed since mobile browsers (e.g. Chrome on Android) do not support native modules loading yet
@ -22,7 +22,7 @@ If your target is desktop, alternatively you can load `demo/browser.js` directly
<br> <br>
## Demo Options ### Demo Options
Demo implements several ways to use `Human` library, Demo implements several ways to use `Human` library,
all configurable in `browse.js:ui` configuration object and in the UI itself: all configurable in `browse.js:ui` configuration object and in the UI itself:
@ -40,7 +40,82 @@ all configurable in `browse.js:ui` configuration object and in the UI itself:
- `ui.drawPolygons`: connect detected points with polygons - `ui.drawPolygons`: connect detected points with polygons
- `ui.fillPolygons`: fill drawn polygons - `ui.fillPolygons`: fill drawn polygons
<br> <br><hr><br>
## NodeJS
- `node.js`: Demo using NodeJS with CommonJS module
Simple demo that can process any input image
```shell
node demo/node.js
```
```json
10:28:53.444 Human: version: 0.40.5 TensorFlow/JS version: 3.2.0
10:28:53.445 Human: platform: linux x64
10:28:53.445 Human: agent: NodeJS v15.7.0
10:28:53.445 Human: setting backend: tensorflow
10:28:53.505 Human: load model: /models/faceboxes
10:28:53.505 Human: load model: /models/iris
10:28:53.522 Human: load model: /models/age-ssrnet-imdb
10:28:53.529 Human: load model: /models/gender
10:28:53.535 Human: load model: /models/emotion
10:28:53.607 Human: load model: /models/handdetect
10:28:53.608 Human: load model: /models/handskeleton
10:28:53.698 Human: load model: /models/posenet
10:28:53.698 Human: tf engine state: 31020964 bytes 932 tensors
2021-03-06 10:28:53 INFO: Loaded: [ 'posenet', 'handpose', 'age', 'gender', 'emotion', 'face', [length]: 6 ]
2021-03-06 10:28:53 INFO: Memory state: { numTensors: 932, numDataBuffers: 932, numBytes: 31020964 }
2021-03-06 10:28:53 WARN: Parameters: <input image> missing
2021-03-06 10:28:53 STATE: Processing embedded warmup image: full
2021-03-06 10:28:54 DATA: Face: [
{
confidence: 0.9981339573860168,
faceConfidence: undefined,
boxConfidence: undefined,
box: [ 43, 20, 182, 231, [length]: 4 ],
mesh: undefined,
boxRaw: null,
meshRaw: undefined,
annotations: undefined,
age: 24.3,
gender: 'female',
genderConfidence: 0.84,
emotion: [ { score: 0.83, emotion: 'neutral' }, { score: 0.12, emotion: 'sad' }, [length]: 2 ],
embedding: [ [length]: 0 ],
iris: 0
},
]
2021-03-06 10:28:54 DATA: Body: [
{
score: 0.9466612444204443,
keypoints: [
{ score: 0.9937239289283752, part: 'nose', position: { x: 597, y: 126 } },
{ score: 0.994640588760376, part: 'leftEye', position: { x: 602, y: 113 } },
{ score: 0.9851681590080261, part: 'rightEye', position: { x: 597, y: 114 } },
{ score: 0.9937878251075745, part: 'leftEar', position: { x: 633, y: 131 } },
{ score: 0.8690065145492554, part: 'rightEar', position: { x: 584, y: 146 } },
{ score: 0.9881162643432617, part: 'leftShoulder', position: { x: 661, y: 228 } },
{ score: 0.9983603954315186, part: 'rightShoulder', position: { x: 541, y: 253 } },
{ score: 0.9678125381469727, part: 'leftElbow', position: { x: 808, y: 392 } },
{ score: 0.9479317665100098, part: 'rightElbow', position: { x: 461, y: 387 } },
{ score: 0.9611830711364746, part: 'leftWrist', position: { x: 896, y: 521 } },
{ score: 0.8795050382614136, part: 'rightWrist', position: { x: 323, y: 503 } },
{ score: 0.9769214391708374, part: 'leftHip', position: { x: 655, y: 540 } },
{ score: 0.9489732384681702, part: 'rightHip', position: { x: 567, y: 533 } },
{ score: 0.9663040041923523, part: 'leftKnee', position: { x: 646, y: 827 } },
{ score: 0.9643898010253906, part: 'rightKnee', position: { x: 561, y: 818 } },
{ score: 0.9095755815505981, part: 'leftAnkle', position: { x: 667, y: 1103 } },
{ score: 0.7478410005569458, part: 'rightAnkle', position: { x: 624, y: 1059 } },
[length]: 17
]
},
]
2021-03-06 10:28:54 DATA: Hand: [ [length]: 0 ]
2021-03-06 10:28:54 DATA: Gesture: [ { body: 0, gesture: 'leaning right' }, [length]: 1 ]
10:28:54.968 Human: Warmup full 621 ms
```
## Dev Server ## Dev Server
@ -120,9 +195,3 @@ found 0 vulnerabilities
``` ```
<br> <br>
**NodeJS**:
- `node.js`: Demo using NodeJS with CommonJS module
This is a very simple demo as althought `Human` library is compatible with NodeJS execution
and is able to load images and models from local filesystem,

@ -70,6 +70,7 @@ Style of drawing is configurable via `human.draw.options` object:
drawPolygons: true, // draw polygons such as body and face mesh drawPolygons: true, // draw polygons such as body and face mesh
fillPolygons: true, // fill polygons in face mesh fillPolygons: true, // fill polygons in face mesh
useDepth: true, // use z-axis value when available to determine color shade useDepth: true, // use z-axis value when available to determine color shade
useCurves: true, // draw polygons and boxes using smooth curves instead of lines
bufferedOutput: false, // experimental: buffer and interpolate results between frames bufferedOutput: false, // experimental: buffer and interpolate results between frames
``` ```