code: def extract_faces(
      img_path: Union[str, np.ndarray],
      target_size: Tuple[int, int] = (224, 224),
      detector_backend: str = "opencv",
      enforce_detection: bool = True,
      align: bool = True,
      grayscale: bool = False,
  ) -> List[Dict[str, Any]]:
      """
      This function applies pre-processing stages of a face recognition pipeline
      including detection and alignment
  
      Parameters:
              img_path: exact image path, numpy array (BGR) or base64 encoded image.
              Source image can have many face. Then, result will be the size of number
              of faces appearing in that source image.
  
              target_size (tuple): final shape of facial image. black pixels will be
              added to resize the image.
  
              detector_backend (string): face detection backends are retinaface, mtcnn,
              opencv, ssd or dlib
  
              enforce_detection (boolean): function throws exception if face cannot be
              detected in the fed image. Set this to False if you do not want to get
              an exception and run the function anyway.
  
              align (boolean): alignment according to the eye positions.
  
              grayscale (boolean): extracting faces in rgb or gray scale
  
      Returns:
              list of dictionaries. Each dictionary will have facial image itself,
              extracted area from the original image and confidence score.
  
      """
  
      return detection.extract_faces(
          img_path=img_path,
          target_size=target_size,
          detector_backend=detector_backend,
          enforce_detection=enforce_detection,
          align=align,
          grayscale=grayscale,
      )
  
file_path: deepface/deepface/DeepFace.py
imports: import os
  import warnings
  import logging
  from typing import Any, Dict, List, Tuple, Union
  import numpy
  import pandas
  import tensorflow
  from deprecated import deprecated
  from deepface.commons import functions
  from deepface.commons.logger import Logger
  from deepface.modules import modeling, representation, verification, recognition, demography, detection, realtime
label_desc: Use image node_id 7 for calling a global function with example usage: extract_faces(img_path, target_size, detector_backend, enforce_detection, align, grayscale) and returns: detection