From 259036e8caec5d3ccf42ec71c0c09b5b4daa1ade Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 12 Sep 2021 00:30:11 -0400 Subject: [PATCH] release candidate --- CHANGELOG.md | 3 ++- package.json | 2 +- src/config.ts | 19 +++++++++++-------- src/human.ts | 11 +++++++++-- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8046679..81cc9458 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,9 @@ ## Changelog -### **HEAD -> main** 2021/09/11 mandic00@live.com +### **HEAD -> main** 2021/09/12 mandic00@live.com +- mark all config items as optional - redefine config and result interfaces - fix usge of string enums - start using partial definitions diff --git a/package.json b/package.json index 8712b73c..0ed4e717 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vladmandic/human", - "version": "2.1.5", + "version": "2.2.0", "description": "Human: AI-powered 3D Face Detection & Rotation Tracking, Face Description & Recognition, Body Pose Tracking, 3D Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction, Gesture Recognition", "sideEffects": false, "main": "dist/human.node.js", diff --git a/src/config.ts b/src/config.ts index 0f3644c8..5dbd206e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,13 +1,6 @@ /* eslint-disable indent */ /* eslint-disable no-multi-spaces */ -/** - * Configuration interface definition for **Human** library - * - * Contains all configurable parameters - * @typedef Config - */ - export interface FaceDetectorConfig { modelPath: string, rotation: boolean, @@ -185,6 +178,12 @@ export interface GestureConfig { enabled: boolean, } +/** + * Configuration interface definition for **Human** library + * + * Contains all configurable parameters + * @typedef Config + */ export interface Config { /** Backend used for TFJS operations */ // backend: '' | 'cpu' | 'wasm' | 'webgl' | 'humangl' | 'tensorflow' | 'webgpu' | null, @@ -242,8 +241,12 @@ export interface Config { segmentation: Partial, } +/** + * [Default values](https://github.com/vladmandic/human/blob/main/src/config.ts#L244) for {@Config} + * + */ const config: Config = { - backend: 'webgl', // select tfjs backend to use, leave empty to use default backend + backend: 'humangl', // select tfjs backend to use, leave empty to use default backend // can be 'webgl', 'wasm', 'cpu', or 'humangl' which is a custom version of webgl modelBasePath: '../models/', // base path for all models wasmPath: '', // path for wasm binaries, only used for backend: wasm diff --git a/src/human.ts b/src/human.ts index 0c818e3a..25c8bcbd 100644 --- a/src/human.ts +++ b/src/human.ts @@ -32,7 +32,6 @@ import { Tensor, GraphModel } from './tfjs/types'; // export types export * from './config'; export * from './result'; - export type { DrawOptions } from './draw/draw'; /** Defines all possible input types for **Human** detection @@ -40,6 +39,15 @@ export type { DrawOptions } from './draw/draw'; */ export type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas; +/** Events dispatched by `human.events` + * - `create`: triggered when Human object is instantiated + * - `load`: triggered when models are loaded (explicitly or on-demand) + * - `image`: triggered when input image is this.processed + * - `result`: triggered when detection is complete + * - `warmup`: triggered when warmup is complete + */ +export type Events = 'create' | 'load' | 'image' | 'result' | 'warmup'; + /** Error message * @typedef Error Type */ @@ -128,7 +136,6 @@ export class Human { * - `result`: triggered when detection is complete * - `warmup`: triggered when warmup is complete */ - events: EventTarget; /** Reference face triangualtion array of 468 points, used for triangle references between points */ faceTriangulation: typeof facemesh.triangulation;