mirror of https://github.com/vladmandic/human
breaking change: new similarity and match methods
parent
14225c89f9
commit
50706480c4
|
@ -9,13 +9,12 @@
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2021/09/28 mandic00@live.com
|
||||
### **HEAD -> main** 2021/09/29 mandic00@live.com
|
||||
|
||||
- release candidate
|
||||
- tweaked default values
|
||||
- enable handtrack as default model
|
||||
- redesign face processing
|
||||
|
||||
### **origin/main** 2021/09/27 mandic00@live.com
|
||||
|
||||
- refactoring
|
||||
- define app specific types
|
||||
- implement box caching for movenet
|
||||
|
|
|
@ -75,11 +75,12 @@ async function SelectFaceCanvas(face) {
|
|||
ctx.font = 'small-caps 0.4rem "Lato"';
|
||||
ctx.fillStyle = 'rgba(255, 255, 255, 1)';
|
||||
}
|
||||
const person = await human.match(face.embedding, db);
|
||||
log('Match:', person);
|
||||
const arr = db.map((rec) => rec.embedding);
|
||||
const res = await human.match(face.embedding, arr);
|
||||
log('Match:', db[res.index].name);
|
||||
document.getElementById('desc').innerHTML = `
|
||||
${face.fileName}<br>
|
||||
Match: ${Math.round(1000 * person.similarity) / 10}% ${person.name}
|
||||
Match: ${Math.round(1000 * res.similarity) / 10}% ${db[res.index].name}
|
||||
`;
|
||||
embedding = face.embedding.map((a) => parseFloat(a.toFixed(4)));
|
||||
navigator.clipboard.writeText(`{"name":"unknown", "source":"${face.fileName}", "embedding":[${embedding}]},`);
|
||||
|
@ -91,7 +92,7 @@ async function SelectFaceCanvas(face) {
|
|||
for (const canvas of canvases) {
|
||||
// calculate similarity from selected face to current one in the loop
|
||||
const current = all[canvas.tag.sample][canvas.tag.face];
|
||||
const similarity = human.similarity(face.embedding, current.embedding, 3);
|
||||
const similarity = human.similarity(face.embedding, current.embedding);
|
||||
// get best match
|
||||
// draw the canvas
|
||||
canvas.title = similarity;
|
||||
|
@ -107,9 +108,10 @@ async function SelectFaceCanvas(face) {
|
|||
// identify person
|
||||
ctx.font = 'small-caps 1rem "Lato"';
|
||||
const start = performance.now();
|
||||
const person = await human.match(current.embedding, db);
|
||||
const arr = db.map((rec) => rec.embedding);
|
||||
const res = await human.match(face.embedding, arr);
|
||||
time += (performance.now() - start);
|
||||
if (person.similarity && person.similarity > minScore) ctx.fillText(`DB: ${(100 * person.similarity).toFixed(1)}% ${person.name}`, 4, canvas.height - 30);
|
||||
if (res.similarity > minScore) ctx.fillText(`DB: ${(100 * res.similarity).toFixed(1)}% ${db[res.index].name}`, 4, canvas.height - 30);
|
||||
}
|
||||
|
||||
log('Analyzed:', 'Face:', canvases.length, 'DB:', db.length, 'Time:', time);
|
||||
|
@ -145,9 +147,10 @@ async function AddFaceCanvas(index, res, fileName) {
|
|||
ctx.font = 'small-caps 0.8rem "Lato"';
|
||||
ctx.fillStyle = 'rgba(255, 255, 255, 1)';
|
||||
ctx.fillText(`${res.face[i].age}y ${(100 * (res.face[i].genderScore || 0)).toFixed(1)}% ${res.face[i].gender}`, 4, canvas.height - 6);
|
||||
const person = await human.match(res.face[i].embedding, db);
|
||||
const arr = db.map((rec) => rec.embedding);
|
||||
const result = await human.match(res.face[i].embedding, arr);
|
||||
ctx.font = 'small-caps 1rem "Lato"';
|
||||
if (person.similarity && person.similarity > minScore) ctx.fillText(`${(100 * person.similarity).toFixed(1)}% ${person.name}`, 4, canvas.height - 30);
|
||||
if (result.similarity && res.similarity > minScore) ctx.fillText(`${(100 * result.similarity).toFixed(1)}% ${db[result.index].name}`, 4, canvas.height - 30);
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
|
@ -212,7 +215,7 @@ async function main() {
|
|||
images = images.map((a) => `/human/samples/in/${a}`);
|
||||
log('Adding static image list:', images);
|
||||
} else {
|
||||
log('Disoovered images:', images);
|
||||
log('Discovered images:', images);
|
||||
}
|
||||
|
||||
// download and analyze all images
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -11,7 +11,6 @@ import * as tf from '../../dist/tfjs.esm.js';
|
|||
import type { Tensor, GraphModel } from '../tfjs/types';
|
||||
import { env } from '../util/env';
|
||||
|
||||
type DB = Array<{ name: string, source: string, embedding: number[] }>;
|
||||
let model: GraphModel | null;
|
||||
|
||||
export async function load(config) {
|
||||
|
@ -25,31 +24,6 @@ export async function load(config) {
|
|||
return model;
|
||||
}
|
||||
|
||||
export function similarity(embedding1, embedding2, order = 2): number {
|
||||
if (!embedding1 || !embedding2) return 0;
|
||||
if (embedding1?.length === 0 || embedding2?.length === 0) return 0;
|
||||
if (embedding1?.length !== embedding2?.length) return 0;
|
||||
// general minkowski distance, euclidean distance is limited case where order is 2
|
||||
const distance = embedding1
|
||||
.map((_val, i) => (Math.abs(embedding1[i] - embedding2[i]) ** order)) // distance squared
|
||||
.reduce((sum, now) => (sum + now), 0) // sum all distances into total
|
||||
** (1 / order); // get root of total distances
|
||||
const res = Math.max(Math.trunc(1000 * (1 - distance)) / 1000, 0);
|
||||
return res;
|
||||
}
|
||||
|
||||
export function match(embedding: Array<number>, db: DB, threshold = 0) {
|
||||
let best = { similarity: 0, name: '', source: '', embedding: [] as number[] };
|
||||
if (!embedding || !db || !Array.isArray(embedding) || !Array.isArray(db)) return best;
|
||||
for (const f of db) {
|
||||
if (f.embedding && f.name) {
|
||||
const perc = similarity(embedding, f.embedding);
|
||||
if (perc > threshold && perc > best.similarity) best = { ...f, similarity: perc };
|
||||
}
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
export function enhance(input): Tensor {
|
||||
const image = tf.tidy(() => {
|
||||
// input received from detector is already normalized to 0..1
|
||||
|
|
|
@ -24,8 +24,6 @@ const last: Array<{
|
|||
let lastCount = 0;
|
||||
let skipped = Number.MAX_SAFE_INTEGER;
|
||||
|
||||
type DB = Array<{ name: string, source: string, embedding: number[] }>;
|
||||
|
||||
export async function load(config: Config): Promise<GraphModel> {
|
||||
const modelUrl = join(config.modelBasePath, config.face.description?.modelPath || '');
|
||||
if (env.initial) model = null;
|
||||
|
@ -37,31 +35,6 @@ export async function load(config: Config): Promise<GraphModel> {
|
|||
return model;
|
||||
}
|
||||
|
||||
export function similarity(embedding1: Array<number>, embedding2: Array<number>, order = 2): number {
|
||||
if (!embedding1 || !embedding2) return 0;
|
||||
if (embedding1?.length === 0 || embedding2?.length === 0) return 0;
|
||||
if (embedding1?.length !== embedding2?.length) return 0;
|
||||
// general minkowski distance, euclidean distance is limited case where order is 2
|
||||
const distance = 5.0 * embedding1
|
||||
.map((_val, i) => (Math.abs(embedding1[i] - embedding2[i]) ** order)) // distance squared
|
||||
.reduce((sum, now) => (sum + now), 0) // sum all distances
|
||||
** (1 / order); // get root of
|
||||
const res = Math.max(0, 100 - distance) / 100.0;
|
||||
return res;
|
||||
}
|
||||
|
||||
export function match(embedding: Array<number>, db: DB, threshold = 0) {
|
||||
let best = { similarity: 0, name: '', source: '', embedding: [] as number[] };
|
||||
if (!embedding || !db || !Array.isArray(embedding) || !Array.isArray(db)) return best;
|
||||
for (const f of db) {
|
||||
if (f.embedding && f.name) {
|
||||
const perc = similarity(embedding, f.embedding);
|
||||
if (perc > threshold && perc > best.similarity) best = { ...f, similarity: perc };
|
||||
}
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
export function enhance(input): Tensor {
|
||||
const image = tf.tidy(() => {
|
||||
// input received from detector is already normalized to 0..1
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/** Defines Descriptor type */
|
||||
export type Descriptor = Array<number>
|
||||
|
||||
/** Calculates distance between two descriptors
|
||||
* - Minkowski distance algorithm of nth order if `order` is different than 2
|
||||
* - Euclidean distance if `order` is 2 (default)
|
||||
*
|
||||
* Options:
|
||||
* - `order`
|
||||
*
|
||||
* Note: No checks are performed for performance reasons so make sure to pass valid number arrays of equal length
|
||||
*/
|
||||
export function distance(descriptor1: Descriptor, descriptor2: Descriptor, options = { order: 2 }) {
|
||||
// general minkowski distance, euclidean distance is limited case where order is 2
|
||||
let sum = 0;
|
||||
for (let i = 0; i < descriptor1.length; i++) {
|
||||
const diff = (options.order === 2) ? (descriptor1[i] - descriptor2[i]) : (Math.abs(descriptor1[i] - descriptor2[i]));
|
||||
sum += (options.order === 2) ? (diff * diff) : (diff ** options.order);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
/** Calculates normalized similarity between two descriptors based on their `distance`
|
||||
*/
|
||||
export function similarity(descriptor1: Descriptor, descriptor2: Descriptor, options = { order: 2 }) {
|
||||
const dist = distance(descriptor1, descriptor2, options);
|
||||
const invert = (options.order === 2) ? Math.sqrt(dist) : dist ** (1 / options.order);
|
||||
return Math.max(0, 100 - invert) / 100.0;
|
||||
}
|
||||
|
||||
/** Matches given descriptor to a closest entry in array of descriptors
|
||||
* @param descriptor face descriptor
|
||||
* @param descriptors array of face descriptors to commpare given descriptor to
|
||||
*
|
||||
* Options:
|
||||
* - `order` see {@link distance} method
|
||||
* - `threshold` match will return result first result for which {@link distance} is below `threshold` even if there may be better results
|
||||
*
|
||||
* @returns object with index, distance and similarity
|
||||
* - `index` index array index where best match was found or -1 if no matches
|
||||
* - {@link distance} calculated `distance` of given descriptor to the best match
|
||||
* - {@link similarity} calculated normalized `similarity` of given descriptor to the best match
|
||||
*/
|
||||
export function match(descriptor: Descriptor, descriptors: Array<Descriptor>, options = { order: 2, threshold: 0 }) {
|
||||
if (!Array.isArray(descriptor) || !Array.isArray(descriptors) || descriptor.length < 64 || descriptors.length === 0 || descriptor.length !== descriptors[0].length) { // validate input
|
||||
return { index: -1, distance: Number.POSITIVE_INFINITY, similarity: 0 };
|
||||
}
|
||||
let best = Number.MAX_SAFE_INTEGER;
|
||||
let index = -1;
|
||||
for (let i = 0; i < descriptors.length; i++) {
|
||||
const res = distance(descriptor, descriptors[i], { order: options.order });
|
||||
if (res < best) {
|
||||
best = res;
|
||||
index = i;
|
||||
}
|
||||
if (best < options.threshold) break;
|
||||
}
|
||||
best = (options.order === 2) ? Math.sqrt(best) : best ** (1 / options.order);
|
||||
return { index, distance: best, similarity: Math.max(0, 100 - best) / 100.0 };
|
||||
}
|
109
src/human.ts
109
src/human.ts
|
@ -2,49 +2,64 @@
|
|||
* Human main module
|
||||
*/
|
||||
|
||||
// module imports
|
||||
import { log, now, mergeDeep, validate } from './util/util';
|
||||
import { Config, defaults } from './config';
|
||||
import type { Result, FaceResult, HandResult, BodyResult, ObjectResult, GestureResult, PersonResult } from './result';
|
||||
import { defaults } from './config';
|
||||
import * as tf from '../dist/tfjs.esm.js';
|
||||
import * as models from './models';
|
||||
import * as app from '../package.json';
|
||||
import * as backend from './tfjs/backend';
|
||||
// import * as blazepose from './body/blazepose-v1';
|
||||
import * as blazepose from './body/blazepose';
|
||||
import * as centernet from './object/centernet';
|
||||
import * as draw from './util/draw';
|
||||
import * as efficientpose from './body/efficientpose';
|
||||
import * as env from './util/env';
|
||||
import * as face from './face/face';
|
||||
import * as facemesh from './face/facemesh';
|
||||
import * as faceres from './face/faceres';
|
||||
import * as posenet from './body/posenet';
|
||||
import * as handtrack from './hand/handtrack';
|
||||
import * as gesture from './gesture/gesture';
|
||||
import * as handpose from './handpose/handpose';
|
||||
// import * as blazepose from './body/blazepose-v1';
|
||||
import * as blazepose from './body/blazepose';
|
||||
import * as efficientpose from './body/efficientpose';
|
||||
import * as handtrack from './hand/handtrack';
|
||||
import * as humangl from './tfjs/humangl';
|
||||
import * as image from './image/image';
|
||||
import * as interpolate from './util/interpolate';
|
||||
import * as match from './face/match';
|
||||
import * as models from './models';
|
||||
import * as movenet from './body/movenet';
|
||||
import * as nanodet from './object/nanodet';
|
||||
import * as centernet from './object/centernet';
|
||||
import * as segmentation from './segmentation/segmentation';
|
||||
import * as gesture from './gesture/gesture';
|
||||
import * as image from './image/image';
|
||||
import * as draw from './util/draw';
|
||||
import * as persons from './util/persons';
|
||||
import * as interpolate from './util/interpolate';
|
||||
import * as env from './util/env';
|
||||
import * as backend from './tfjs/backend';
|
||||
import * as humangl from './tfjs/humangl';
|
||||
import * as app from '../package.json';
|
||||
import * as posenet from './body/posenet';
|
||||
import * as segmentation from './segmentation/segmentation';
|
||||
import * as warmups from './warmup';
|
||||
|
||||
// type definitions
|
||||
import type { Result, FaceResult, HandResult, BodyResult, ObjectResult, GestureResult, PersonResult } from './result';
|
||||
import type { Tensor } from './tfjs/types';
|
||||
import type { DrawOptions } from './util/draw';
|
||||
import type { Input } from './image/image';
|
||||
import type { Config } from './config';
|
||||
|
||||
// export types
|
||||
/** Defines configuration options used by all **Human** methods */
|
||||
export * from './config';
|
||||
|
||||
/** Defines result types returned by all **Human** methods */
|
||||
export * from './result';
|
||||
|
||||
/** Defines DrawOptions used by `human.draw.*` methods */
|
||||
export type { DrawOptions } from './util/draw';
|
||||
export { env, Env } from './util/env';
|
||||
|
||||
/** Face descriptor type as number array */
|
||||
export type { Descriptor } from './face/match';
|
||||
|
||||
/** Box and Point primitives */
|
||||
export { Box, Point } from './result';
|
||||
|
||||
/** Defines all possible models used by **Human** library */
|
||||
export { Models } from './models';
|
||||
|
||||
/** Defines all possible input types for **Human** detection
|
||||
* @typedef Input Type
|
||||
*/
|
||||
export type Input = Tensor | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;
|
||||
/** Defines all possible input types for **Human** detection */
|
||||
export { Input } from './image/image';
|
||||
|
||||
/** Events dispatched by `human.events`
|
||||
*
|
||||
|
@ -139,7 +154,7 @@ export class Human {
|
|||
* - `warmup`: triggered when warmup is complete
|
||||
* - `error`: triggered on some errors
|
||||
*/
|
||||
events: EventTarget;
|
||||
events: EventTarget | undefined;
|
||||
/** Reference face triangualtion array of 468 points, used for triangle references between points */
|
||||
faceTriangulation: typeof facemesh.triangulation;
|
||||
/** Refernce UV map of 468 values, used for 3D mapping of the face mesh */
|
||||
|
@ -176,7 +191,7 @@ export class Human {
|
|||
this.#analyzeMemoryLeaks = false;
|
||||
this.#checkSanity = false;
|
||||
this.performance = { backend: 0, load: 0, image: 0, frames: 0, cached: 0, changed: 0, total: 0, draw: 0 };
|
||||
this.events = new EventTarget();
|
||||
this.events = (typeof EventTarget !== 'undefined') ? new EventTarget() : undefined;
|
||||
// object that contains all initialized models
|
||||
this.models = new models.Models();
|
||||
// reexport draw methods
|
||||
|
@ -230,17 +245,22 @@ export class Human {
|
|||
}
|
||||
|
||||
/** Reset configuration to default values */
|
||||
reset() {
|
||||
reset(): void {
|
||||
const currentBackend = this.config.backend; // save backend;
|
||||
this.config = JSON.parse(JSON.stringify(defaults));
|
||||
this.config.backend = currentBackend;
|
||||
}
|
||||
|
||||
/** Validate current configuration schema */
|
||||
validate(userConfig?: Partial<Config>) {
|
||||
public validate(userConfig?: Partial<Config>) {
|
||||
return validate(defaults, userConfig || this.config);
|
||||
}
|
||||
|
||||
/** Exports face matching methods */
|
||||
public similarity = match.similarity;
|
||||
public distance = match.distance;
|
||||
public match = match.match;
|
||||
|
||||
/** Process input as return canvas and tensor
|
||||
*
|
||||
* @param input: {@link Input}
|
||||
|
@ -250,19 +270,6 @@ export class Human {
|
|||
return image.process(input, this.config);
|
||||
}
|
||||
|
||||
/** Simmilarity method calculates simmilarity between two provided face descriptors (face embeddings)
|
||||
* - Calculation is based on normalized Minkowski distance between two descriptors
|
||||
* - Default is Euclidean distance which is Minkowski distance of 2nd order
|
||||
*
|
||||
* @param embedding1: face descriptor as array of numbers
|
||||
* @param embedding2: face descriptor as array of numbers
|
||||
* @returns similarity: number
|
||||
*/
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
similarity(embedding1: Array<number>, embedding2: Array<number>): number {
|
||||
return faceres.similarity(embedding1, embedding2);
|
||||
}
|
||||
|
||||
/** Segmentation method takes any input and returns processed canvas with body segmentation
|
||||
* - Optional parameter background is used to fill the background with specific input
|
||||
* - Segmentation is not triggered as part of detect process
|
||||
|
@ -290,18 +297,6 @@ export class Human {
|
|||
return faceres.enhance(input);
|
||||
}
|
||||
|
||||
/** Math method find best match between provided face descriptor and predefined database of known descriptors
|
||||
*
|
||||
* @param faceEmbedding: face descriptor previsouly calculated on any face
|
||||
* @param db: array of mapping of face descriptors to known values
|
||||
* @param threshold: minimum score for matching to be considered in the result
|
||||
* @returns best match
|
||||
*/
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
match(faceEmbedding: Array<number>, db: Array<{ name: string, source: string, embedding: number[] }>, threshold = 0): { name: string, source: string, similarity: number, embedding: number[] } {
|
||||
return faceres.match(faceEmbedding, db, threshold);
|
||||
}
|
||||
|
||||
/** Explicit backend initialization
|
||||
* - Normally done implicitly during initial load phase
|
||||
* - Call to explictly register and initialize TFJS backend without any other operations
|
||||
|
@ -309,7 +304,7 @@ export class Human {
|
|||
*
|
||||
* @return Promise<void>
|
||||
*/
|
||||
async init() {
|
||||
async init(): Promise<void> {
|
||||
await backend.check(this, true);
|
||||
await this.tf.ready();
|
||||
env.set(this.env);
|
||||
|
@ -321,7 +316,7 @@ export class Human {
|
|||
* @param userConfig?: {@link Config}
|
||||
* @return Promise<void>
|
||||
*/
|
||||
async load(userConfig?: Partial<Config>) {
|
||||
async load(userConfig?: Partial<Config>): Promise<void> {
|
||||
this.state = 'load';
|
||||
const timeStamp = now();
|
||||
const count = Object.values(this.models).filter((model) => model).length;
|
||||
|
@ -354,7 +349,9 @@ export class Human {
|
|||
|
||||
// emit event
|
||||
/** @hidden */
|
||||
emit = (event: string) => this.events?.dispatchEvent(new Event(event));
|
||||
emit = (event: string) => {
|
||||
if (this.events && this.events.dispatchEvent) this.events?.dispatchEvent(new Event(event));
|
||||
}
|
||||
|
||||
/** Runs interpolation using last known result and returns smoothened result
|
||||
* Interpolation is based on time since last known result so can be called independently
|
||||
|
@ -362,7 +359,7 @@ export class Human {
|
|||
* @param result?: {@link Result} optional use specific result set to run interpolation on
|
||||
* @returns result: {@link Result}
|
||||
*/
|
||||
next(result: Result = this.result) {
|
||||
next(result: Result = this.result): Result {
|
||||
return interpolate.calc(result) as Result;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import type { Config } from '../config';
|
|||
import { env } from '../util/env';
|
||||
import { log } from '../util/util';
|
||||
|
||||
type Input = Tensor | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | typeof Image | typeof env.Canvas;
|
||||
export type Input = Tensor | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | typeof Image | typeof env.Canvas;
|
||||
|
||||
const maxSize = 2048;
|
||||
// internal temp canvases
|
||||
|
|
|
@ -51,13 +51,13 @@ export class Models {
|
|||
segmentation: null | GraphModel | Promise<GraphModel> = null;
|
||||
}
|
||||
|
||||
export function reset(instance: Human) {
|
||||
export function reset(instance: Human): void {
|
||||
// if (instance.config.debug) log('resetting loaded models');
|
||||
for (const model of Object.keys(instance.models)) instance.models[model] = null;
|
||||
}
|
||||
|
||||
/** Load method preloads all instance.configured models on-demand */
|
||||
export async function load(instance: Human) {
|
||||
export async function load(instance: Human): Promise<void> {
|
||||
if (env.initial) reset(instance);
|
||||
if (instance.config.hand.enabled) { // handpose model is a combo that must be loaded as a whole
|
||||
if (!instance.models.handpose && instance.config.hand.detector?.modelPath?.includes('handdetect')) [instance.models.handpose, instance.models.handskeleton] = await handpose.load(instance.config);
|
||||
|
@ -87,7 +87,7 @@ export async function load(instance: Human) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function validate(instance) {
|
||||
export async function validate(instance: Human): Promise<void> {
|
||||
interface Op { name: string, category: string, op: string }
|
||||
const simpleOps = ['const', 'placeholder', 'noop', 'pad', 'squeeze', 'add', 'sub', 'mul', 'div'];
|
||||
for (const defined of Object.keys(instance.models)) {
|
||||
|
|
|
@ -12,8 +12,7 @@ import * as image from '../image/image';
|
|||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../util/env';
|
||||
|
||||
type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;
|
||||
import type { Input } from '../image/image';
|
||||
|
||||
let model: GraphModel;
|
||||
let busy = false;
|
||||
|
|
4792
test/build.log
4792
test/build.log
File diff suppressed because it is too large
Load Diff
|
@ -237,25 +237,23 @@ async function test(Human, inputConfig) {
|
|||
const desc3 = res3 && res3.face && res3.face[0] && res3.face[0].embedding ? [...res3.face[0].embedding] : null;
|
||||
if (!desc1 || !desc2 || !desc3 || desc1.length !== 1024 || desc2.length !== 1024 || desc3.length !== 1024) log('error', 'failed: face descriptor', desc1?.length, desc2?.length, desc3?.length);
|
||||
else log('state', 'passed: face descriptor');
|
||||
res1 = Math.round(10 * human.similarity(desc1, desc2));
|
||||
res2 = Math.round(10 * human.similarity(desc1, desc3));
|
||||
res3 = Math.round(10 * human.similarity(desc2, desc3));
|
||||
if (res1 !== 5 || res2 !== 5 || res3 !== 5) log('error', 'failed: face similarity ', res1, res2, res3);
|
||||
else log('state', 'passed: face similarity');
|
||||
res1 = human.similarity(desc1, desc1);
|
||||
res2 = human.similarity(desc1, desc2);
|
||||
res3 = human.similarity(desc1, desc3);
|
||||
if (res1 < 1 || res2 < 0.9 || res3 < 0.85) log('error', 'failed: face similarity ', { similarity: [res1, res2, res3], descriptors: [desc1?.length, desc2?.length, desc3?.length] });
|
||||
else log('state', 'passed: face similarity', { similarity: [res1, res2, res3], descriptors: [desc1?.length, desc2?.length, desc3?.length] });
|
||||
|
||||
// test face matching
|
||||
log('info', 'test face matching');
|
||||
let db = [];
|
||||
try {
|
||||
db = JSON.parse(fs.readFileSync('demo/facematch/faces.json').toString());
|
||||
} catch { /***/ }
|
||||
if (db.length < 100) log('error', 'failed: face database ', db.length);
|
||||
const db = JSON.parse(fs.readFileSync('demo/facematch/faces.json').toString());
|
||||
const arr = db.map((rec) => rec.embedding);
|
||||
if (db.length < 20) log('error', 'failed: face database ', db.length);
|
||||
else log('state', 'passed: face database', db.length);
|
||||
res1 = human.match(desc1, db);
|
||||
res2 = human.match(desc2, db);
|
||||
res3 = human.match(desc3, db);
|
||||
if (!res1 || !res1['name'] || !res2 || !res2['name'] || !res3 || !res3['name']) log('error', 'failed: face match ', res1, res2, res3);
|
||||
else log('state', 'passed: face match', { first: { name: res1.name, similarity: res1.similarity } }, { second: { name: res2.name, similarity: res2.similarity } }, { third: { name: res3.name, similarity: res3.similarity } });
|
||||
res1 = human.match(desc1, arr);
|
||||
res2 = human.match(desc2, arr);
|
||||
res3 = human.match(desc3, arr);
|
||||
if (res1.index !== 4 || res2.index !== 4 || res3.index !== 4) log('error', 'failed: face match ', res1, res2, res3);
|
||||
else log('state', 'passed: face match', { first: { index: res1.index, similarity: res1.similarity } }, { second: { index: res2.index, similarity: res2.similarity } }, { third: { index: res3.index, similarity: res3.similarity } });
|
||||
|
||||
// test object detection
|
||||
log('info', 'test object');
|
||||
|
|
1207
test/test.log
1207
test/test.log
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -8,16 +8,27 @@
|
|||
</ul>
|
||||
</div><dl class="tsd-comment-tags"><dt>param userConfig:</dt><dd><p><a href="../interfaces/Config.html">Config</a></p>
|
||||
</dd><dt>returns</dt><dd><p>instance</p>
|
||||
</dd></dl></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Human</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Human.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#config" class="tsd-kind-icon">config</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#draw" class="tsd-kind-icon">draw</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#env" class="tsd-kind-icon">env</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#events" class="tsd-kind-icon">events</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceTriangulation" class="tsd-kind-icon">face<wbr/>Triangulation</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceUVMap" class="tsd-kind-icon">faceUVMap</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#gl" class="tsd-kind-icon">gl</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#performance" class="tsd-kind-icon">performance</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#process" class="tsd-kind-icon">process</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#result" class="tsd-kind-icon">result</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#state" class="tsd-kind-icon">state</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#version" class="tsd-kind-icon">version</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#detect" class="tsd-kind-icon">detect</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#enhance" class="tsd-kind-icon">enhance</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#image" class="tsd-kind-icon">image</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#init" class="tsd-kind-icon">init</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#load" class="tsd-kind-icon">load</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#match" class="tsd-kind-icon">match</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#next" class="tsd-kind-icon">next</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#reset" class="tsd-kind-icon">reset</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#segmentation" class="tsd-kind-icon">segmentation</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#similarity" class="tsd-kind-icon">similarity</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#validate" class="tsd-kind-icon">validate</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#warmup" class="tsd-kind-icon">warmup</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"><a name="constructor" class="tsd-anchor"></a><h3>constructor</h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">new <wbr/>Human<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Human.html" class="tsd-signature-type" data-tsd-kind="Class">Human</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L162">human.ts:162</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</dd></dl></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Human</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Human.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#config" class="tsd-kind-icon">config</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#distance" class="tsd-kind-icon">distance</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#draw" class="tsd-kind-icon">draw</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#env" class="tsd-kind-icon">env</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#events" class="tsd-kind-icon">events</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceTriangulation" class="tsd-kind-icon">face<wbr/>Triangulation</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceUVMap" class="tsd-kind-icon">faceUVMap</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#gl" class="tsd-kind-icon">gl</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#match" class="tsd-kind-icon">match</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#performance" class="tsd-kind-icon">performance</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#process" class="tsd-kind-icon">process</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#result" class="tsd-kind-icon">result</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#similarity" class="tsd-kind-icon">similarity</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#state" class="tsd-kind-icon">state</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#version" class="tsd-kind-icon">version</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#detect" class="tsd-kind-icon">detect</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#enhance" class="tsd-kind-icon">enhance</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#image" class="tsd-kind-icon">image</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#init" class="tsd-kind-icon">init</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#load" class="tsd-kind-icon">load</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#next" class="tsd-kind-icon">next</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#reset" class="tsd-kind-icon">reset</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#segmentation" class="tsd-kind-icon">segmentation</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#validate" class="tsd-kind-icon">validate</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#warmup" class="tsd-kind-icon">warmup</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"><a name="constructor" class="tsd-anchor"></a><h3>constructor</h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">new <wbr/>Human<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Human.html" class="tsd-signature-type" data-tsd-kind="Class">Human</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L177">human.ts:177</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Constructor for <strong>Human</strong> library that is futher used for all operations</p>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="Human.html" class="tsd-signature-type" data-tsd-kind="Class">Human</a></h4><div><p>instance: <a href="Human.html">Human</a></p>
|
||||
</div></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="config" class="tsd-anchor"></a><h3>config</h3><div class="tsd-signature tsd-kind-icon">config<span class="tsd-signature-symbol">:</span> <a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L88">human.ts:88</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="config" class="tsd-anchor"></a><h3>config</h3><div class="tsd-signature tsd-kind-icon">config<span class="tsd-signature-symbol">:</span> <a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L103">human.ts:103</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Current configuration</p>
|
||||
<ul>
|
||||
<li>Definition: <a href="../interfaces/Config.html">Config</a></li>
|
||||
<li>Defaults: <a href="https://github.com/vladmandic/human/blob/main/src/config.ts#L292">config</a></li>
|
||||
</ul>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="draw" class="tsd-anchor"></a><h3>draw</h3><div class="tsd-signature tsd-kind-icon">draw<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>all<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>body<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>face<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>gesture<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>hand<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>object<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>options<span class="tsd-signature-symbol">: </span><a href="../interfaces/DrawOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">DrawOptions</a><span class="tsd-signature-symbol">; </span>person<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L124">human.ts:124</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="distance" class="tsd-anchor"></a><h3>distance</h3><div class="tsd-signature tsd-kind-icon">distance<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span>descriptor1<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, descriptor2<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L261">human.ts:261</a></li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>descriptor1<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, descriptor2<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Calculates distance between two descriptors</p>
|
||||
<ul>
|
||||
<li>Minkowski distance algorithm of nth order if <code>order</code> is different than 2</li>
|
||||
<li>Euclidean distance if <code>order</code> is 2 (default)</li>
|
||||
</ul>
|
||||
</div><div><p>Options:</p>
|
||||
<ul>
|
||||
<li><code>order</code></li>
|
||||
</ul>
|
||||
<p>Note: No checks are performed for performance reasons so make sure to pass valid number arrays of equal length</p>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>descriptor1: <a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a></h5></li><li><h5>descriptor2: <a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a></h5></li><li><h5>options: <span class="tsd-signature-symbol">{ </span>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></h5><ul class="tsd-parameters"><li class="tsd-parameter"><h5>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li></ul></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4></li></ul></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="draw" class="tsd-anchor"></a><h3>draw</h3><div class="tsd-signature tsd-kind-icon">draw<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>all<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>body<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>face<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>gesture<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>hand<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>object<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>options<span class="tsd-signature-symbol">: </span><a href="../interfaces/DrawOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">DrawOptions</a><span class="tsd-signature-symbol">; </span>person<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L139">human.ts:139</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Draw helper classes that can draw detected objects on canvas using specified draw</p>
|
||||
<ul>
|
||||
<li>options: <a href="../interfaces/DrawOptions.html">DrawOptions</a> global settings for all draw operations, can be overriden for each draw method</li>
|
||||
|
@ -27,9 +38,9 @@
|
|||
<li>canvas: draw processed canvas which is a processed copy of the input</li>
|
||||
<li>all: meta-function that performs: canvas, face, body, hand</li>
|
||||
</ul>
|
||||
</div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>all<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>body<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>face<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>gesture<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>hand<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>object<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>options<span class="tsd-signature-symbol">: </span><a href="../interfaces/DrawOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">DrawOptions</a></h5></li><li class="tsd-parameter"><h5>person<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="env" class="tsd-anchor"></a><h3>env</h3><div class="tsd-signature tsd-kind-icon">env<span class="tsd-signature-symbol">:</span> <a href="../index.html#Env" class="tsd-signature-type" data-tsd-kind="Type alias">Env</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L114">human.ts:114</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>all<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>body<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>face<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>gesture<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>hand<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>object<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5>options<span class="tsd-signature-symbol">: </span><a href="../interfaces/DrawOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">DrawOptions</a></h5></li><li class="tsd-parameter"><h5>person<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="env" class="tsd-anchor"></a><h3>env</h3><div class="tsd-signature tsd-kind-icon">env<span class="tsd-signature-symbol">:</span> <a href="../index.html#Env" class="tsd-signature-type" data-tsd-kind="Type alias">Env</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L129">human.ts:129</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Object containing environment information used for diagnostics</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="events" class="tsd-anchor"></a><h3>events</h3><div class="tsd-signature tsd-kind-icon">events<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EventTarget</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L142">human.ts:142</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="events" class="tsd-anchor"></a><h3>events</h3><div class="tsd-signature tsd-kind-icon">events<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventTarget</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L157">human.ts:157</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Container for events dispatched by Human</p>
|
||||
</div><div><p>Possible events:</p>
|
||||
<ul>
|
||||
|
@ -40,31 +51,50 @@
|
|||
<li><code>warmup</code>: triggered when warmup is complete</li>
|
||||
<li><code>error</code>: triggered on some errors</li>
|
||||
</ul>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="faceTriangulation" class="tsd-anchor"></a><h3>face<wbr/>Triangulation</h3><div class="tsd-signature tsd-kind-icon">face<wbr/>Triangulation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L144">human.ts:144</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="faceTriangulation" class="tsd-anchor"></a><h3>face<wbr/>Triangulation</h3><div class="tsd-signature tsd-kind-icon">face<wbr/>Triangulation<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L159">human.ts:159</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Reference face triangualtion array of 468 points, used for triangle references between points</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="faceUVMap" class="tsd-anchor"></a><h3>faceUVMap</h3><div class="tsd-signature tsd-kind-icon">faceUVMap<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L146">human.ts:146</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="faceUVMap" class="tsd-anchor"></a><h3>faceUVMap</h3><div class="tsd-signature tsd-kind-icon">faceUVMap<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L161">human.ts:161</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Refernce UV map of 468 values, used for 3D mapping of the face mesh</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="gl" class="tsd-anchor"></a><h3>gl</h3><div class="tsd-signature tsd-kind-icon">gl<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L153">human.ts:153</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="gl" class="tsd-anchor"></a><h3>gl</h3><div class="tsd-signature tsd-kind-icon">gl<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L168">human.ts:168</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>WebGL debug info</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="performance" class="tsd-anchor"></a><h3>performance</h3><div class="tsd-signature tsd-kind-icon">performance<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L148">human.ts:148</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="match" class="tsd-anchor"></a><h3>match</h3><div class="tsd-signature tsd-kind-icon">match<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span>descriptor<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, descriptors<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a><span class="tsd-signature-symbol">[]</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>threshold<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-symbol">{ </span>distance<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L262">human.ts:262</a></li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>descriptor<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, descriptors<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a><span class="tsd-signature-symbol">[]</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>threshold<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>distance<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Matches given descriptor to a closest entry in array of descriptors</p>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>descriptor: <a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>face descriptor</p>
|
||||
</div></div></li><li><h5>descriptors: <a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>array of face descriptors to commpare given descriptor to</p>
|
||||
<p>Options:</p>
|
||||
<ul>
|
||||
<li><code>order</code> see <a href="Human.html#distance">distance</a> method</li>
|
||||
<li><code>threshold</code> match will return result first result for which <a href="Human.html#distance">distance</a> is below <code>threshold</code> even if there may be better results</li>
|
||||
</ul>
|
||||
</div></div></li><li><h5>options: <span class="tsd-signature-symbol">{ </span>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>threshold<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></h5><ul class="tsd-parameters"><li class="tsd-parameter"><h5>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li><li class="tsd-parameter"><h5>threshold<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li></ul></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>distance<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span></h4><div><p>object with index, distance and similarity</p>
|
||||
<ul>
|
||||
<li><code>index</code> index array index where best match was found or -1 if no matches</li>
|
||||
<li><a href="Human.html#distance">distance</a> calculated <code>distance</code> of given descriptor to the best match</li>
|
||||
<li><a href="Human.html#similarity">similarity</a> calculated normalized <code>similarity</code> of given descriptor to the best match</li>
|
||||
</ul>
|
||||
</div><ul class="tsd-parameters"><li class="tsd-parameter"><h5>distance<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li><li class="tsd-parameter"><h5>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li><li class="tsd-parameter"><h5>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li></ul></li></ul></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="performance" class="tsd-anchor"></a><h3>performance</h3><div class="tsd-signature tsd-kind-icon">performance<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L163">human.ts:163</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Performance object that contains values for all recently performed operations</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="process" class="tsd-anchor"></a><h3>process</h3><div class="tsd-signature tsd-kind-icon">process<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L103">human.ts:103</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="process" class="tsd-anchor"></a><h3>process</h3><div class="tsd-signature tsd-kind-icon">process<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L118">human.ts:118</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>currenty processed image tensor and canvas</p>
|
||||
</div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span></h5></li><li class="tsd-parameter"><h5>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="result" class="tsd-anchor"></a><h3>result</h3><div class="tsd-signature tsd-kind-icon">result<span class="tsd-signature-symbol">:</span> <a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L94">human.ts:94</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span></h5></li><li class="tsd-parameter"><h5>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="result" class="tsd-anchor"></a><h3>result</h3><div class="tsd-signature tsd-kind-icon">result<span class="tsd-signature-symbol">:</span> <a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L109">human.ts:109</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Last known result of detect run</p>
|
||||
<ul>
|
||||
<li>Can be accessed anytime after initial detection</li>
|
||||
<li>Definition: <a href="../interfaces/Result.html">Result</a></li>
|
||||
</ul>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="state" class="tsd-anchor"></a><h3>state</h3><div class="tsd-signature tsd-kind-icon">state<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L100">human.ts:100</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="similarity" class="tsd-anchor"></a><h3>similarity</h3><div class="tsd-signature tsd-kind-icon">similarity<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span>descriptor1<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, descriptor2<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L260">human.ts:260</a></li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>descriptor1<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, descriptor2<span class="tsd-signature-symbol">: </span><a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Calculates normalized similarity between two descriptors based on their <code>distance</code></p>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>descriptor1: <a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a></h5></li><li><h5>descriptor2: <a href="../index.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a></h5></li><li><h5>options: <span class="tsd-signature-symbol">{ </span>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></h5><ul class="tsd-parameters"><li class="tsd-parameter"><h5>order<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li></ul></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4></li></ul></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="state" class="tsd-anchor"></a><h3>state</h3><div class="tsd-signature tsd-kind-icon">state<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L115">human.ts:115</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Current state of Human library</p>
|
||||
<ul>
|
||||
<li>Can be polled to determine operations that are currently executed</li>
|
||||
<li>Progresses through: 'config', 'check', 'backend', 'load', 'run:<model>', 'idle'</li>
|
||||
</ul>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="version" class="tsd-anchor"></a><h3>version</h3><div class="tsd-signature tsd-kind-icon">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L82">human.ts:82</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a name="version" class="tsd-anchor"></a><h3>version</h3><div class="tsd-signature tsd-kind-icon">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L97">human.ts:97</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Current version of Human library in <em>semver</em> format</p>
|
||||
</div></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="detect" class="tsd-anchor"></a><h3>detect</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">detect<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a>, userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../index.html#Error" class="tsd-signature-type" data-tsd-kind="Type alias">Error</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L389">human.ts:389</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="detect" class="tsd-anchor"></a><h3>detect</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">detect<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a>, userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../index.html#Error" class="tsd-signature-type" data-tsd-kind="Type alias">Error</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L386">human.ts:386</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Main detection method</p>
|
||||
<ul>
|
||||
<li>Analyze configuration: <a href="../interfaces/Config.html">Config</a></li>
|
||||
|
@ -73,12 +103,12 @@
|
|||
<li>Process and return result: <a href="../interfaces/Result.html">Result</a></li>
|
||||
</ul>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../index.html#Error" class="tsd-signature-type" data-tsd-kind="Type alias">Error</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol">></span></h4><div><p>result: <a href="../interfaces/Result.html">Result</a></p>
|
||||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="enhance" class="tsd-anchor"></a><h3>enhance</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">enhance<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L289">human.ts:289</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="enhance" class="tsd-anchor"></a><h3>enhance</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">enhance<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L296">human.ts:296</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Enhance method performs additional enhacements to face image previously detected for futher processing</p>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span></h4><div><p>Tensor</p>
|
||||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="image" class="tsd-anchor"></a><h3>image</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">image<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> }</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L249">human.ts:249</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="image" class="tsd-anchor"></a><h3>image</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">image<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> }</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L269">human.ts:269</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Process input as return canvas and tensor</p>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> }</span></h4><div></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span></h5></li><li class="tsd-parameter"><h5>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span></h5></li></ul></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="init" class="tsd-anchor"></a><h3>init</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">init<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L312">human.ts:312</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol">; </span>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> }</span></h4><div></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span></h5></li><li class="tsd-parameter"><h5>tensor<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Tensor</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Rank</span><span class="tsd-signature-symbol">></span></h5></li></ul></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="init" class="tsd-anchor"></a><h3>init</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">init<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L307">human.ts:307</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Explicit backend initialization</p>
|
||||
<ul>
|
||||
<li>Normally done implicitly during initial load phase</li>
|
||||
|
@ -86,22 +116,19 @@
|
|||
<li>Use when changing backend during runtime</li>
|
||||
</ul>
|
||||
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div><p>Promise<void></p>
|
||||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="load" class="tsd-anchor"></a><h3>load</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">load<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L324">human.ts:324</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="load" class="tsd-anchor"></a><h3>load</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">load<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L319">human.ts:319</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Load method preloads all configured models on-demand</p>
|
||||
<ul>
|
||||
<li>Not explicitly required as any required model is load implicitly on it's first run</li>
|
||||
</ul>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div><p>Promise<void></p>
|
||||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="match" class="tsd-anchor"></a><h3>match</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">match<span class="tsd-signature-symbol">(</span>faceEmbedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span>, db<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span>, threshold<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L301">human.ts:301</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Math method find best match between provided face descriptor and predefined database of known descriptors</p>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>faceEmbedding: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li><li><h5>db: <span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></h5></li><li><h5>threshold: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></h4><div><p>best match</p>
|
||||
</div><ul class="tsd-parameters"><li class="tsd-parameter"><h5>embedding<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li><li class="tsd-parameter"><h5>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li><li class="tsd-parameter"><h5>source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li></ul></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="next" class="tsd-anchor"></a><h3>next</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">next<span class="tsd-signature-symbol">(</span>result<span class="tsd-signature-symbol">?: </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L365">human.ts:365</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="next" class="tsd-anchor"></a><h3>next</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">next<span class="tsd-signature-symbol">(</span>result<span class="tsd-signature-symbol">?: </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L362">human.ts:362</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Runs interpolation using last known result and returns smoothened result
|
||||
Interpolation is based on time since last known result so can be called independently</p>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>result: <a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol"> = ...</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a></h4><div><p>result: <a href="../interfaces/Result.html">Result</a></p>
|
||||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="reset" class="tsd-anchor"></a><h3>reset</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">reset<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L233">human.ts:233</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="reset" class="tsd-anchor"></a><h3>reset</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">reset<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L248">human.ts:248</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Reset configuration to default values</p>
|
||||
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="segmentation" class="tsd-anchor"></a><h3>segmentation</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">segmentation<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a>, background<span class="tsd-signature-symbol">?: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{ </span>alpha<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L279">human.ts:279</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="segmentation" class="tsd-anchor"></a><h3>segmentation</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">segmentation<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a>, background<span class="tsd-signature-symbol">?: </span><a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{ </span>alpha<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L286">human.ts:286</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Segmentation method takes any input and returns processed canvas with body segmentation</p>
|
||||
<ul>
|
||||
<li>Optional parameter background is used to fill the background with specific input</li>
|
||||
|
@ -113,20 +140,13 @@ Interpolation is based on time since last known result so can be called independ
|
|||
<li><code>canvas</code> as canvas which is input image filtered with segementation data and optionally merged with background image. canvas alpha values are set to segmentation values for easy merging</li>
|
||||
<li><code>alpha</code> as grayscale canvas that represents segmentation alpha values</li>
|
||||
</ul>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> background: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{ </span>alpha<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">></span></h4><div></div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="similarity" class="tsd-anchor"></a><h3>similarity</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">similarity<span class="tsd-signature-symbol">(</span>embedding1<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span>, embedding2<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L262">human.ts:262</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Simmilarity method calculates simmilarity between two provided face descriptors (face embeddings)</p>
|
||||
<ul>
|
||||
<li>Calculation is based on normalized Minkowski distance between two descriptors</li>
|
||||
<li>Default is Euclidean distance which is Minkowski distance of 2nd order</li>
|
||||
</ul>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>embedding1: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li><li><h5>embedding2: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div><p>similarity: number</p>
|
||||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="validate" class="tsd-anchor"></a><h3>validate</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">validate<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>expected<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>reason<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>where<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L240">human.ts:240</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> background: <a href="../index.html#Input" class="tsd-signature-type" data-tsd-kind="Type alias">Input</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{ </span>alpha<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol">; </span>canvas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">></span></h4><div></div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="validate" class="tsd-anchor"></a><h3>validate</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">validate<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>expected<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>reason<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>where<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L255">human.ts:255</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Validate current configuration schema</p>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>expected<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>reason<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>where<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="warmup" class="tsd-anchor"></a><h3>warmup</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">warmup<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">{ </span>error<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L375">human.ts:375</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>expected<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>reason<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>where<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a name="warmup" class="tsd-anchor"></a><h3>warmup</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">warmup<span class="tsd-signature-symbol">(</span>userConfig<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">{ </span>error<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/human.ts#L372">human.ts:372</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Warmup method pre-initializes all configured models for faster inference</p>
|
||||
<ul>
|
||||
<li>can take significant time on startup</li>
|
||||
<li>only used for <code>webgl</code> and <code>humangl</code> backends</li>
|
||||
</ul>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> userConfig: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Config.html" class="tsd-signature-type" data-tsd-kind="Interface">Config</a><span class="tsd-signature-symbol">></span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/Result.html" class="tsd-signature-type" data-tsd-kind="Interface">Result</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">{ </span>error<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">></span></h4><div><p>result: <a href="../interfaces/Result.html">Result</a></p>
|
||||
</div></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="Human.html" class="tsd-kind-icon">Human</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Human.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#config" class="tsd-kind-icon">config</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#draw" class="tsd-kind-icon">draw</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#env" class="tsd-kind-icon">env</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#events" class="tsd-kind-icon">events</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceTriangulation" class="tsd-kind-icon">face<wbr/>Triangulation</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceUVMap" class="tsd-kind-icon">faceUVMap</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#gl" class="tsd-kind-icon">gl</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#performance" class="tsd-kind-icon">performance</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#process" class="tsd-kind-icon">process</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#result" class="tsd-kind-icon">result</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#state" class="tsd-kind-icon">state</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#version" class="tsd-kind-icon">version</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#detect" class="tsd-kind-icon">detect</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#enhance" class="tsd-kind-icon">enhance</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#image" class="tsd-kind-icon">image</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#init" class="tsd-kind-icon">init</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#load" class="tsd-kind-icon">load</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#match" class="tsd-kind-icon">match</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#next" class="tsd-kind-icon">next</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#reset" class="tsd-kind-icon">reset</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#segmentation" class="tsd-kind-icon">segmentation</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#similarity" class="tsd-kind-icon">similarity</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#validate" class="tsd-kind-icon">validate</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#warmup" class="tsd-kind-icon">warmup</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
||||
</div></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="Human.html" class="tsd-kind-icon">Human</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Human.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#config" class="tsd-kind-icon">config</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#distance" class="tsd-kind-icon">distance</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#draw" class="tsd-kind-icon">draw</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#env" class="tsd-kind-icon">env</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#events" class="tsd-kind-icon">events</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceTriangulation" class="tsd-kind-icon">face<wbr/>Triangulation</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#faceUVMap" class="tsd-kind-icon">faceUVMap</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#gl" class="tsd-kind-icon">gl</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#match" class="tsd-kind-icon">match</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#performance" class="tsd-kind-icon">performance</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#process" class="tsd-kind-icon">process</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#result" class="tsd-kind-icon">result</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#similarity" class="tsd-kind-icon">similarity</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#state" class="tsd-kind-icon">state</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Human.html#version" class="tsd-kind-icon">version</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#detect" class="tsd-kind-icon">detect</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#enhance" class="tsd-kind-icon">enhance</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#image" class="tsd-kind-icon">image</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#init" class="tsd-kind-icon">init</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#load" class="tsd-kind-icon">load</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#next" class="tsd-kind-icon">next</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#reset" class="tsd-kind-icon">reset</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#segmentation" class="tsd-kind-icon">segmentation</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#validate" class="tsd-kind-icon">validate</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Human.html#warmup" class="tsd-kind-icon">warmup</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
|||
</div><div><p>Contains all possible detection results</p>
|
||||
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Result</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Result.html#body" class="tsd-kind-icon">body</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Result.html#canvas" class="tsd-kind-icon">canvas</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Result.html#face" class="tsd-kind-icon">face</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Result.html#gesture" class="tsd-kind-icon">gesture</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Result.html#hand" class="tsd-kind-icon">hand</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Result.html#object" class="tsd-kind-icon">object</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Result.html#performance" class="tsd-kind-icon">performance</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Result.html#persons" class="tsd-kind-icon">persons</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="Result.html#timestamp" class="tsd-kind-icon">timestamp</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="body" class="tsd-anchor"></a><h3>body</h3><div class="tsd-signature tsd-kind-icon">body<span class="tsd-signature-symbol">:</span> <a href="BodyResult.html" class="tsd-signature-type" data-tsd-kind="Interface">BodyResult</a><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/result.ts#L185">result.ts:185</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p><a href="BodyResult.html">BodyResult</a>: detection & analysis results</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="canvas" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagOptional">Optional</span> canvas</h3><div class="tsd-signature tsd-kind-icon">canvas<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/result.ts#L195">result.ts:195</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="canvas" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagOptional">Optional</span> canvas</h3><div class="tsd-signature tsd-kind-icon">canvas<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/result.ts#L195">result.ts:195</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>optional processed canvas that can be used to draw input on screen</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a name="face" class="tsd-anchor"></a><h3>face</h3><div class="tsd-signature tsd-kind-icon">face<span class="tsd-signature-symbol">:</span> <a href="FaceResult.html" class="tsd-signature-type" data-tsd-kind="Interface">FaceResult</a><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/result.ts#L183">result.ts:183</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p><a href="FaceResult.html">FaceResult</a>: detection & analysis results</p>
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"movenet.d.ts","sourceRoot":"","sources":["../../../src/body/movenet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAgBxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAW9D;AAsFD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA2ClF"}
|
||||
{"version":3,"file":"movenet.d.ts","sourceRoot":"","sources":["../../../src/body/movenet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAgBxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAW9D;AAwFD,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA2ClF"}
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"facemesh.d.ts","sourceRoot":"","sources":["../../../src/face/facemesh.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAS,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAUxC,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAgGlF;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAU9D;AAED,eAAO,MAAM,aAAa,UAAgB,CAAC;AAC3C,eAAO,MAAM,KAAK,YAAe,CAAC"}
|
||||
{"version":3,"file":"facemesh.d.ts","sourceRoot":"","sources":["../../../src/face/facemesh.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAS,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAUxC,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA+FlF;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAU9D;AAED,eAAO,MAAM,aAAa,UAAgB,CAAC;AAC3C,eAAO,MAAM,KAAK,YAAe,CAAC"}
|
|
@ -8,20 +8,7 @@
|
|||
*/
|
||||
import type { Tensor, GraphModel } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
declare type DB = Array<{
|
||||
name: string;
|
||||
source: string;
|
||||
embedding: number[];
|
||||
}>;
|
||||
export declare function load(config: Config): Promise<GraphModel>;
|
||||
export declare function similarity(embedding1: Array<number>, embedding2: Array<number>, order?: number): number;
|
||||
export declare function match(embedding: Array<number>, db: DB, threshold?: number): {
|
||||
similarity: number;
|
||||
name: string;
|
||||
source: string;
|
||||
embedding: number[];
|
||||
};
|
||||
export declare function enhance(input: any): Tensor;
|
||||
export declare function predict(image: Tensor, config: Config, idx: any, count: any): Promise<unknown>;
|
||||
export {};
|
||||
//# sourceMappingURL=faceres.d.ts.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"faceres.d.ts","sourceRoot":"","sources":["../../../src/face/faceres.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAcxC,aAAK,EAAE,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC;AAEvE,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAS9D;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,SAAI,GAAG,MAAM,CAWlG;AAED,wBAAgB,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,SAAI;;;;;EAUpE;AAED,wBAAgB,OAAO,CAAC,KAAK,KAAA,GAAG,MAAM,CAmDrC;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBA8CtE"}
|
||||
{"version":3,"file":"faceres.d.ts","sourceRoot":"","sources":["../../../src/face/faceres.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAcxC,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAS9D;AAED,wBAAgB,OAAO,CAAC,KAAK,KAAA,GAAG,MAAM,CAmDrC;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,oBA8CtE"}
|
|
@ -0,0 +1,41 @@
|
|||
/** Defines Descriptor type */
|
||||
export declare type Descriptor = Array<number>;
|
||||
/** Calculates distance between two descriptors
|
||||
* - Minkowski distance algorithm of nth order if `order` is different than 2
|
||||
* - Euclidean distance if `order` is 2 (default)
|
||||
*
|
||||
* Options:
|
||||
* - `order`
|
||||
*
|
||||
* Note: No checks are performed for performance reasons so make sure to pass valid number arrays of equal length
|
||||
*/
|
||||
export declare function distance(descriptor1: Descriptor, descriptor2: Descriptor, options?: {
|
||||
order: number;
|
||||
}): number;
|
||||
/** Calculates normalized similarity between two descriptors based on their `distance`
|
||||
*/
|
||||
export declare function similarity(descriptor1: Descriptor, descriptor2: Descriptor, options?: {
|
||||
order: number;
|
||||
}): number;
|
||||
/** Matches given descriptor to a closest entry in array of descriptors
|
||||
* @param descriptor face descriptor
|
||||
* @param descriptors array of face descriptors to commpare given descriptor to
|
||||
*
|
||||
* Options:
|
||||
* - `order` see {@link distance} method
|
||||
* - `threshold` match will return result first result for which {@link distance} is below `threshold` even if there may be better results
|
||||
*
|
||||
* @returns object with index, distance and similarity
|
||||
* - `index` index array index where best match was found or -1 if no matches
|
||||
* - {@link distance} calculated `distance` of given descriptor to the best match
|
||||
* - {@link similarity} calculated normalized `similarity` of given descriptor to the best match
|
||||
*/
|
||||
export declare function match(descriptor: Descriptor, descriptors: Array<Descriptor>, options?: {
|
||||
order: number;
|
||||
threshold: number;
|
||||
}): {
|
||||
index: number;
|
||||
distance: number;
|
||||
similarity: number;
|
||||
};
|
||||
//# sourceMappingURL=match.d.ts.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../../src/face/match.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,oBAAY,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;AAEtC;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO;;CAAe,UAQhG;AAED;GACG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO;;CAAe,UAIlG;AAED;;;;;;;;;;;;EAYE;AACF,wBAAgB,KAAK,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,OAAO;;;CAA6B;;;;EAgBjH"}
|
|
@ -1,24 +1,31 @@
|
|||
/**
|
||||
* Human main module
|
||||
*/
|
||||
import { Config } from './config';
|
||||
import type { Result } from './result';
|
||||
import * as tf from '../dist/tfjs.esm.js';
|
||||
import * as models from './models';
|
||||
import * as facemesh from './face/facemesh';
|
||||
import * as env from './util/env';
|
||||
import * as facemesh from './face/facemesh';
|
||||
import * as match from './face/match';
|
||||
import * as models from './models';
|
||||
import type { Result } from './result';
|
||||
import type { Tensor } from './tfjs/types';
|
||||
import type { DrawOptions } from './util/draw';
|
||||
import type { Input } from './image/image';
|
||||
import type { Config } from './config';
|
||||
/** Defines configuration options used by all **Human** methods */
|
||||
export * from './config';
|
||||
/** Defines result types returned by all **Human** methods */
|
||||
export * from './result';
|
||||
/** Defines DrawOptions used by `human.draw.*` methods */
|
||||
export type { DrawOptions } from './util/draw';
|
||||
export { env, Env } from './util/env';
|
||||
/** Face descriptor type as number array */
|
||||
export type { Descriptor } from './face/match';
|
||||
/** Box and Point primitives */
|
||||
export { Box, Point } from './result';
|
||||
/** Defines all possible models used by **Human** library */
|
||||
export { Models } from './models';
|
||||
/** Defines all possible input types for **Human** detection
|
||||
* @typedef Input Type
|
||||
*/
|
||||
export declare type Input = Tensor | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;
|
||||
/** Defines all possible input types for **Human** detection */
|
||||
export { Input } from './image/image';
|
||||
/** Events dispatched by `human.events`
|
||||
*
|
||||
* - `create`: triggered when Human object is instantiated
|
||||
|
@ -116,7 +123,7 @@ export declare class Human {
|
|||
* - `warmup`: triggered when warmup is complete
|
||||
* - `error`: triggered on some errors
|
||||
*/
|
||||
events: EventTarget;
|
||||
events: EventTarget | undefined;
|
||||
/** Reference face triangualtion array of 468 points, used for triangle references between points */
|
||||
faceTriangulation: typeof facemesh.triangulation;
|
||||
/** Refernce UV map of 468 values, used for 3D mapping of the face mesh */
|
||||
|
@ -142,6 +149,10 @@ export declare class Human {
|
|||
where: string;
|
||||
expected?: string;
|
||||
}[];
|
||||
/** Exports face matching methods */
|
||||
similarity: typeof match.similarity;
|
||||
distance: typeof match.distance;
|
||||
match: typeof match.match;
|
||||
/** Process input as return canvas and tensor
|
||||
*
|
||||
* @param input: {@link Input}
|
||||
|
@ -149,17 +160,8 @@ export declare class Human {
|
|||
*/
|
||||
image(input: Input): {
|
||||
tensor: Tensor<import("@tensorflow/tfjs-core").Rank> | null;
|
||||
canvas: OffscreenCanvas | HTMLCanvasElement | null;
|
||||
canvas: HTMLCanvasElement | OffscreenCanvas | null;
|
||||
};
|
||||
/** Simmilarity method calculates simmilarity between two provided face descriptors (face embeddings)
|
||||
* - Calculation is based on normalized Minkowski distance between two descriptors
|
||||
* - Default is Euclidean distance which is Minkowski distance of 2nd order
|
||||
*
|
||||
* @param embedding1: face descriptor as array of numbers
|
||||
* @param embedding2: face descriptor as array of numbers
|
||||
* @returns similarity: number
|
||||
*/
|
||||
similarity(embedding1: Array<number>, embedding2: Array<number>): number;
|
||||
/** Segmentation method takes any input and returns processed canvas with body segmentation
|
||||
* - Optional parameter background is used to fill the background with specific input
|
||||
* - Segmentation is not triggered as part of detect process
|
||||
|
@ -184,23 +186,6 @@ export declare class Human {
|
|||
* @returns Tensor
|
||||
*/
|
||||
enhance(input: Tensor): Tensor | null;
|
||||
/** Math method find best match between provided face descriptor and predefined database of known descriptors
|
||||
*
|
||||
* @param faceEmbedding: face descriptor previsouly calculated on any face
|
||||
* @param db: array of mapping of face descriptors to known values
|
||||
* @param threshold: minimum score for matching to be considered in the result
|
||||
* @returns best match
|
||||
*/
|
||||
match(faceEmbedding: Array<number>, db: Array<{
|
||||
name: string;
|
||||
source: string;
|
||||
embedding: number[];
|
||||
}>, threshold?: number): {
|
||||
name: string;
|
||||
source: string;
|
||||
similarity: number;
|
||||
embedding: number[];
|
||||
};
|
||||
/** Explicit backend initialization
|
||||
* - Normally done implicitly during initial load phase
|
||||
* - Call to explictly register and initialize TFJS backend without any other operations
|
||||
|
@ -217,7 +202,7 @@ export declare class Human {
|
|||
*/
|
||||
load(userConfig?: Partial<Config>): Promise<void>;
|
||||
/** @hidden */
|
||||
emit: (event: string) => boolean;
|
||||
emit: (event: string) => void;
|
||||
/** Runs interpolation using last known result and returns smoothened result
|
||||
* Interpolation is based on time since last known result so can be called independently
|
||||
*
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"human.d.ts","sourceRoot":"","sources":["../../src/human.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAY,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAiF,MAAM,UAAU,CAAC;AACtH,OAAO,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAiB5C,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAKlC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;GAEG;AACH,oBAAY,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAEpJ;;;;;;;GAOG;AACH,oBAAY,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjF;;GAEG;AACH,oBAAY,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC;;GAEG;AACH,oBAAY,UAAU,GAAG,OAAO,EAAE,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,qBAAa,KAAK;;IAChB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;MAGE;IACF,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd,iDAAiD;IACjD,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,GAAG,IAAI,CAAA;KAAE,CAAC;IAEvF;;;;;OAKG;IACH,EAAE,EAAE,UAAU,CAAC;IAEf,qEAAqE;IACrE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC;IAEb;;;;;;;OAOG;IACH,IAAI,EAAE;QAAE,MAAM,MAAC;QAAC,IAAI,MAAC;QAAC,IAAI,MAAC;QAAC,IAAI,MAAC;QAAC,OAAO,MAAC;QAAC,MAAM,MAAC;QAAC,MAAM,MAAC;QAAC,GAAG,MAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC;IAEvF;;;MAGE;IACF,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;IAEtB;;;;;;;;;OASG;IACH,MAAM,EAAE,WAAW,CAAC;IACpB,oGAAoG;IACpG,iBAAiB,EAAE,OAAO,QAAQ,CAAC,aAAa,CAAC;IACjD,0EAA0E;IAC1E,SAAS,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC;IACjC,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAIpC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAG5B;;;;;OAKG;gBACS,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;IA8CxC,cAAc;IACd,OAAO,WAAY,MAAM,EAAE,UAO1B;IAgBD,4CAA4C;IAC5C,KAAK;IAML,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;;;;;IAIrC;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,KAAK;;;;IAIlB;;;;;;;MAOE;IAEF,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIxE;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAA;KAAE,CAAC;IAIxL;;;;OAIG;IAEH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrC;;;;;;OAMG;IAEH,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,EAAE,SAAS,SAAI,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE;IAI/L;;;;;;OAMG;IACG,IAAI;IAMV;;;;;MAKE;IACI,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;IAgCvC,cAAc;IACd,IAAI,UAAW,MAAM,aAAkD;IAEvE;;;;;OAKG;IACH,IAAI,CAAC,MAAM,GAAE,MAAoB;IAIjC;;;;;MAKE;IACI,MAAM,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG;QAAE,KAAK,MAAA;KAAE,CAAC;IAIvE;;;;;;;;;MASE;IACI,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;CAkKlF;AAED,oCAAoC;AACpC,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,CAAC"}
|
||||
{"version":3,"file":"human.d.ts","sourceRoot":"","sources":["../../src/human.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAQ1C,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAQ5C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AASnC,OAAO,KAAK,EAAE,MAAM,EAAiF,MAAM,UAAU,CAAC;AACtH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,kEAAkE;AAClE,cAAc,UAAU,CAAC;AAEzB,6DAA6D;AAC7D,cAAc,UAAU,CAAC;AAEzB,yDAAyD;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,2CAA2C;AAC3C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,+BAA+B;AAC/B,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,4DAA4D;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,+DAA+D;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC;;;;;;;GAOG;AACH,oBAAY,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjF;;GAEG;AACH,oBAAY,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC;;GAEG;AACH,oBAAY,UAAU,GAAG,OAAO,EAAE,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,qBAAa,KAAK;;IAChB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;MAGE;IACF,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd,iDAAiD;IACjD,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,GAAG,IAAI,CAAA;KAAE,CAAC;IAEvF;;;;;OAKG;IACH,EAAE,EAAE,UAAU,CAAC;IAEf,qEAAqE;IACrE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC;IAEb;;;;;;;OAOG;IACH,IAAI,EAAE;QAAE,MAAM,MAAC;QAAC,IAAI,MAAC;QAAC,IAAI,MAAC;QAAC,IAAI,MAAC;QAAC,OAAO,MAAC;QAAC,MAAM,MAAC;QAAC,MAAM,MAAC;QAAC,GAAG,MAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC;IAEvF;;;MAGE;IACF,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;IAEtB;;;;;;;;;OASG;IACH,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,oGAAoG;IACpG,iBAAiB,EAAE,OAAO,QAAQ,CAAC,aAAa,CAAC;IACjD,0EAA0E;IAC1E,SAAS,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC;IACjC,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAIpC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAG5B;;;;;OAKG;gBACS,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;IA8CxC,cAAc;IACd,OAAO,WAAY,MAAM,EAAE,UAO1B;IAgBD,4CAA4C;IAC5C,KAAK,IAAI,IAAI;IAMb,4CAA4C;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;;;;;IAI5C,oCAAoC;IAC7B,UAAU,0BAAoB;IAC9B,QAAQ,wBAAkB;IAC1B,KAAK,qBAAe;IAE3B;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,KAAK;;;;IAIlB;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAA;KAAE,CAAC;IAIxL;;;;OAIG;IAEH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrC;;;;;;OAMG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B;;;;;MAKE;IACI,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCvD,cAAc;IACd,IAAI,UAAW,MAAM,UAEpB;IAED;;;;;OAKG;IACH,IAAI,CAAC,MAAM,GAAE,MAAoB,GAAG,MAAM;IAI1C;;;;;MAKE;IACI,MAAM,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG;QAAE,KAAK,MAAA;KAAE,CAAC;IAIvE;;;;;;;;;MASE;IACI,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;CAkKlF;AAED,oCAAoC;AACpC,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,CAAC"}
|
|
@ -4,12 +4,11 @@
|
|||
import type { Tensor } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
import { env } from '../util/env';
|
||||
declare type Input = Tensor | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | typeof Image | typeof env.Canvas;
|
||||
export declare type Input = Tensor | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | typeof Image | typeof env.Canvas;
|
||||
export declare function canvas(width: any, height: any): HTMLCanvasElement | OffscreenCanvas;
|
||||
export declare function process(input: Input, config: Config): {
|
||||
tensor: Tensor | null;
|
||||
canvas: OffscreenCanvas | HTMLCanvasElement | null;
|
||||
};
|
||||
export declare function skip(config: any, input: Tensor): Promise<boolean>;
|
||||
export {};
|
||||
//# sourceMappingURL=image.d.ts.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/image/image.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,aAAK,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,GAAG,OAAO,KAAK,GAAG,OAAO,GAAG,CAAC,MAAM,CAAC;AAShL,wBAAgB,MAAM,CAAC,KAAK,KAAA,EAAE,MAAM,KAAA,GAAG,iBAAiB,GAAG,eAAe,CAiBzE;AAKD,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,GAAG,IAAI,CAAA;CAAE,CAsLnI;AAID,wBAAsB,IAAI,CAAC,MAAM,KAAA,EAAE,KAAK,EAAE,MAAM,oBA2B/C"}
|
||||
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/image/image.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,oBAAY,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,GAAG,OAAO,KAAK,GAAG,OAAO,GAAG,CAAC,MAAM,CAAC;AASvL,wBAAgB,MAAM,CAAC,KAAK,KAAA,EAAE,MAAM,KAAA,GAAG,iBAAiB,GAAG,eAAe,CAiBzE;AAKD,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,GAAG,IAAI,CAAA;CAAE,CAsLnI;AAID,wBAAsB,IAAI,CAAC,MAAM,KAAA,EAAE,KAAK,EAAE,MAAM,oBA2B/C"}
|
|
@ -34,5 +34,5 @@ export declare class Models {
|
|||
export declare function reset(instance: Human): void;
|
||||
/** Load method preloads all instance.configured models on-demand */
|
||||
export declare function load(instance: Human): Promise<void>;
|
||||
export declare function validate(instance: any): Promise<void>;
|
||||
export declare function validate(instance: Human): Promise<void>;
|
||||
//# sourceMappingURL=models.d.ts.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIrC;;;;;GAKG;AACH,qBAAa,MAAM;IACjB,GAAG,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACpD,aAAa,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC9D,eAAe,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAChE,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,aAAa,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC9D,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,UAAU,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3D,QAAQ,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACzD,QAAQ,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACzD,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,MAAM,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACvD,QAAQ,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACzD,YAAY,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC7D,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,YAAY,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;CAC9D;AAED,wBAAgB,KAAK,CAAC,QAAQ,EAAE,KAAK,QAGpC;AAED,oEAAoE;AACpE,wBAAsB,IAAI,CAAC,QAAQ,EAAE,KAAK,iBA4BzC;AAED,wBAAsB,QAAQ,CAAC,QAAQ,KAAA,iBA4CtC"}
|
||||
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIrC;;;;;GAKG;AACH,qBAAa,MAAM;IACjB,GAAG,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACpD,aAAa,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC9D,eAAe,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAChE,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,aAAa,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC9D,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,UAAU,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3D,QAAQ,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACzD,QAAQ,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACzD,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,MAAM,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACvD,QAAQ,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACzD,YAAY,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC7D,SAAS,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC1D,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;IACxD,YAAY,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAQ;CAC9D;AAED,wBAAgB,KAAK,CAAC,QAAQ,EAAE,KAAK,GAAG,IAAI,CAG3C;AAED,oEAAoE;AACpE,wBAAsB,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BzD;AAED,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CA4C7D"}
|
|
@ -5,14 +5,13 @@
|
|||
* - [**MediaPipe Meet**](https://drive.google.com/file/d/1lnP1bRi9CSqQQXUHa13159vLELYDgDu0/preview)
|
||||
* - [**MediaPipe Selfie**](https://drive.google.com/file/d/1dCfozqknMa068vVsO2j_1FgZkW_e3VWv/preview)
|
||||
*/
|
||||
import type { GraphModel, Tensor } from '../tfjs/types';
|
||||
import type { GraphModel } from '../tfjs/types';
|
||||
import type { Config } from '../config';
|
||||
declare type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageElement | HTMLMediaElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;
|
||||
import type { Input } from '../image/image';
|
||||
export declare function load(config: Config): Promise<GraphModel>;
|
||||
export declare function process(input: Input, background: Input | undefined, config: Config): Promise<{
|
||||
data: Array<number>;
|
||||
canvas: HTMLCanvasElement | OffscreenCanvas | null;
|
||||
alpha: HTMLCanvasElement | OffscreenCanvas | null;
|
||||
}>;
|
||||
export {};
|
||||
//# sourceMappingURL=segmentation.d.ts.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"segmentation.d.ts","sourceRoot":"","sources":["../../../src/segmentation/segmentation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGxC,aAAK,KAAK,GAAG,MAAM,GAAG,OAAO,KAAK,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAK5J,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAO9D;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GACvF,OAAO,CAAC;IAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAA;CAAE,CAAC,CAqExI"}
|
||||
{"version":3,"file":"segmentation.d.ts","sourceRoot":"","sources":["../../../src/segmentation/segmentation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAK5C,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAO9D;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GACvF,OAAO,CAAC;IAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAAA;CAAE,CAAC,CAqExI"}
|
|
@ -2,7 +2,7 @@
|
|||
export declare const config: {
|
||||
name: string;
|
||||
priority: number;
|
||||
canvas: OffscreenCanvas | HTMLCanvasElement | null;
|
||||
canvas: HTMLCanvasElement | OffscreenCanvas | null;
|
||||
gl: WebGL2RenderingContext | null;
|
||||
extensions: string[];
|
||||
webGLattr: {
|
||||
|
|
Loading…
Reference in New Issue