face-api.js
face-api.js copied to clipboard
how to detected the actural physical dimensions ( or the approximate value) of face
eg. get the width of face in cm
just with this model, i don't think anything would make sense as you don't have anything to compare with and have no idea how far is the face from the camera or whats the field of view.
what comes to mind is to use object with known size as anchor and then do simple math to determine size of the face.
for example, human iris is quite stable and iris
model (which augments facemesh
model, not face-api
) is not bad.
so running facemesh
model augmented with iris
model would give size of iris which can be used to infer distance which then can be inferred to calculate scale of the face itself.
if you want to check it out, i've done some work on that to combine different models in https://github.com/vladmandic/human, i might add this as it seems like an interesting problem to solve.
Hi @vladmandic .
Did you end up incorporating detection of distances in your repo? I found it super interesting!!
yes, its been part of https://github.com/vladmandic/human for a while
Hi @vladmandic , I hate to ask this, but could you please point me towards an example? I went through all the wiki pages but couldn't find anything.
If you could point me towards something that will help me learn how to get an approximate distance in millimeters from left iris to right iris, while using your library, I'd be super grateful!
I was doing something similar to the below, but I then realized I was looking at the wrong distance
method.
human.detect(input, userConfig)
.then((result) => {
const annotations = result.face?.[0]?.annotations;
console.log(`DISTANCES`, {
ipd: human.distance(
annotations.leftEyeIris?.[0],
annotations.rightEyeIris?.[0],
)
})
[...]
i've answered in https://github.com/vladmandic/human/discussions/310