code: def test_face(
      self,
      static_image_mode: bool,
      refine_landmarks: bool,
      num_frames: int,
  ):
      image_path = os.path.join(
          os.path.dirname(__file__), "testdata/portrait.jpg"
      )
      image = cv2.imread(image_path)
      rows, cols, _ = image.shape
      with mp_faces.FaceMesh(
          static_image_mode=static_image_mode,
          refine_landmarks=refine_landmarks,
          min_detection_confidence=0.5,
      ) as faces:
          for idx in range(num_frames):
              results = faces.process(
                  cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
              )
              self._annotate(
                  image.copy(), results, idx, refine_landmarks
              )
              multi_face_landmarks = []
              for landmarks in results.multi_face_landmarks:
                  self.assertLen(
                      landmarks.landmark,
                      mp_faces.FACEMESH_NUM_LANDMARKS_WITH_IRISES
                      if refine_landmarks
                      else mp_faces.FACEMESH_NUM_LANDMARKS,
                  )
                  x = [
                      landmark.x * cols
                      for landmark in landmarks.landmark
                  ]
                  y = [
                      landmark.y * rows
                      for landmark in landmarks.landmark
                  ]
                  face_landmarks = np.column_stack((x, y))
                  multi_face_landmarks.append(face_landmarks)
              self.assertLen(multi_face_landmarks, 1)
              # Verify the eye landmarks are correct as sanity check.
              for eye_idx, gt_lds in EYE_INDICES_TO_LANDMARKS.items():
                  prediction_error = np.abs(
                      np.asarray(multi_face_landmarks[0][eye_idx])
                      - np.asarray(gt_lds)
                  )
                  npt.assert_array_less(
                      prediction_error, DIFF_THRESHOLD
                  )
              if refine_landmarks:
                  for (
                      iris_idx,
                      gt_lds,
                  ) in IRIS_INDICES_TO_LANDMARKS.items():
                      prediction_error = np.abs(
                          np.asarray(multi_face_landmarks[0][iris_idx])
                          - np.asarray(gt_lds)
                      )
                      npt.assert_array_less(
                          prediction_error, DIFF_THRESHOLD
                      )
  
file_path: mediapipe/mediapipe/python/solutions/face_mesh_test.py
imports: import os
  import tempfile
  from typing import NamedTuple
  from absl.testing import absltest
  from absl.testing import parameterized
  import cv2
  import numpy
  import numpy.testing
  from mediapipe.python.solutions import drawing_styles
  from mediapipe.python.solutions import drawing_utils
  from mediapipe.python.solutions import face_mesh
label_desc: Use image node_id 4 for calling the FaceMeshTest obj's underlying member method code with example usage: obj.test_face(static_image_mode, refine_landmarks, num_frames) without return types