fix(gear): ensure gear.modelPath is used for loadModel()

pull/280/head
FaeronGaming 2022-07-09 11:52:54 -06:00
parent 4f69e85e1f
commit dce08771b4
2 changed files with 8 additions and 1 deletions

View File

@ -66,6 +66,12 @@ export interface FaceAntiSpoofConfig extends GenericConfig {}
/** Liveness part of face configuration */
export interface FaceLivenessConfig extends GenericConfig {}
/** Gear part of face configuration */
export interface FaceGearConfig extends GenericConfig {
/** minimum confidence for a detected race before results are discarded */
minConfidence: number,
}
/** Configures all face-specific options: face detection, mesh analysis, age, gender, emotion detection and face description */
export interface FaceConfig extends GenericConfig {
detector: Partial<FaceDetectorConfig>,
@ -76,6 +82,7 @@ export interface FaceConfig extends GenericConfig {
emotion: Partial<FaceEmotionConfig>,
antispoof: Partial<FaceAntiSpoofConfig>,
liveness: Partial<FaceLivenessConfig>,
gear: Partial<FaceGearConfig>,
}
/** Configures all body detection specific options */

View File

@ -24,7 +24,7 @@ let skipped = Number.MAX_SAFE_INTEGER;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export async function load(config: Config) {
if (env.initial) model = null;
if (!model) model = await loadModel(config.face['gear']);
if (!model) model = await loadModel(config.face['gear']?.modelPath);
else if (config.debug) log('cached model:', model['modelUrl']);
return model;
}