add notes on backends

master
Vladimir Mandic 2020-11-09 20:13:15 -05:00
parent 17d21d1995
commit 6674208a10
5 changed files with 64 additions and 18 deletions

45
Backends.md Normal file

@ -0,0 +1,45 @@
## Backends
Human library includes pre-bundled `CPU`, `WASM` and `WebGL` backends, there is no need to load them externally.
<br>
### Notes:
- CPU backend usage is not recommended for performance reasons
as TensorFlow implementation in JavaScript is by far the slowest
- WebGL backend usage is fastest on systems with modern GPU
although startup speed is a bit slower
- WASM backend has good resuts under specific conditions:
- Enable WASM SIMD support in your browser
(CPU parallel processing instructions)
- Reduce size of input image (e.g. webcam)
as WASM does not have optimized image extraction methods
#### How to enable WASM SIMD support
Chrome:
- Navigate to <chrome://flags>
- `WebAssembly SIMD support` set to Enabled
Edge:
- Navigate to <chrome://flags>
- `WebAssembly SIMD support` set to Enabled
Firefox:
- Navigate to <about:config>
- `javascript.options.wasm_simd` set to True
<br>
### Known Issues:
- **WASM** backend without SIMD has limited processing capabilities before it causes issues
To avoid issues, start `human` with most models disabled and if needed, enable them one by one as each initializes
Typical errors messages are:
`Uncaught (in promise) Error: undefined tfjs-backend-wasm.wasm` or
`RuntimeError: memory access out of bounds in tfjs-backend-wasm.wasm`
- **NodeJS** backend is missing key operatios and thus neither `Face` nor `Hand` models are currently supported
<br>

@ -1,7 +1,7 @@
# @vladmandic/human
Version: **0.8.3**
Version: **0.8.5**
Description: **human: 3D Face Detection, Body Pose, Hand & Finger Tracking, Iris Tracking, Age & Gender Prediction, Emotion Prediction & Gesture Recognition**
Author: **Vladimir Mandic <mandic00@live.com>**
@ -10,7 +10,12 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
## Changelog
### **HEAD -> main, origin/main, origin/HEAD** 2020/11/09 mandic00@live.com
### **0.8.5** 2020/11/09 mandic00@live.com
- reimplemented blazeface processing
### **0.8.4** 2020/11/09 mandic00@live.com
- added additional gestures
- implemented blink detection
- fix wasm module
### **0.8.3** 2020/11/08 mandic00@live.com

@ -63,19 +63,6 @@ found 0 vulnerabilities
2020-11-06 16:19:16 DATA: GET/2.0 200 text/javascript 1708910 /dist/demo-browser-index.js ::ffff:192.168.0.200
```
### WASM and WebGPU
While `CPU` and `WebGL` backends are included in the bundle, `WASM` and `WebGPU` are not to keep the size at minimum
If you want to use `WASM` (supported) or `WebGPU` (experimental) backends
enable loading of required modules in `index.html`:
```html
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.7.0/dist/tf.es2017.js">
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@2.7.0/dist/tf-backend-wasm.es2017.js">
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgpu@0.0.1-alpha.0/dist/tf-webgpu.js">
```
<br>
**NodeJS**:

@ -16,12 +16,13 @@
### Wiki pages:
- [**Home**](https://github.com/vladmandic/human/wiki)
- [**Demos**](https://github.com/vladmandic/human/wiki/Demos)
- [**Installation**](https://github.com/vladmandic/human/wiki/Install)
- [**Usage**](https://github.com/vladmandic/human/wiki/Usage)
- [**Usage**](https://github.com/vladmandic/human/wiki/Backends)
- [**Configuration**](https://github.com/vladmandic/human/wiki/Configuration)
- [**Outputs**](https://github.com/vladmandic/human/wiki/Outputs)
- [**Gesture Recognition**](https://github.com/vladmandic/human/wiki/Gesture)
- [**Demos**](https://github.com/vladmandic/human/wiki/Demos)
- [**Development Server**](https://github.com/vladmandic/human/wiki/Development-Server)
- [**Build Process**](https://github.com/vladmandic/human/wiki/Build-Process)
- [**Profiling**](https://github.com/vladmandic/human/wiki/Profiling)

@ -1,8 +1,15 @@
## Installation
<br>
**Important**
*The packaged (IIFE and ESM) version of `Human` includes `TensorFlow/JS (TFJS) 2.7.0` library which can be accessed via `human.tf`*
*You should NOT manually load another instance of `tfjs`, but if you do, be aware of possible version conflicts*
*The packaged version of `Human` includes `TensorFlow/JS (TFJS) 2.7.0` library which can be accessed via `human.tf`*
*You should NOT manually load another instance of `tfjs` unless you're using specific `.nobudle` edition of `Human,
but if you do, be aware of possible version conflicts*
<br>
There are multiple ways to use `Human` library, pick one that suits you:
@ -25,6 +32,7 @@ Defaults:
"browser": "dist/human.esm.js",
}
```
<br>
### 1. [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) script