code: def get_recognizer_image_generator(
      labels, height, width, alphabet, augmenter=None, shuffle=True
  ):
      """Generate augmented (image, text) tuples from a list
      of (filepath, box, label) tuples.
  
      Args:
          labels: A list of (filepath, box, label) tuples
          height: The height of the images to return
          width: The width of the images to return
          alphabet: The alphabet which limits the characters returned
          augmenter: The augmenter to apply to images
          shuffle: Whether to shuffle the dataset on each iteration
      """
      n_with_illegal_characters = sum(
          any(c not in alphabet for c in text) for _, _, text in labels
      )
      if n_with_illegal_characters > 0:
          print(
              f"{n_with_illegal_characters} / {len(labels)} instances have illegal characters."
          )
      labels = labels.copy()
      for index in itertools.cycle(range(len(labels))):
          if index == 0 and shuffle:
              random.shuffle(labels)
          filepath, box, text = labels[index]
          cval = typing.cast(
              int,
              np.random.randint(low=0, high=255, size=3).astype(
                  "uint8"
              ),
          )
          if box is not None:
              image = tools.warpBox(
                  image=tools.read(filepath),
                  box=box.astype("float32"),
                  target_height=height,
                  target_width=width,
                  cval=cval,
              )
          else:
              image = tools.read_and_fit(
                  filepath_or_array=filepath,
                  width=width,
                  height=height,
                  cval=cval,
              )
          text = "".join([c for c in text if c in alphabet])
          if not text:
              continue
          if augmenter:
              image = augmenter.augment_image(image)
          yield (image, text)
  
imports: import concurrent.futures
  import itertools
  import warnings
  import typing
  import zipfile
  import random
  import glob
  import json
  import os
  import tqdm
  import imgaug
  import PIL.Image
  import numpy
  from .None import tools
label_desc: Use image node_id 8 for calling a global function with example usage: get_recognizer_image_generator(labels, height, width, alphabet, augmenter, shuffle) without return types