code: def main(self, image):
      image = (
          image.pixels_with_channels_at_back()[:, :, ::-1] * 255
      ).astype("uint8")
      hairMask, faceMask = self.getMask(Image.fromarray(image))
      hairMask = transforms.Resize(
          (
              Image.fromarray(image).size[1],
              Image.fromarray(image).size[0],
          )
      )(Image.fromarray((hairMask[:, :, 0] * 255).astype("uint8")))
      faceMask = transforms.Resize(
          (
              Image.fromarray(image).size[1],
              Image.fromarray(image).size[0],
          )
      )(Image.fromarray((faceMask[:, :, 0] * 255).astype("uint8")))
  
      # Additional Morphology
      hairMask = np.array(hairMask) / 255
      faceMask = np.array(faceMask) / 255
      kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (10, 10))
      faceMask = cv2.erode(faceMask, kernel, iterations=1)
      kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (35, 35))
      hairMask = cv2.dilate(hairMask, kernel, iterations=1)
      faceMask = faceMask * (1 - hairMask)
  
      return hairMask, faceMask
  
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 4 for calling the MaskExtractor obj's underlying member method code with example usage: obj.main(image) and returns: hairMask,  faceMask