code: def split_image_into_overlapping_patches(
      image_array, patch_size, padding_size=2
  ):
      """Splits the image into partially overlapping patches.
  
      The patches overlap by padding_size pixels.
  
      Pads the image twice:
          - first to have a size multiple of the patch size,
          - then to have equal padding at the borders.
  
      Args:
          image_array: numpy array of the input image.
          patch_size: size of the patches from the original image (without padding).
          padding_size: size of the overlapping area.
      """
  
      xmax, ymax, _ = image_array.shape
      x_remainder = xmax % patch_size
      y_remainder = ymax % patch_size
  
      # modulo here is to avoid extending of patch_size instead of 0
      x_extend = (patch_size - x_remainder) % patch_size
      y_extend = (patch_size - y_remainder) % patch_size
  
      # make sure the image is divisible into regular patches
      extended_image = np.pad(
          image_array, ((0, x_extend), (0, y_extend), (0, 0)), "edge"
      )
  
      # add padding around the image to simplify computations
      padded_image = pad_patch(
          extended_image, padding_size, channel_last=True
      )
  
      xmax, ymax, _ = padded_image.shape
      patches = []
  
      x_lefts = range(padding_size, xmax - padding_size, patch_size)
      y_tops = range(padding_size, ymax - padding_size, patch_size)
  
      for x in x_lefts:
          for y in y_tops:
              x_left = x - padding_size
              y_top = y - padding_size
              x_right = x + patch_size + padding_size
              y_bottom = y + patch_size + padding_size
              patch = padded_image[x_left:x_right, y_top:y_bottom, :]
              patches.append(patch)
  
      return np.array(patches), padded_image.shape
  
imports: import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: split_image_into_overlapping_patches(image_array, patch_size, padding_size) and returns: np,  padded_image