human/types/human.d.ts

121 lines
3.8 KiB
TypeScript
Raw Normal View History

2021-03-17 23:57:00 +01:00
import * as tf from '../dist/tfjs.esm.js';
import * as facemesh from './blazeface/facemesh';
import * as age from './age/age';
import * as gender from './gender/gender';
2021-03-21 19:18:51 +01:00
import * as faceres from './faceres/faceres';
2021-03-17 23:57:00 +01:00
import * as emotion from './emotion/emotion';
import * as posenet from './posenet/posenet';
import * as handpose from './handpose/handpose';
import * as blazepose from './blazepose/blazepose';
import * as nanodet from './nanodet/nanodet';
import * as draw from './draw/draw';
import { Config } from './config';
import { Result } from './result';
2021-03-18 01:26:43 +01:00
/** Generic Tensor object type */
export declare type Tensor = typeof tf.Tensor;
2021-03-17 23:57:00 +01:00
export type { Config } from './config';
export type { Result } from './result';
/** Defines all possible input types for **Human** detection */
2021-04-06 17:38:01 +02:00
export declare type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;
2021-03-17 23:57:00 +01:00
/** Error message */
export declare type Error = {
2021-03-18 01:16:40 +01:00
error: string;
2021-03-17 23:57:00 +01:00
};
2021-03-18 01:26:43 +01:00
/** Instance of TensorFlow/JS */
2021-03-17 23:57:00 +01:00
export declare type TensorFlow = typeof tf;
2021-03-18 01:26:43 +01:00
/** Generic Model object type, holds instance of individual models */
declare type Model = Object;
2021-03-17 23:57:00 +01:00
/**
* **Human** library main class
*
* All methods and properties are available only as members of Human class
*
* - Configuration object definition: {@link Config}
* - Results object definition: {@link Result}
* - Possible inputs: {@link Input}
*/
export declare class Human {
#private;
2021-03-18 01:16:40 +01:00
version: string;
2021-03-17 23:57:00 +01:00
config: Config;
2021-03-18 01:16:40 +01:00
state: string;
2021-03-17 23:57:00 +01:00
image: {
tensor: Tensor;
canvas: OffscreenCanvas | HTMLCanvasElement;
};
tf: TensorFlow;
draw: {
drawOptions?: typeof draw.drawOptions;
gesture: typeof draw.gesture;
face: typeof draw.face;
body: typeof draw.body;
hand: typeof draw.hand;
canvas: typeof draw.canvas;
all: typeof draw.all;
};
models: {
2021-03-26 23:50:19 +01:00
face: facemesh.MediaPipeFaceMesh | Model | null;
2021-03-17 23:57:00 +01:00
posenet: posenet.PoseNet | null;
blazepose: Model | null;
2021-03-26 23:50:19 +01:00
efficientpose: Model | null;
2021-03-17 23:57:00 +01:00
handpose: handpose.HandPose | null;
iris: Model | null;
age: Model | null;
gender: Model | null;
emotion: Model | null;
embedding: Model | null;
nanodet: Model | null;
2021-03-21 19:18:51 +01:00
faceres: Model | null;
2021-03-17 23:57:00 +01:00
};
classes: {
facemesh: typeof facemesh;
age: typeof age;
gender: typeof gender;
emotion: typeof emotion;
body: typeof posenet | typeof blazepose;
hand: typeof handpose;
nanodet: typeof nanodet;
2021-03-21 19:18:51 +01:00
faceres: typeof faceres;
2021-03-17 23:57:00 +01:00
};
2021-03-29 21:59:16 +02:00
faceTriangulation: typeof facemesh.triangulation;
faceUVMap: typeof facemesh.uvmap;
2021-03-17 23:57:00 +01:00
sysinfo: {
2021-03-18 01:16:40 +01:00
platform: string;
agent: string;
2021-03-17 23:57:00 +01:00
};
2021-03-21 12:49:55 +01:00
perf: any;
2021-03-17 23:57:00 +01:00
constructor(userConfig?: Config | Object);
profileData(): {
newBytes: any;
newTensors: any;
peakBytes: any;
numKernelOps: any;
timeKernelOps: any;
slowestKernelOps: any;
largestKernelOps: any;
} | {};
2021-03-21 12:49:55 +01:00
/** @hidden */
analyze: (...msg: any[]) => void;
2021-03-21 19:18:51 +01:00
similarity(embedding1: Array<number>, embedding2: Array<number>): number;
2021-03-17 23:57:00 +01:00
enhance(input: Tensor): Tensor | null;
2021-03-18 01:16:40 +01:00
match(faceEmbedding: Array<number>, db: Array<{
name: string;
source: string;
embedding: number[];
2021-03-17 23:57:00 +01:00
}>, threshold?: number): {
2021-03-18 01:16:40 +01:00
name: string;
source: string;
2021-03-21 19:18:51 +01:00
similarity: number;
2021-03-18 01:16:40 +01:00
embedding: number[];
2021-03-17 23:57:00 +01:00
};
load(userConfig?: Config | Object): Promise<void>;
detect(input: Input, userConfig?: Config | Object): Promise<Result | Error>;
warmup(userConfig?: Config | Object): Promise<Result | {
error: any;
}>;
}
/**
* Class Human is also available as default export
*/
export { Human as default };