code: def detect_face(
      face_detector: Any,
      detector_backend: str,
      img: np.ndarray,
      align: bool = True,
  ) -> tuple:
      """
      Detect a single face from a given image
      Args:
          face_detector (Any): pre-built face detector object
          detector_backend (str): detector name
          img (np.ndarray): pre-loaded image
          alig (bool): enable or disable alignment after detection
      Returns
          result (tuple): tuple of face (np.ndarray), face region (list)
              , confidence score (float)
      """
      obj = detect_faces(face_detector, detector_backend, img, align)
  
      if len(obj) > 0:
          face, region, confidence = obj[0]  # discard multiple faces
  
      # If no face is detected, set face to None,
      # image region to full image, and confidence to 0.
      else:  # len(obj) == 0
          face = None
          region = [0, 0, img.shape[1], img.shape[0]]
          confidence = 0
  
      return face, region, confidence
  
file_path: deepface/deepface/detectors/FaceDetector.py
imports: from typing import Any, Union
  from PIL import Image
  import numpy
  from deepface.detectors import OpenCvWrapper, SsdWrapper, DlibWrapper, MtcnnWrapper, RetinaFaceWrapper, MediapipeWrapper, YoloWrapper, YunetWrapper, FastMtcnnWrapper
label_desc: Use image node_id 2 for calling a global function with example usage: detect_face(face_detector, detector_backend, img, align) and returns: face,  region,  confidence