mirror of https://github.com/vladmandic/human
update backend notes
parent
e3468326ed
commit
628f8b9e93
35
Backends.md
35
Backends.md
|
@ -4,18 +4,38 @@ Human library includes pre-bundled `CPU`, `WASM` and `WebGL` backends, there is
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
## Notes
|
## WebGL Backend
|
||||||
|
|
||||||
- CPU backend usage is not recommended for performance reasons
|
WebGL backend usage is fastest on systems with modern GPU
|
||||||
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
|
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
|
||||||
|
|
||||||
- WASM backend has good resuts under specific conditions:
|
- WASM backend has good resuts under specific conditions:
|
||||||
- Enable WASM SIMD support in your browser
|
- Enable WASM SIMD support in your browser
|
||||||
(CPU parallel processing instructions)
|
(CPU parallel processing instructions)
|
||||||
- Reduce size of input image (e.g. webcam)
|
- Reduce size of input image (e.g. webcam)
|
||||||
as WASM does not have optimized image extraction methods
|
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
|
### How to enable WASM SIMD support
|
||||||
|
|
||||||
Chrome:
|
Chrome:
|
||||||
|
@ -37,11 +57,6 @@ Firefox:
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
- **WASM** backend without SIMD has limited processing capabilities before it causes issues
|
See <TODO.md>
|
||||||
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
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
Loading…
Reference in New Issue