code: def split_imageset(
      original_dataroot,
      taget_dataroot,
      n_channels=3,
      p_size=800,
      p_overlap=96,
      p_max=1000,
  ):
      """
      split the large images from original_dataroot into small overlapped images with size (p_size)x(p_size),
      and save them into taget_dataroot; only the images with larger size than (p_max)x(p_max)
      will be splitted.
      Args:
          original_dataroot:
          taget_dataroot:
          p_size: size of small images
          p_overlap: patch size in training is a good choice
          p_max: images with smaller size than (p_max)x(p_max) keep unchanged.
      """
      paths = get_image_paths(original_dataroot)
      for img_path in paths:
          # img_name, ext = os.path.splitext(os.path.basename(img_path))
          img = imread_uint(img_path, n_channels=n_channels)
          patches = patches_from_image(img, p_size, p_overlap, p_max)
          imssave(
              patches,
              os.path.join(taget_dataroot, os.path.basename(img_path)),
          )
  
imports: import math
  import os
  import random
  from datetime import datetime
  import cv2
  import numpy
  import torch
  from torchvision.utils import make_grid
label_desc: Use image node_id 9 for calling a global function with example usage: split_imageset(original_dataroot, taget_dataroot, n_channels, p_size, p_overlap, p_max) without return types