remove blazeface-front and add unhandledrejection handler

pull/280/head
Vladimir Mandic 2021-04-25 14:15:38 -04:00
parent 3c11ef4189
commit 5e089f1f12
9 changed files with 34 additions and 7 deletions

View File

@ -12,6 +12,9 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
### **HEAD -> main** 2021/04/25 mandic00@live.com
### **origin/main** 2021/04/25 mandic00@live.com
### **1.7.1** 2021/04/25 mandic00@live.com
- remove obsolete binary models

View File

@ -203,7 +203,7 @@ detectVideo();
Default models in Human library are:
- **Face Detection**: MediaPipe BlazeFace-Back
- **Face Detection**: MediaPipe BlazeFace (Back version)
- **Face Mesh**: MediaPipe FaceMesh
- **Face Description**: HSE FaceRes
- **Face Iris Analysis**: MediaPipe Iris

View File

@ -21,17 +21,19 @@ N/A
### Done
Major configuration simplification:
Configuration simplification:
- Unified minConfidence and scoreThresdold as minConfidence
- Replaced nmsRadius with built-in default
- Replaced maxFaces, maxDetections, maxHands, maxResults with maxDetected
- Remove deallocate, profile, scoped
Stop building sourcemaps for NodeJS deliverables
Build:
- Stop building sourcemaps for NodeJS deliverables
- Build NodeJS deliverables in non-minified form
### TBD
- Remove modelPaths
- Remove blazeface-front, replace blazeface-back with blazeface
- NodeJS Exception handling

View File

@ -52,6 +52,11 @@ async function detect(img) {
}
async function main() {
process.on('unhandledRejection', (err) => {
// @ts-ignore // no idea if exception message is compelte
log.error(err?.message || err || 'no error message');
});
// on worker start first initialize message handler so we don't miss any messages
process.on('message', (msg) => {
if (msg.exit) process.exit(); // if main told worker to exit

View File

@ -45,6 +45,11 @@ function measureLatency() {
}
async function main() {
process.on('unhandledRejection', (err) => {
// @ts-ignore // no idea if exception message is compelte
log.error(err?.message || err || 'no error message');
});
log.header();
log.info('FaceAPI multi-process test');

View File

@ -84,7 +84,12 @@ async function detect(input) {
log.state('Processing:', tensor['shape']);
// run actual detection
const result = await human.detect(tensor, myConfig);
let result;
try {
result = await human.detect(tensor, myConfig);
} catch (err) {
log.error('caught');
}
// dispose image tensor as we no longer need it
tf.dispose(tensor);
@ -97,6 +102,8 @@ async function detect(input) {
const emotion = face.emotion.reduce((prev, curr) => (prev.score > curr.score ? prev : curr));
log.data(` Face: #${i} boxConfidence:${face.boxConfidence} faceConfidence:${face.boxConfidence} age:${face.age} genderConfidence:${face.genderConfidence} gender:${face.gender} emotionScore:${emotion.score} emotion:${emotion.emotion} iris:${face.iris}`);
}
} else {
log.data(' Face: N/A');
}
if (result && result.body && result.body.length > 0) {
for (let i = 0; i < result.body.length; i++) {
@ -134,6 +141,11 @@ async function detect(input) {
}
async function test() {
process.on('unhandledRejection', (err) => {
// @ts-ignore // no idea if exception message is compelte
log.error(err?.message || err || 'no error message');
});
// test with embedded full body image
let result;

File diff suppressed because one or more lines are too long

View File

@ -248,7 +248,7 @@ const config: Config = {
// detector, mesh, iris, age, gender, emotion
// (note: module is not loaded until it is required)
detector: {
modelPath: 'blazeface-back.json', // detector model, can be absolute path or relative to modelBasePath
modelPath: 'blazeface.json', // detector model, can be absolute path or relative to modelBasePath
rotation: false, // use best-guess rotated face image or just box with rotation as-is
// false means higher performance, but incorrect mesh mapping if face angle is above 20 degrees
// this parameter is not valid in nodejs