code: def verify(
      img1_path: Union[str, np.ndarray],
      img2_path: Union[str, np.ndarray],
      model_name: str = "VGG-Face",
      detector_backend: str = "opencv",
      distance_metric: str = "cosine",
      enforce_detection: bool = True,
      align: bool = True,
      normalization: str = "base",
  ) -> Dict[str, Any]:
      """
      This function verifies an image pair is same person or different persons. In the background,
      verification function represents facial images as vectors and then calculates the similarity
      between those vectors. Vectors of same person images should have more similarity (or less
      distance) than vectors of different persons.
  
      Parameters:
              img1_path, img2_path: exact image path as string. numpy array (BGR) or based64 encoded
              images are also welcome. If one of pair has more than one face, then we will compare the
              face pair with max similarity.
  
              model_name (str): VGG-Face, Facenet, Facenet512, OpenFace, DeepFace, DeepID, Dlib
              , ArcFace and SFace
  
              distance_metric (string): cosine, euclidean, euclidean_l2
  
              enforce_detection (boolean): If no face could not be detected in an image, then this
              function will return exception by default. Set this to False not to have this 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.
  
              normalization (string): normalize the input image before feeding to model
  
      Returns:
              Verify function returns a dictionary.
  
              {
                      "verified": True
                      , "distance": 0.2563
                      , "max_threshold_to_verify": 0.40
                      , "model": "VGG-Face"
                      , "similarity_metric": "cosine"
                      , 'facial_areas': {
                              'img1': {'x': 345, 'y': 211, 'w': 769, 'h': 769},
                              'img2': {'x': 318, 'y': 534, 'w': 779, 'h': 779}
                      }
                      , "time": 2
              }
  
      """
  
      return verification.verify(
          img1_path=img1_path,
          img2_path=img2_path,
          model_name=model_name,
          detector_backend=detector_backend,
          distance_metric=distance_metric,
          enforce_detection=enforce_detection,
          align=align,
          normalization=normalization,
      )
  
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 2 for calling a global function with example usage: verify(img1_path, img2_path, model_name, detector_backend, distance_metric, enforce_detection, align, normalization) and returns: verification