docstr: Predict the landmarks for each face present in the image.
  
  This function predicts a set of 68 2D or 3D images, one for each image in a batch in parallel.
  If detect_faces is None the method will also run a face detector.
  
   Arguments:
      image_batch {torch.tensor} -- The input images batch
  
  Keyword Arguments:
      detected_faces {list of numpy.array} -- list of bounding boxes, one for each face found
      in the image (default: {None})
      return_bboxes {boolean} -- If True, return the face bounding boxes in addition to the keypoints.
      return_landmark_score {boolean} -- If True, return the keypoint scores along with the keypoints.
  
  Return:
      result:
          1. if both return_bboxes and return_landmark_score are False, result will be:
              landmarks
          2. Otherwise, result will be one of the following, depending on the actual value of return_* arguments.
              (landmark, landmark_score, detected_face)
              (landmark, None,           detected_face)
              (landmark, landmark_score, None         )
docstr_tok: ["Predict","the","landmarks","for","each","face","present","in","the","image",".","This","function","predicts","a","set","of","68","2D","or","3D","images",",","one","for","each","image","in","a","batch","in","parallel",".","If","detect_faces","is","None","the","method","will","also","run","a","face","detector",".","Arguments",":","image_batch","{","torch.tensor","}","--","The","input","images","batch","Keyword","Arguments",":","detected_faces","{","list","of","numpy.array","}","--","list","of","bounding","boxes",",","one","for","each","face","found","in","the","image","(","default",":","{","None","}",")","return_bboxes","{","boolean","}","--","If","True",",","return","the","face","bounding","boxes","in","addition","to","the","keypoints",".","return_landmark_score","{","boolean","}","--","If","True",",","return","the","keypoint","scores","along","with","the","keypoints",".","Return",":","result",":","1.","if","both","return_bboxes","and","return_landmark_score","are","False",",","result","will","be",":","landmarks","2",".","Otherwise",",","result","will","be","one","of","the","following",",","depending","on","the","actual","value","of","return_","*","arguments",".","(","landmark",",","landmark_score",",","detected_face",")","(","landmark",",","None",",","detected_face",")","(","landmark",",","landmark_score",",","None",")"]
code: def get_landmarks_from_batch(
      self,
      image_batch,
      detected_faces=None,
      return_bboxes=False,
      return_landmark_score=False,
  ):
      """Predict the landmarks for each face present in the image.
  
      This function predicts a set of 68 2D or 3D images, one for each image in a batch in parallel.
      If detect_faces is None the method will also run a face detector.
  
       Arguments:
          image_batch {torch.tensor} -- The input images batch
  
      Keyword Arguments:
          detected_faces {list of numpy.array} -- list of bounding boxes, one for each face found
          in the image (default: {None})
          return_bboxes {boolean} -- If True, return the face bounding boxes in addition to the keypoints.
          return_landmark_score {boolean} -- If True, return the keypoint scores along with the keypoints.
  
      Return:
          result:
              1. if both return_bboxes and return_landmark_score are False, result will be:
                  landmarks
              2. Otherwise, result will be one of the following, depending on the actual value of return_* arguments.
                  (landmark, landmark_score, detected_face)
                  (landmark, None,           detected_face)
                  (landmark, landmark_score, None         )
      """
  
      if detected_faces is None:
          detected_faces = self.face_detector.detect_from_batch(
              image_batch
          )
  
      if len(detected_faces) == 0:
          warnings.warn("No faces were detected.")
          if return_bboxes or return_landmark_score:
              return None, None, None
          else:
              return None
  
      landmarks = []
      landmarks_scores_list = []
      # A batch for each frame
      for i, faces in enumerate(detected_faces):
          res = self.get_landmarks_from_image(
              image_batch[i].cpu().numpy().transpose(1, 2, 0),
              detected_faces=faces,
              return_landmark_score=return_landmark_score,
          )
          if return_landmark_score:
              landmark_set, landmarks_scores, _ = res
              landmarks_scores_list.append(landmarks_scores)
          else:
              landmark_set = res
          # Bacward compatibility
          if landmark_set is not None:
              landmark_set = np.concatenate(landmark_set, axis=0)
          else:
              landmark_set = []
          landmarks.append(landmark_set)
  
      if not return_bboxes:
          detected_faces = None
      if not return_landmark_score:
          landmarks_scores_list = None
      if return_bboxes or return_landmark_score:
          return landmarks, landmarks_scores_list, detected_faces
      else:
          return landmarks
  
file_path: face-alignment/face_alignment/api.py
imports: import torch
  import warnings
  from enum import IntEnum
  from skimage import io
  import numpy
  from packaging import version
  from tqdm import tqdm
  from .utils import *
  from .folder_data import FolderData
label_desc: Use image node_id 4 for calling the FaceAlignment obj's underlying member method code with example usage: obj.get_landmarks_from_batch(image_batch, detected_faces, return_bboxes, return_landmark_score) and returns: landmarks,  landmarks_scores_list,  detected_faces, landmarks, None,  None,  None, None