code: def transform_parsing(pred, center, scale, width, height, input_size):
      if center is not None:
          trans = get_affine_transform(
              center, scale, 0, input_size, inv=1
          )
          target_pred = cv2.warpAffine(
              pred,
              trans,
              (int(width), int(height)),  # (int(width), int(height)),
              flags=cv2.INTER_NEAREST,
              borderMode=cv2.BORDER_CONSTANT,
              borderValue=(0),
          )
      else:
          target_pred = cv2.resize(
              pred,
              (int(width), int(height)),
              interpolation=cv2.INTER_NEAREST,
          )
  
      return target_pred
  
file_path: insightface/parsing/dml_csr/utils/transforms.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import cv2
label_desc: Use image node_id 2 for calling a global function with example usage: transform_parsing(pred, center, scale, width, height, input_size) and returns: target_pred