UNPKG

@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

30 lines (21 loc) 905 B
export interface ITinyYolov2Options { inputSize?: number scoreThreshold?: number } export class TinyYolov2Options { protected _name = 'TinyYolov2Options' private _inputSize: number private _scoreThreshold: number constructor({ inputSize, scoreThreshold }: ITinyYolov2Options = {}) { this._inputSize = inputSize || 416; this._scoreThreshold = scoreThreshold || 0.5; if (typeof this._inputSize !== 'number' || this._inputSize % 32 !== 0) { throw new Error(`${this._name} - expected inputSize to be a number divisible by 32`); } if (typeof this._scoreThreshold !== 'number' || this._scoreThreshold <= 0 || this._scoreThreshold >= 1) { throw new Error(`${this._name} - expected scoreThreshold to be a number between 0 and 1`); } } get inputSize(): number { return this._inputSize; } get scoreThreshold(): number { return this._scoreThreshold; } }