code: def load_images(n_batches=10, sleep=0.0, draw_text=True):
      batch_size = 4
      astronaut = data.astronaut()
      astronaut = ia.imresize_single_image(astronaut, (64, 64))
      kps = ia.KeypointsOnImage(
          [ia.Keypoint(x=15, y=25)], shape=astronaut.shape
      )
  
      counter = 0
      for i in range(n_batches):
          if draw_text:
              batch_images = []
              batch_kps = []
              for b in range(batch_size):
                  astronaut_text = ia.draw_text(
                      astronaut,
                      x=0,
                      y=0,
                      text="%d" % (counter,),
                      color=[0, 255, 0],
                      size=16,
                  )
                  batch_images.append(astronaut_text)
                  batch_kps.append(kps)
                  counter += 1
              batch = ia.Batch(
                  images=np.array(batch_images, dtype=np.uint8),
                  keypoints=batch_kps,
              )
          else:
              if i == 0:
                  batch_images = np.array(
                      [np.copy(astronaut) for _ in range(batch_size)],
                      dtype=np.uint8,
                  )
  
              batch = ia.Batch(
                  images=np.copy(batch_images),
                  keypoints=[kps.deepcopy() for _ in range(batch_size)],
              )
          yield batch
          if sleep > 0:
              time.sleep(sleep)
  
file_path: imgaug/checks/check_multicore_pool.py
imports: from __future__ import print_function, division
  import time
  import multiprocessing
  import numpy
  from skimage import data
  import imgaug
  import imgaug.multicore
  from imgaug import augmenters
label_desc: Use image node_id 2 for calling a global function with example usage: load_images(n_batches, sleep, draw_text) without return types