class_docstr: Wrapper around ``multiprocessing.Pool`` for multicore augmentation.
  
  Parameters
  ----------
  augseq : imgaug.augmenters.meta.Augmenter
      The augmentation sequence to apply to batches.
  
  processes : None or int, optional
      The number of background workers, similar to the same parameter in
      multiprocessing.Pool. If ``None``, the number of the machine's CPU
      cores will be used (this counts hyperthreads as CPU cores). If this is
      set to a negative value ``p``, then ``P - abs(p)`` will be used,
      where ``P`` is the number of CPU cores. E.g. ``-1`` would use all
      cores except one (this is useful to e.g. reserve one core to feed
      batches to the GPU).
  
  maxtasksperchild : None or int, optional
      The number of tasks done per worker process before the process is
      killed and restarted, similar to the same parameter in
      multiprocessing.Pool. If ``None``, worker processes will not be
      automatically restarted.
  
  seed : None or int, optional
      The seed to use for child processes. If ``None``, a random seed will
      be used.
docstr: Augment batches from a generator.
  
  Pattern for output buffer constraint is from
  https://stackoverflow.com/a/47058399.
  
  Parameters
  ----------
  batches : generator of imgaug.augmentables.batches.Batch
      The batches to augment, provided as a generator. Each call to the
      generator should yield exactly one batch.
  
  chunksize : None or int, optional
      Rough indicator of how many tasks should be sent to each worker.
      Increasing this number can improve performance.
  
  output_buffer_size : None or int, optional
      Max number of batches to handle *at the same time* in the *whole*
      pipeline (including already augmented batches that are waiting to
      be requested). If the buffer size is reached, no new batches will
      be loaded from `batches` until a produced (i.e. augmented) batch is
      consumed (i.e. requested from this method).
      The buffer is unlimited if this is set to ``None``. For large
      datasets, this should be set to an integer value to avoid filling
      the whole RAM if loading+augmentation happens faster than training.
  
      *New in version 0.3.0.*
  
  Yields
  ------
  imgaug.augmentables.batches.Batch
      Augmented batch.
docstr_tok: ["Augment","batches","from","a","generator",".","Pattern","for","output","buffer","constraint","is","from","https",":","\/\/stackoverflow.com\/a\/47058399",".","Parameters","--","--","--","--","--","batches",":","generator","of","imgaug.augmentables.batches.Batch","The","batches","to","augment",",","provided","as","a","generator",".","Each","call","to","the","generator","should","yield","exactly","one","batch",".","chunksize",":","None","or","int",",","optional","Rough","indicator","of","how","many","tasks","should","be","sent","to","each","worker",".","Increasing","this","number","can","improve","performance",".","output_buffer_size",":","None","or","int",",","optional","Max","number","of","batches","to","handle","*","at","the","same","time","*","in","the","*","whole","*","pipeline","(","including","already","augmented","batches","that","are","waiting","to","be","requested",")",".","If","the","buffer","size","is","reached",",","no","new","batches","will","be","loaded","from","`","batches","`","until","a","produced","(","i.e",".","augmented",")","batch","is","consumed","(","i.e",".","requested","from","this","method",")",".","The","buffer","is","unlimited","if","this","is","set","to","``","None","``",".","For","large","datasets",",","this","should","be","set","to","an","integer","value","to","avoid","filling","the","whole","RAM","if","loading+augmentation","happens","faster","than","training",".","*","New","in","version","0.3.0",".","*","Yields","--","--","--","imgaug.augmentables.batches.Batch","Augmented","batch","."]
code: def imap_batches(self, batches, chunksize=1, output_buffer_size=None):
      """
      Augment batches from a generator.
  
      Pattern for output buffer constraint is from
      https://stackoverflow.com/a/47058399.
  
      Parameters
      ----------
      batches : generator of imgaug.augmentables.batches.Batch
          The batches to augment, provided as a generator. Each call to the
          generator should yield exactly one batch.
  
      chunksize : None or int, optional
          Rough indicator of how many tasks should be sent to each worker.
          Increasing this number can improve performance.
  
      output_buffer_size : None or int, optional
          Max number of batches to handle *at the same time* in the *whole*
          pipeline (including already augmented batches that are waiting to
          be requested). If the buffer size is reached, no new batches will
          be loaded from `batches` until a produced (i.e. augmented) batch is
          consumed (i.e. requested from this method).
          The buffer is unlimited if this is set to ``None``. For large
          datasets, this should be set to an integer value to avoid filling
          the whole RAM if loading+augmentation happens faster than training.
  
          *New in version 0.3.0.*
  
      Yields
      ------
      imgaug.augmentables.batches.Batch
          Augmented batch.
  
      """
      self._assert_batches_is_generator(batches)
  
      # buffer is either None or a Semaphore
      output_buffer_left = _create_output_buffer_left(
          output_buffer_size
      )
  
      # TODO change this to 'yield from' once switched to 3.3+
      gen = self.pool.imap(
          _Pool_starworker,
          self._ibuffer_batch_loading(
              self._handle_batch_ids_gen(batches), output_buffer_left
          ),
          chunksize=chunksize,
      )
  
      for batch in gen:
          yield batch
          if output_buffer_left is not None:
              output_buffer_left.release()
  
imports: from __future__ import print_function, division, absolute_import
  import sys
  import multiprocessing
  import threading
  import traceback
  import time
  import random
  import platform
  import numpy
  import cv2
  import imgaug.imgaug
  import imgaug.random
  from imgaug.augmentables.batches import Batch, UnnormalizedBatch
label_desc: Use image node_id 6 for calling the Pool obj's underlying member method code with example usage: obj.imap_batches(batches, chunksize, output_buffer_size) without return types