def __init__(self, augseq, processes=None, maxtasksperchild=None, seed=None):
        """
        Initialize augmentation pool.

        Parameters
        ----------
        augseq : 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.

        """
        # make sure that don't call pool again in a child process
        assert Pool._WORKER_AUGSEQ is None, "_WORKER_AUGSEQ was already set when calling " \
                                            "Pool.__init__(). Did you try to instantiate a Pool within a Pool?"
        assert processes is None or processes != 0

        self.augseq = augseq
        self.processes = processes
        self.maxtasksperchild = maxtasksperchild
        self.seed = seed
        if self.seed is not None:
            assert ia.SEED_MIN_VALUE <= self.seed <= ia.SEED_MAX_VALUE

        # multiprocessing.Pool instance
        self._pool = None

        # Running counter of the number of augmented batches. This will be used to send indexes for each batch to
        # the workers so that they can augment using SEED_BASE+SEED_BATCH and ensure consistency of applied
        # augmentation order between script runs.
        self._batch_idx = 0
def __init__ ( self , augseq , processes = None , maxtasksperchild = None , seed = None ) : assert Pool . _WORKER_AUGSEQ is None , "_WORKER_AUGSEQ was already set when calling " "Pool.__init__(). Did you try to instantiate a Pool within a Pool?" assert processes is None or processes != 0 self . augseq = augseq self . processes = processes self . maxtasksperchild = maxtasksperchild self . seed = seed if self . seed is not None : assert ia . SEED_MIN_VALUE <= self . seed <= ia . SEED_MAX_VALUE self . _pool = None self . _batch_idx = 0
Initialize augmentation pool.

        Parameters
        ----------
        augseq : 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.