fix(face-landmarks) set explicit model paths

This commit is contained in:
Gabriel Borlea 2022-05-12 14:30:47 +03:00 committed by GitHub
parent 4a350df695
commit c4106b8d89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 5 deletions

View File

@ -59,12 +59,16 @@ const config: Partial<Config> = {
face: {
enabled: true,
detector: {
enabled: true,
rotation: false
enabled: false,
rotation: false,
modelPath: 'blazeface-front.json'
},
mesh: { enabled: false },
iris: { enabled: false },
emotion: { enabled: false },
emotion: {
enabled: false,
modelPath: 'emotion.json'
},
description: { enabled: false }
},
hand: { enabled: false },
@ -147,9 +151,19 @@ const init = async ({ baseUrl, detectionTypes }: InitInput) => {
config.wasmPath = baseUrl;
setWasmPaths(baseUrl);
}
if (detectionTypes.includes(DETECTION_TYPES.FACE_EXPRESSIONS) && config.face) {
config.face.emotion = { enabled: true };
if (detectionTypes.length > 0 && config.face) {
config.face.enabled = true
}
if (detectionTypes.includes(DETECTION_TYPES.FACE_BOX) && config.face?.detector) {
config.face.detector.enabled = true;
}
if (detectionTypes.includes(DETECTION_TYPES.FACE_EXPRESSIONS) && config.face?.emotion) {
config.face.emotion.enabled = true;
}
const initialHuman = new Human(config);
try {
await initialHuman.load();