code: def load_masks(path, min_side=None):
      fnames = sorted(glob.glob(os.path.join(path, "*.png")))
      frame_list = []
  
      first_frame = np.array(Image.open(fnames[0]))
      binary_mask = first_frame.max() == 255
  
      for i, fname in enumerate(fnames):
          if min_side:
              image = Image.open(fname)
              w, h = image.size
              new_w = w * min_side // min(w, h)
              new_h = h * min_side // min(w, h)
              frame_list.append(
                  np.array(
                      image.resize((new_w, new_h), Image.NEAREST),
                      dtype=np.uint8,
                  )
              )
          else:
              frame_list.append(
                  np.array(Image.open(fname), dtype=np.uint8)
              )
  
      frames = np.stack(frame_list, axis=0)
      if binary_mask:
          frames = (frames > 128).astype(np.uint8)
      return frames
  
file_path: PaddleSeg/EISeg/eiseg/plugin/video/video_tools.py
imports: import glob
  import os
  import cv2
  import numpy
  import paddle
  import paddle.nn.functional
  from PIL import Image
  from eiseg.util.vis import get_palette
label_desc: Use image node_id 2 for calling a global function with example usage: load_masks(path, min_side) and returns: frames