code: def preprocess(image, size=256, normalize=1):
      if size is None:
          image = transforms.Resize((1024, 1024))(image)
      else:
          image = transforms.Resize((size, size))(image)
      image = transforms.ToTensor()(image)
      if normalize is not None:
          image = transforms.Normalize(
              [0.5, 0.5, 0.5], [0.5, 0.5, 0.5]
          )(image)
      return image
  
file_path: insightface/reconstruction/ostec/external/graphonomy/FaceHairMask/MaskExtractor.py
imports: import torch
  from PIL import Image
  from torchvision.transforms import transforms
  from FaceHairMask import deeplab_xception_transfer
  from FaceHairMask.graphonomy_inference import inference
  import numpy
  import cv2
label_desc: Use image node_id 1 for calling a global function with example usage: preprocess(image, size, normalize) and returns: image