-
-
Notifications
You must be signed in to change notification settings - Fork 329
Usage
Human
library does not require special initialization
All configuration is done in a single JSON object and all model weights are dynamically loaded upon their first usage
(and only then, Human
will not load weights that it doesn't need according to configuration).
There is only ONE method you need:
const human = new Human(config?) // create instance of human
const result = await human.detect(input, config?) // run single detection
or
const human = new Human(config?) // create instance of human
await human.video(input, config?) // run detection loop on input video
// last known results are available in human.results
Notes:
Standard workflow:
- Select best detected engine
- Use default configuration
- Load & compile required models
- Perform warmup operations
- Preprocess input
- Perform detection
Methods exported by Human
library:
human.detect(input, config?); // run processing on single image/frame
human.video(input, config?); // run processing continously on video
human.next(result?); // returns time-variant smoothened/interpolated result based on last known result
Methods used for face recognition and face matching:
For details, see embedding documentation
human.match.similarity(descriptor1, descriptor2); // runs similarity calculation between two provided embedding vectors
// vectors for source and target must be previously detected using
// face.description module
human.match.find(descriptor, descriptors); // finds best match for current face in a provided list of faces
Methods used for body segmentation, background removal or background replacement
For details, see segmentation documentation
human.segmentation(input, config?) // runs body segmentation and returns processed image tensor
// which can be foreground-only, alpha-only or blended image
Additiona helper namespaces that can be used to reduce amount of manual code that needs to be written, but do not have to be used
For details, see:
human.webcam.* // helper methods to control webcam, main properties are `start`, `stop`, `play`, `pause`
human.draw.* // helper methods to draw detected results to canvas, main options are `options`, `canvas`, `all`
Methods that are typically called as part of standard workflow and do not need to be called manually
human.validate(config?); // validate human configuration
human.init(config?); // initialize human and processing backend
human.load(config?); // load configured models
human.warmup(config?); // warms up human library for faster initial execution after loading
human.image(input); // process input without detection and returns canvas or tensor
human.models.* // namespace that serves current library ml models
// main options are `load`, `list`, `loaded`, `reset`, `stats`, `validate`
Utility methods that are typically not directly used except in advanced or troubleshooting cases
human.analyze(); // check for memory leaks
human.compare(); // compare two images for pixel similarity
human.now(); // utility wrapper for performance timestamp
human.profile(); // run function via profiler
human.reset(); // reset configuration
human.sleep(); // utility wrapper for sleep function
human.emit(); // internal event emitter
Human
library exposes several dynamically generated properties:
human.version; // string containing version of human library
human.config; // access to current configuration object
// normally set during call to constructor or as parameter to detect()
human.result; // access to last known result object, normally returned via call to detect()
human.performance; // access to current performance counters
human.state; // <string> describing current operation in progress
// progresses through: 'config', 'check', 'backend', 'load', 'run:<model>', 'idle'
human.models; // dynamically maintained list of loaded models
human.env; // detected platform environment and capabilities
human.events; // container for events dispateched by human
Human.defaults; // static property of Human class that contains default configuration
Human
internally uses TensorFlow/JS
for all ML processing
Access to namespace of an interal instance of tfjs
used by human
is possible via:
human.tf; // instance of tfjs used by human, can be embedded or externally loaded
- By default,
Human
uses frame change detection for results caching - For on-screen display best results, it is recommended to use results smoothing
For details, see <https://github.com/vladmandic/human/wiki/Caching
Human
library comes with number of browser-based and nodejs-based demo apps in /demo
folder
For details, see https://github.com/vladmandic/human/wiki/Demos
Human Library Wiki Pages
3D Face Detection, Body Pose, Hand & Finger Tracking, Iris Tracking, Age & Gender Prediction, Emotion Prediction & Gesture Recognition