@vladmandic/face-api
Version:
FaceAPI: AI-powered Face Detection & Rotation Tracking, Face Description & Recognition, Age & Gender & Emotion Prediction for Browser and NodeJS using TensorFlow/JS
26 lines (18 loc) • 569 B
text/typescript
import { round } from '../utils/index';
export interface IFaceMatch {
label: string
distance: number
}
export class FaceMatch implements IFaceMatch {
private _label: string
private _distance: number
constructor(label: string, distance: number) {
this._label = label;
this._distance = distance;
}
public get label(): string { return this._label; }
public get distance(): number { return this._distance; }
public toString(withDistance = true): string {
return `${this.label}${withDistance ? ` (${round(this.distance)})` : ''}`;
}
}