mirror of https://github.com/vladmandic/human
update todo
parent
13a3a71656
commit
4730e3f542
19
TODO.md
19
TODO.md
|
@ -2,15 +2,24 @@
|
||||||
|
|
||||||
## Big Ticket Items
|
## Big Ticket Items
|
||||||
|
|
||||||
- N/A
|
N/A
|
||||||
|
|
||||||
|
## Exploring Features
|
||||||
|
|
||||||
|
- Detect input from uri
|
||||||
|
- Canvas.js for WASM on NodeJS
|
||||||
|
|
||||||
## Explore Models
|
## Explore Models
|
||||||
|
|
||||||
- InsightFace
|
- InsightFace
|
||||||
RetinaFace detector and ArcFace recognition
|
RetinaFace detector and ArcFace recognition
|
||||||
<https://github.com/deepinsight/insightface>
|
<https://github.com/deepinsight/insightface>
|
||||||
|
- Blazepose
|
||||||
|
Needs detector before running pose to center the image
|
||||||
|
- Efficientpose
|
||||||
|
Needs detector before running pose to center the image
|
||||||
|
|
||||||
## Issues
|
## Soon to be Removed
|
||||||
|
|
||||||
- box sizing on mobile
|
- MobileFace based embedding
|
||||||
- canvas.js for wasm on node
|
- SSR-Net based age&gender
|
||||||
|
|
61
demo/node.js
61
demo/node.js
|
@ -61,46 +61,63 @@ async function detect(input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// decode image using tfjs-node so we don't need external depenencies
|
// decode image using tfjs-node so we don't need external depenencies
|
||||||
|
// can also be done using canvas.js or some other 3rd party image library
|
||||||
const decoded = human.tf.node.decodeImage(buffer);
|
const decoded = human.tf.node.decodeImage(buffer);
|
||||||
const casted = decoded.toFloat();
|
const casted = decoded.toFloat();
|
||||||
const image = casted.expandDims(0);
|
const tensor = casted.expandDims(0);
|
||||||
decoded.dispose();
|
decoded.dispose();
|
||||||
casted.dispose();
|
casted.dispose();
|
||||||
|
|
||||||
// image shape contains image dimensions and depth
|
// image shape contains image dimensions and depth
|
||||||
log.state('Processing:', image.shape);
|
log.state('Processing:', tensor.shape);
|
||||||
|
|
||||||
// run actual detection
|
// run actual detection
|
||||||
const result = await human.detect(image, myConfig);
|
const result = await human.detect(tensor, myConfig);
|
||||||
|
|
||||||
// no need to print results as they are printed to console during detection from within the library due to human.config.debug set
|
|
||||||
// dispose image tensor as we no longer need it
|
// dispose image tensor as we no longer need it
|
||||||
image.dispose();
|
tensor.dispose();
|
||||||
|
|
||||||
// print data to console
|
// print data to console
|
||||||
log.data('Results:');
|
log.data('Results:');
|
||||||
for (let i = 0; i < result.face.length; i++) {
|
if (result && result.face && result.face.length > 0) {
|
||||||
const face = result.face[i];
|
for (let i = 0; i < result.face.length; i++) {
|
||||||
const emotion = face.emotion.reduce((prev, curr) => (prev.score > curr.score ? prev : curr));
|
const face = result.face[i];
|
||||||
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}`);
|
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}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (let i = 0; i < result.body.length; i++) {
|
if (result && result.body && result.body.length > 0) {
|
||||||
const body = result.body[i];
|
for (let i = 0; i < result.body.length; i++) {
|
||||||
log.data(` Body: #${i} score:${body.score}`);
|
const body = result.body[i];
|
||||||
|
log.data(` Body: #${i} score:${body.score}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.data(' Body: N/A');
|
||||||
}
|
}
|
||||||
for (let i = 0; i < result.hand.length; i++) {
|
if (result && result.hand && result.hand.length > 0) {
|
||||||
const hand = result.hand[i];
|
for (let i = 0; i < result.hand.length; i++) {
|
||||||
log.data(` Hand: #${i} confidence:${hand.confidence}`);
|
const hand = result.hand[i];
|
||||||
|
log.data(` Hand: #${i} confidence:${hand.confidence}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.data(' Hand: N/A');
|
||||||
}
|
}
|
||||||
for (let i = 0; i < result.gesture.length; i++) {
|
if (result && result.gesture && result.gesture.length > 0) {
|
||||||
const [key, val] = Object.entries(result.gesture[i]);
|
for (let i = 0; i < result.gesture.length; i++) {
|
||||||
log.data(` Gesture: ${key[0]}#${key[1]} gesture:${val[1]}`);
|
const [key, val] = Object.entries(result.gesture[i]);
|
||||||
|
log.data(` Gesture: ${key[0]}#${key[1]} gesture:${val[1]}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.data(' Gesture: N/A');
|
||||||
}
|
}
|
||||||
for (let i = 0; i < result.object.length; i++) {
|
if (result && result.object && result.object.length > 0) {
|
||||||
const object = result.object[i];
|
for (let i = 0; i < result.object.length; i++) {
|
||||||
log.data(` Object: #${i} score:${object.score} label:${object.label}`);
|
const object = result.object[i];
|
||||||
|
log.data(` Object: #${i} score:${object.score} label:${object.label}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.data(' Object: N/A');
|
||||||
}
|
}
|
||||||
result.face.length = 0;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue