code: def face_align_landmark(
      img, landmark, image_size=(112, 112), method="similar"
  ):
      tform = (
          transform.AffineTransform()
          if method == "affine"
          else transform.SimilarityTransform()
      )
      src = np.array(
          [
              [38.2946, 51.6963],
              [73.5318, 51.5014],
              [56.0252, 71.7366],
              [41.5493, 92.3655],
              [70.729904, 92.2041],
          ],
          dtype=np.float32,
      )
      tform.estimate(landmark, src)
      # ndimage = transform.warp(img, tform.inverse, output_shape=image_size)
      # ndimage = (ndimage * 255).astype(np.uint8)
      M = tform.params[0:2, :]
      ndimage = cv2.warpAffine(img, M, image_size, borderValue=0.0)
      if len(ndimage.shape) == 2:
          ndimage = np.stack([ndimage, ndimage, ndimage], -1)
      else:
          ndimage = cv2.cvtColor(ndimage, cv2.COLOR_BGR2RGB)
      return ndimage
  
imports: import os
  import cv2
  import numpy
  import pandas
  from tqdm import tqdm
  from skimage import transform
  from sklearn.preprocessing import normalize
  from sklearn.metrics import roc_curve, auc
label_desc: Use image node_id 2 for calling a global function with example usage: face_align_landmark(img, landmark, image_size, method) and returns: ndimage