mirror of https://github.com/vladmandic/human
remove blazeface-front and add unhandledrejection handler
parent
66054542c2
commit
835bc65c00
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
8
TODO.md
8
TODO.md
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
14
demo/node.js
14
demo/node.js
|
@ -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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -44,22 +44,19 @@ const config = {
|
|||
banner,
|
||||
tsconfig: 'server/tfjs-tsconfig.json',
|
||||
logLevel: 'error',
|
||||
bundle: true,
|
||||
metafile: true,
|
||||
target: 'es2018',
|
||||
},
|
||||
debug: {
|
||||
minifyWhitespace: false,
|
||||
minifyIdentifiers: false,
|
||||
minifySyntax: false,
|
||||
bundle: true,
|
||||
metafile: true,
|
||||
target: 'es2018',
|
||||
},
|
||||
production: {
|
||||
minifyWhitespace: true,
|
||||
minifyIdentifiers: true,
|
||||
minifySyntax: true,
|
||||
bundle: true,
|
||||
metafile: true,
|
||||
target: 'es2018',
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -80,6 +77,9 @@ const targets = {
|
|||
outfile: 'dist/human.node.js',
|
||||
external: ['@tensorflow'],
|
||||
sourcemap: false,
|
||||
minifyWhitespace: false,
|
||||
minifyIdentifiers: false,
|
||||
minifySyntax: false,
|
||||
},
|
||||
},
|
||||
nodeGPU: {
|
||||
|
@ -98,6 +98,9 @@ const targets = {
|
|||
outfile: 'dist/human.node-gpu.js',
|
||||
external: ['@tensorflow'],
|
||||
sourcemap: false,
|
||||
minifyWhitespace: false,
|
||||
minifyIdentifiers: false,
|
||||
minifySyntax: false,
|
||||
},
|
||||
},
|
||||
nodeWASM: {
|
||||
|
@ -116,6 +119,9 @@ const targets = {
|
|||
outfile: 'dist/human.node-wasm.js',
|
||||
external: ['@tensorflow'],
|
||||
sourcemap: false,
|
||||
minifyWhitespace: false,
|
||||
minifyIdentifiers: false,
|
||||
minifySyntax: false,
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -270,3 +270,54 @@
|
|||
2021-04-25 13:13:08 [36mINFO: [39m Generate types: ["src/human.ts"]
|
||||
2021-04-25 13:13:12 [36mINFO: [39m Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-04-25 13:13:12 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"]
|
||||
2021-04-25 13:58:37 [36mINFO: [39m @vladmandic/human version 1.8.0
|
||||
2021-04-25 13:58:37 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.0.0
|
||||
2021-04-25 13:58:37 [36mINFO: [39m Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true,"bundle":true,"metafile":true,"target":"es2018"}
|
||||
2021-04-25 13:58:37 [35mSTATE:[39m Build for: node type: tfjs: {"imports":1,"importBytes":39,"outputBytes":696,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 13:58:37 [35mSTATE:[39m Build for: node type: node: {"imports":35,"importBytes":514853,"outputBytes":294828,"outputFiles":"dist/human.node.js"}
|
||||
2021-04-25 13:58:37 [35mSTATE:[39m Build for: nodeGPU type: tfjs: {"imports":1,"importBytes":43,"outputBytes":700,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 13:58:37 [35mSTATE:[39m Build for: nodeGPU type: node: {"imports":35,"importBytes":514857,"outputBytes":294832,"outputFiles":"dist/human.node-gpu.js"}
|
||||
2021-04-25 13:58:37 [35mSTATE:[39m Build for: nodeWASM type: tfjs: {"imports":1,"importBytes":81,"outputBytes":746,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 13:58:37 [35mSTATE:[39m Build for: nodeWASM type: node: {"imports":35,"importBytes":514903,"outputBytes":294875,"outputFiles":"dist/human.node-wasm.js"}
|
||||
2021-04-25 13:58:37 [35mSTATE:[39m Build for: browserNoBundle type: tfjs: {"imports":1,"importBytes":2488,"outputBytes":1394,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 13:58:37 [35mSTATE:[39m Build for: browserNoBundle type: esm: {"imports":35,"importBytes":515551,"outputBytes":295025,"outputFiles":"dist/human.esm-nobundle.js"}
|
||||
2021-04-25 13:58:38 [35mSTATE:[39m Build for: browserBundle type: tfjs: {"modules":1267,"moduleBytes":4085087,"imports":7,"importBytes":2488,"outputBytes":1101728,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 13:58:39 [35mSTATE:[39m Build for: browserBundle type: iife: {"imports":35,"importBytes":1615885,"outputBytes":1393158,"outputFiles":"dist/human.js"}
|
||||
2021-04-25 13:58:40 [35mSTATE:[39m Build for: browserBundle type: esm: {"imports":35,"importBytes":1615885,"outputBytes":1393116,"outputFiles":"dist/human.esm.js"}
|
||||
2021-04-25 13:58:40 [36mINFO: [39m Generate types: ["src/human.ts"]
|
||||
2021-04-25 13:58:44 [36mINFO: [39m Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-04-25 13:58:44 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"]
|
||||
2021-04-25 14:02:03 [36mINFO: [39m @vladmandic/human version 1.8.0
|
||||
2021-04-25 14:02:03 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.0.0
|
||||
2021-04-25 14:02:03 [36mINFO: [39m Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
|
||||
2021-04-25 14:02:03 [35mSTATE:[39m Build for: node type: tfjs: {"imports":1,"importBytes":39,"outputBytes":696,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 14:02:03 [35mSTATE:[39m Build for: node type: node: {"imports":35,"importBytes":514853,"outputBytes":474171,"outputFiles":"dist/human.node.js"}
|
||||
2021-04-25 14:02:03 [35mSTATE:[39m Build for: nodeGPU type: tfjs: {"imports":1,"importBytes":43,"outputBytes":700,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 14:02:03 [35mSTATE:[39m Build for: nodeGPU type: node: {"imports":35,"importBytes":514857,"outputBytes":474175,"outputFiles":"dist/human.node-gpu.js"}
|
||||
2021-04-25 14:02:03 [35mSTATE:[39m Build for: nodeWASM type: tfjs: {"imports":1,"importBytes":81,"outputBytes":746,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 14:02:03 [35mSTATE:[39m Build for: nodeWASM type: node: {"imports":35,"importBytes":514903,"outputBytes":474225,"outputFiles":"dist/human.node-wasm.js"}
|
||||
2021-04-25 14:02:03 [35mSTATE:[39m Build for: browserNoBundle type: tfjs: {"imports":1,"importBytes":2488,"outputBytes":1394,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 14:02:03 [35mSTATE:[39m Build for: browserNoBundle type: esm: {"imports":35,"importBytes":515551,"outputBytes":295025,"outputFiles":"dist/human.esm-nobundle.js"}
|
||||
2021-04-25 14:02:04 [35mSTATE:[39m Build for: browserBundle type: tfjs: {"modules":1267,"moduleBytes":4085087,"imports":7,"importBytes":2488,"outputBytes":1101728,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 14:02:04 [35mSTATE:[39m Build for: browserBundle type: iife: {"imports":35,"importBytes":1615885,"outputBytes":1393158,"outputFiles":"dist/human.js"}
|
||||
2021-04-25 14:02:05 [35mSTATE:[39m Build for: browserBundle type: esm: {"imports":35,"importBytes":1615885,"outputBytes":1393116,"outputFiles":"dist/human.esm.js"}
|
||||
2021-04-25 14:02:05 [36mINFO: [39m Generate types: ["src/human.ts"]
|
||||
2021-04-25 14:02:09 [36mINFO: [39m Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-04-25 14:02:09 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"]
|
||||
2021-04-25 14:09:15 [36mINFO: [39m @vladmandic/human version 1.8.0
|
||||
2021-04-25 14:09:15 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.0.0
|
||||
2021-04-25 14:09:15 [36mINFO: [39m Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
|
||||
2021-04-25 14:09:15 [35mSTATE:[39m Build for: node type: tfjs: {"imports":1,"importBytes":39,"outputBytes":696,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 14:09:15 [35mSTATE:[39m Build for: node type: node: {"imports":35,"importBytes":514853,"outputBytes":474171,"outputFiles":"dist/human.node.js"}
|
||||
2021-04-25 14:09:15 [35mSTATE:[39m Build for: nodeGPU type: tfjs: {"imports":1,"importBytes":43,"outputBytes":700,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 14:09:15 [35mSTATE:[39m Build for: nodeGPU type: node: {"imports":35,"importBytes":514857,"outputBytes":474175,"outputFiles":"dist/human.node-gpu.js"}
|
||||
2021-04-25 14:09:15 [35mSTATE:[39m Build for: nodeWASM type: tfjs: {"imports":1,"importBytes":81,"outputBytes":746,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 14:09:15 [35mSTATE:[39m Build for: nodeWASM type: node: {"imports":35,"importBytes":514903,"outputBytes":474225,"outputFiles":"dist/human.node-wasm.js"}
|
||||
2021-04-25 14:09:15 [35mSTATE:[39m Build for: browserNoBundle type: tfjs: {"imports":1,"importBytes":2488,"outputBytes":1394,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 14:09:15 [35mSTATE:[39m Build for: browserNoBundle type: esm: {"imports":35,"importBytes":515551,"outputBytes":295025,"outputFiles":"dist/human.esm-nobundle.js"}
|
||||
2021-04-25 14:09:16 [35mSTATE:[39m Build for: browserBundle type: tfjs: {"modules":1267,"moduleBytes":4085087,"imports":7,"importBytes":2488,"outputBytes":1101728,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-04-25 14:09:16 [35mSTATE:[39m Build for: browserBundle type: iife: {"imports":35,"importBytes":1615885,"outputBytes":1393158,"outputFiles":"dist/human.js"}
|
||||
2021-04-25 14:09:17 [35mSTATE:[39m Build for: browserBundle type: esm: {"imports":35,"importBytes":1615885,"outputBytes":1393116,"outputFiles":"dist/human.esm.js"}
|
||||
2021-04-25 14:09:17 [36mINFO: [39m Generate types: ["src/human.ts"]
|
||||
2021-04-25 14:09:21 [36mINFO: [39m Update Change log: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-04-25 14:09:21 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue