code: def analyze(
      img_path: Union[str, np.ndarray],
      actions: Union[tuple, list] = (
          "emotion",
          "age",
          "gender",
          "race",
      ),
      enforce_detection: bool = True,
      detector_backend: str = "opencv",
      align: bool = True,
      silent: bool = False,
  ) -> List[Dict[str, Any]]:
      """
      This function analyzes facial attributes including age, gender, emotion and race.
      In the background, analysis function builds convolutional neural network models to
      classify age, gender, emotion and race of the input image.
  
      Parameters:
              img_path: exact image path, numpy array (BGR) or base64 encoded image could be passed.
              If source image has more than one face, then result will be size of number of faces
              appearing in the image.
  
              actions (tuple): The default is ('age', 'gender', 'emotion', 'race'). You can drop
              some of those attributes.
  
              enforce_detection (bool): The function throws exception if no face detected by default.
              Set this to False if you don't want to get exception. This might be convenient for low
              resolution images.
  
              detector_backend (string): set face detector backend to opencv, retinaface, mtcnn, ssd,
              dlib, mediapipe or yolov8.
  
              align (boolean): alignment according to the eye positions.
  
              silent (boolean): disable (some) log messages
  
      Returns:
              The function returns a list of dictionaries for each face appearing in the image.
  
              [
                      {
                              "region": {'x': 230, 'y': 120, 'w': 36, 'h': 45},
                              "age": 28.66,
                              'face_confidence': 0.9993908405303955,
                              "dominant_gender": "Woman",
                              "gender": {
                                      'Woman': 99.99407529830933,
                                      'Man': 0.005928758764639497,
                              }
                              "dominant_emotion": "neutral",
                              "emotion": {
                                      'sad': 37.65260875225067,
                                      'angry': 0.15512987738475204,
                                      'surprise': 0.0022171278033056296,
                                      'fear': 1.2489334680140018,
                                      'happy': 4.609785228967667,
                                      'disgust': 9.698561953541684e-07,
                                      'neutral': 56.33133053779602
                              }
                              "dominant_race": "white",
                              "race": {
                                      'indian': 0.5480832420289516,
                                      'asian': 0.7830780930817127,
                                      'latino hispanic': 2.0677512511610985,
                                      'black': 0.06337375962175429,
                                      'middle eastern': 3.088453598320484,
                                      'white': 93.44925880432129
                              }
                      }
              ]
      """
      return demography.analyze(
          img_path=img_path,
          actions=actions,
          enforce_detection=enforce_detection,
          detector_backend=detector_backend,
          align=align,
          silent=silent,
      )
  
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 3 for calling a global function with example usage: analyze(img_path, actions, enforce_detection, detector_backend, align, silent) and returns: demography