google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.79k stars 5.18k forks source link

FaceMesh - results.multi_face_landmarks is empty! #2747

Closed zbeedatm closed 3 years ago

zbeedatm commented 3 years ago

Please make sure that this is a solution issue.

System information (Please provide as much relevant information as possible)

  • Have I written custom code (as opposed to using a stock example script provided in Mediapipe): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04, Android 11, iOS 14.4): Windows
  • MediaPipe version: 0.8.9
  • Bazel version:
  • Solution (e.g. FaceMesh, Pose, Holistic): FaceMesh
  • Programming Language and version ( e.g. C++, Python, Java): Python

Describe the expected behavior: the result of face_mesh.process of my images (jpg files extracted from a video) is coming empty (none)!

Standalone code you may have used to try to get what you need :

`IMAGE_FILES = os.listdir(path=PATH) drawing_spec = mp_drawing.DrawingSpec(thickness=1, circle_radius=1) with mp_face_mesh.FaceMesh( static_image_mode=False, max_num_faces=1, refine_landmarks=True, min_detection_confidence=0.5) as face_mesh: for idx, file in enumerate(IMAGE_FILES): image = cv2.imread(PATH + "/" + file)

Convert the BGR image to RGB before processing.

results = face_mesh.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))

# Print and draw face mesh landmarks on the image.
if not results.multi_face_landmarks:
  continue`

If there is a problem, provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Colab/repo link /any notebook:

Other info / Complete Logs : Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached:

zbeedatm commented 3 years ago

I tried with other pictures that I took with laptop webcam with close up to the face and it works fine. The problem is when the face is far from the camera (about 2 meters in my case)... is there a way to optimize it to support such images? what is the minimal distance in order the algorithm can catch the face?

jiuqiant commented 3 years ago

We currently only support switching the detection model in FaceDetection via the model_selection option: https://google.github.io/mediapipe/solutions/face_detection#model_selection. However, we don't have such support in FaceMesh yet.

zbeedatm commented 3 years ago

Ok thanks, closing it.

google-ml-butler[bot] commented 3 years ago

Are you satisfied with the resolution of your issue? Yes No