update backend notes

master
Vladimir Mandic 2021-07-29 09:36:28 -04:00
parent e3468326ed
commit 628f8b9e93
1 changed files with 26 additions and 11 deletions

@ -4,18 +4,38 @@ Human library includes pre-bundled `CPU`, `WASM` and `WebGL` backends, there is
<br>
## Notes
## WebGL Backend
WebGL backend usage is fastest on systems with modern GPU
although startup speed is a bit slower
## CPU Backend
CPU backend usage is not recommended for performance reasons
as TensorFlow implementation in JavaScript is by far the slowest
## WASM Backend
- 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
### Loading WASM Files
WASM backend requires access to `wasm` files which are part of `@tensorflow/tfjs-backend-wasm` package and included in
`node_modules/@tensorflow/tfjs-backend-wasm/dist/*.wasm` (different WASM file is loaded depending on detected capabilities)
Also, to be able to load WASM files your web server, web server has to set appropriate HTTP headers:
```text
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
```
Or load WASM files from a CDN such as <https://www.jsdelivr.com/package/npm/@tensorflow/tfjs-backend-wasm?path=dist>
### How to enable WASM SIMD support
Chrome:
@ -37,11 +57,6 @@ Firefox:
## 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 operations and thus neither `Face` nor `Hand` models are currently supported
See <TODO.md>
<br>