face-api.js icon indicating copy to clipboard operation
face-api.js copied to clipboard

how to detected the actural physical dimensions ( or the approximate value) of face

Open minzojian opened this issue 4 years ago • 5 comments

eg. get the width of face in cm

minzojian avatar Feb 03 '21 01:02 minzojian

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.

vladmandic avatar Feb 04 '21 18:02 vladmandic

Hi @vladmandic .

Did you end up incorporating detection of distances in your repo? I found it super interesting!!

Jeandcc avatar Nov 11 '22 14:11 Jeandcc

yes, its been part of https://github.com/vladmandic/human for a while

vladmandic avatar Nov 11 '22 14:11 vladmandic

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],
          )
        })
        [...]

Jeandcc avatar Nov 14 '22 21:11 Jeandcc