code: def _get_mhp_pairs(folder, split="train"):
      img_paths = []
      mask_paths = []
      img_folder = os.path.join(folder, "images")
      mask_folder = os.path.join(folder, "annotations")
  
      if split == "test":
          img_list = os.path.join(folder, "test_list.txt")
      else:
          img_list = os.path.join(folder, "train_list.txt")
  
      with open(img_list) as txt:
          for filename in txt:
              # record mask paths
              mask_short_path = []
              basename, _ = os.path.splitext(filename)
              for maskname in os.listdir(mask_folder):
                  if maskname.startswith(basename):
                      maskpath = os.path.join(mask_folder, maskname)
                      if os.path.isfile(maskpath):
                          mask_short_path.append(maskpath)
                      else:
                          print("cannot find the mask:", maskpath)
  
              # mask_short_path is not empty
              if mask_short_path:
                  mask_paths.append(mask_short_path)
  
              # record img paths
              imgpath = os.path.join(img_folder, filename.rstrip("\n"))
              if os.path.isfile(imgpath):
                  img_paths.append(imgpath)
              else:
                  print("cannot find the image:", imgpath)
  
      if split == "train":
          img_paths = img_paths[:3000]
          mask_paths = mask_paths[:3000]
      elif split == "val":
          img_paths = img_paths[3001:4000]
          mask_paths = mask_paths[3001:4000]
  
      return img_paths, mask_paths
  
file_path: gluon-cv/gluoncv/data/mhp.py
imports: import os
  import numpy
  from PIL import Image
  from PIL import ImageFile
  import mxnet
  from .segbase import SegmentationDataset
label_desc: Use image node_id 1 for calling a global function with example usage: _get_mhp_pairs(folder, split) and returns: img_paths,  mask_paths