code: def boundary_regularization(
      contour, mask_shape, W: int = 32
  ) -> np.ndarray:
      new_contour = _coarse(contour, mask_shape)  # coarse
      if new_contour is not None:
          contour = _fine(new_contour, W)  # fine
      return contour
  
file_path: PaddleSeg/EISeg/eiseg/util/regularization/rs_regularization.py
imports: import math
  import cv2
  import numpy
  from .utils import calc_distance
label_desc: Use image node_id 1 for calling a global function with example usage: boundary_regularization(contour, mask_shape, W) and returns: contour