code: def check_size_minmax(polygons, img_size):
      h_max, w_max = img_size
      for ps in polygons:
          for j in range(len(ps)):
              x, y = ps[j]
              if x < 0:
                  x = 0
              elif x > w_max:
                  x = w_max
              if y < 0:
                  y = 0
              elif y > h_max:
                  y = h_max
              ps[j] = np.array([x, y])
      return polygons
  
file_path: PaddleSeg/EISeg/eiseg/util/polygon.py
imports: from enum import Enum
  import cv2
  import numpy
  import math
  from .regularization import boundary_regularization
label_desc: Use image node_id 7 for calling a global function with example usage: check_size_minmax(polygons, img_size) and returns: polygons