# Human Library ## 3D Face Detection, Body Pose, Hand & Finger Tracking, Iris Tracking, Age & Gender Prediction, Emotion Prediction & Gesture Recognition - [**Documentation**](https://github.com/vladmandic/human#readme) - [**Code Repository**](https://github.com/vladmandic/human) - [**NPM Package**](https://www.npmjs.com/package/@vladmandic/human) - [**Issues Tracker**](https://github.com/vladmandic/human/issues) - [**Change Log**](./CHANGELOG.md) - [**Live Demo**](https://vladmandic.github.io/human/demo/index.html) Compatible with *Browser*, *WebWorker* and *NodeJS* execution Compatible with *CPU*, *WebGL*, *WASM* and *WebGPU* backends (and maybe with React-Native as it doesn't use any DOM objects) *This is a pre-release project, see [issues](https://github.com/vladmandic/human/issues) for list of known limitations and planned enhancements* *Suggestions are welcome!*
## Demo Demos are included in `/demo`: **Browser**: - `index.html`: Full demo using Browser with ESM module, includes selectable backends and webworkers it loads `dist/demo-browser-index.js` which is built from sources in `demo`, starting with `demo/browser` alternatively you can load `demo/browser.js` directly *You can run browser demo either live from git pages, by serving demo folder from your web server or use included micro http2 server with source file monitoring and dynamic rebuild* ### Dev Server To start micro http2 dev server, you must provide your own SSL certificate (production or self-signed) and place them in `dev-server.js` Once SSL certificates have been provided, simply run ```shell npm run dev ``` On first start, it will install all development dependencies required to rebuild `Human` library ```log > @vladmandic/human@0.7.5 dev /home/vlado/dev/human > npm install && node --trace-warnings --unhandled-rejections=strict --trace-uncaught --no-deprecation dev-server.js audited 321 packages in 2.506s found 0 vulnerabilities 2020-11-06 16:19:09 INFO: @vladmandic/human version 0.7.5 2020-11-06 16:19:09 INFO: User: vlado Platform: linux Arch: x64 Node: v15.0.1 2020-11-06 16:19:09 STATE: HTTP2 server listening: 8000 2020-11-06 16:19:09 STATE: Monitoring: [ 'package.json', 'config.js', 'demo', 'src', [length]: 4 ] 2020-11-06 16:19:16 DATA: GET/2.0 200 text/html 4866 / ::ffff:192.168.0.200 2020-11-06 16:19:16 DATA: GET/2.0 200 text/javascript 1708910 /dist/demo-browser-index.js ::ffff:192.168.0.200 ``` *If you want to test `wasm` or `webgpu` backends, enable loading in `index.html`* **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,
## Examples **Using static images:** ![Example Using Image](assets/screenshot1.jpg) **Using webcam:** ![Example Using WebCam](assets/screenshot2.jpg)
## Installation **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* There are multiple ways to use `Human` library, pick one that suits you: ### Included - `dist/human.js`: IIFE format bundle with TFJS for Browsers - `dist/human.esm.js`: ESM format bundle with TFJS for Browsers - `dist/human.esm-nobundle.js`: ESM format bundle without TFJS for Browsers - `dist/human.node.js`: CommonJS format bundle with TFJS for NodeJS - `dist/human.node-nobundle.js`: CommonJS format bundle without TFJS for NodeJS All versions include `sourcemap` *(.map)* and build `manifest` *(.json)* While `Human` is in pre-release mode, all bundles are non-minified Defaults: ```json { "main": "dist/human.node.js", "module": "dist/human.esm.js", "browser": "dist/human.esm.js", } ``` ### 1. [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) script *Simplest way for usage within Browser* Simply download `dist/human.js`, include it in your `HTML` file & it's ready to use. ```html