pntt3011 / mediapipe_face_iris_cpp

Real-time Face and Iris Landmarks Detection using C++
GNU General Public License v3.0
81 stars 15 forks source link

I found that tf models you used in your code is not the same as official tf models #15

Open hu394854434 opened 2 years ago

hu394854434 commented 2 years ago

I don't know if you have done some operation to make your models have the same output as offcial models

pntt3011 commented 2 years ago

Hi @hu394854434, My models are downloaded directly from Mediapipe's official repo. Below are the links to those models, you can use any checksum to verify if they are the same file:

Mediapipe just updated their face landmark model in commit 33d683c, after I created this repo. The other two models are still the same in their latest commit 63e679d.

hu394854434 commented 2 years ago

Thanks for your answer!And there is another question: Besides x\y coordinates,I need z coordinates too.I want the same coordinates as the python mediapipe,and I read the model card of landmark.tflite.In this model card,z is scaled with face width,I don't what the face width is. And I found the Detected Face Roi Width is bigger than the input image width in FaceLandmark.cpp,line 43

pntt3011 commented 2 years ago

Hi @hu394854434, I'm sorry for my late response.

First, according to Face Mesh doc, I don't think the face landmark model alone can produce the real world distance. Thus, you need to use the Face Transform module mentioned in the Face Mesh doc (sorry but I can't help you with this).

Second, the method getInputShape() is the input shape of the model (not the input image), the face width you need is the roi width (in pixel, of course).

However, with iris landmarks, you can get the depth with the assumption that human iris diameter is roughly 11.7mm (just use thales theorem).

hu394854434 commented 2 years ago

I'm sorry for my late response too.

I try to understand the c++ pipeline of mediapipe(like subgraph caculator etc),and I finally found out how the landmark is normalized here