                       bool(training_opts.get("landmarks", None)))
          self.batchsize = 0
          self.model_input_size = model_input_size
          self.training_opts = training_opts
          self.mask_function = self.set_mask_function()
          self.landmarks = self.training_opts.get("landmarks", None)
          self.processing = ImageManipulation(model_input_size,
                                              model_output_size,
                                              training_opts.get("coverage_ratio", 0.625))
 
</s> remove         q_size = batchsize * 8
        # Don't use a multiprocessing queue because sometimes the MP Manager borks on numpy arrays
        queue_manager.add_queue(q_name, maxsize=q_size, multiprocessing_queue=False)
        load_thread = MultiThread(self.load_batches,
                                  images,
                                  q_name,
                                  side,
                                  is_timelapse,
                                  do_shuffle)
 </s> add         load_thread = FixedProducerDispatcher(
            self.load_batches,
            batch_shape,
            args=(images, q_name, side, is_timelapse, do_shuffle, batchsize),
            log_queue=queue_manager._log_queue,
            log_level=logger.getEffectiveLevel(),
        ) </s> remove         while True:
            if do_shuffle:
                shuffle(images)
            for img in images:
                logger.trace("Putting to batch queue: (q_name: '%s', side: '%s')", q_name, side)
                queue.put(self.process_face(img, side, is_timelapse))
            epoch += 1
 </s> add         def _img_iter(imgs):
            while True:
                if do_shuffle:
                    shuffle(imgs)
                for img in imgs:
                    yield img
        img_iter = _img_iter(images)
        epoch = 0
        for memory_wrapper in mem_gen:
            memory = memory_wrapper.get()
            logger.debug("Putting to batch queue: (q_name: '%s', side: '%s')", q_name, side)
            for i, img_path in enumerate(img_iter):
                imgs = self.process_face(img_path, side, is_timelapse)
                for j, img in enumerate(imgs):
                    memory[j][i][:] = img
                epoch += 1
                if i == batchsize - 1:
                    break
            memory_wrapper.ready() </s> remove         epoch = 0
        queue = queue_manager.get_queue(q_name)
 </s> add 
        self.model_output_size = model_output_size
                       bool(training_opts.get("landmarks", None)))
          self.batchsize = 0
          self.model_input_size = model_input_size
        self.model_output_size = model_output_size
          self.training_opts = training_opts
          self.mask_function = self.set_mask_function()
          self.landmarks = self.training_opts.get("landmarks", None)
          self.processing = ImageManipulation(model_input_size,
                                              model_output_size,
                                              training_opts.get("coverage_ratio", 0.625))
keep keep add keep keep keep keep keep keep
 Added multithreading dispatcher for training_data 
lib/training_data.py