class_docstr: Utility for iterating over an image dataset to get mini-batches.
  
  Args:
      img_list_file(str): name of the file containing image meta data; each
                          line consists of image_path_suffix delimiter meta_info,
                          where meta info could be label index or label strings, etc.
                          meta_info should not contain the delimiter. If the meta_info
                          of each image is just the label index, then we will parse the
                          label index into a numpy array with length=batchsize
                          (for compatibility); otherwise, we return a list of meta_info;
                          if meta info is available, we return a list of None.
      batch_size(int): num of samples in one mini-batch
      image_transform: a function for image augmentation; it accepts the full
                      image path and outputs a list of augmented images.
      shuffle(boolean): True for shuffling images in the list
      delimiter(char): delimiter between image_path_suffix and label, e.g.,
                       space or comma
      image_folder(boolean): prefix of the image path
      capacity(int): the max num of mini-batches in the internal queue.
code: def run(self):
      img_list = []
      is_label_index = True
      for line in open(self.img_list_file, "r"):
          item = line.strip("\n").split(self.delimiter)
          if len(item) < 2:
              is_label_index = False
              img_list.append((item[0].strip(), None))
          else:
              if not item[1].strip().isdigit():
                  # the meta info is not label index
                  is_label_index = False
              img_list.append((item[0].strip(), item[1].strip()))
      index = 0  # index for the image
      if self.shuffle:
          random.shuffle(img_list)
      while not self.stop:
          if not self.queue.full():
              x, y = [], []
              i = 0
              while i < self.batch_size:
                  img_path, img_meta = img_list[index]
                  aug_images = self.image_transform(
                      os.path.join(self.image_folder, img_path)
                  )
                  assert (
                      i + len(aug_images) <= self.batch_size
                  ), "too many images (%d) in a batch (%d)" % (
                      i + len(aug_images),
                      self.batch_size,
                  )
                  for img in aug_images:
                      ary = np.asarray(
                          img.convert("RGB"), dtype=np.float32
                      )
                      x.append(ary.transpose(2, 0, 1))
                      if is_label_index:
                          y.append(int(img_meta))
                      else:
                          y.append(img_meta)
                      i += 1
                  index += 1
                  if index == self.num_samples:
                      index = 0  # reset to the first image
                      if self.shuffle:
                          random.shuffle(img_list)
              # enqueue one mini-batch
              if is_label_index:
                  self.queue.put(
                      (np.asarray(x), np.asarray(y, dtype=np.int32))
                  )
              else:
                  self.queue.put((np.asarray(x), y))
          else:
              time.sleep(0.1)
      return
  
file_path: singa/python/singa/data.py
imports: from __future__ import print_function
  from __future__ import absolute_import
  from builtins import range
  from builtins import object
  import os
  import random
  import time
  from multiprocessing import Process, Queue
  import numpy
label_desc: Use image node_id 5 for calling the ImageBatchIter obj's underlying member method code with example usage: obj.run() without return types