code: def load_images(n_batches=10, sleep=0.0):
      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):
          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,
          )
          yield batch
          if sleep > 0:
              time.sleep(sleep)
  
file_path: imgaug/checks/check_background_augmentation.py
imports: from __future__ import print_function, division
  import time
  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) without return types