      def get_next(self, do_preview):
          """ Return the next batch from the generator
              Items should come out as: (warped, target [, mask]) """
          batch = next(self.feed)
          feed = batch[1]
          batch = batch[2:]   # Remove full size samples and feed from batch
          mask = batch[-1]
          batch = [[feed, mask], batch] if self.use_mask else [feed, batch]
          self.generate_preview(do_preview)
          return batch
  
      def generate_preview(self, do_preview):
          """ Generate the preview if a preview iteration """
 
</s> remove             mask = batch[-1]
            batch = [[feed, mask], batch]
            self.target = [self.target, mask]
 </s> add             self.target += [batch["masks"]] </s> remove         samples, feed = batch[:2]
        batchsize = len(samples)
        batch = batch[2:]   # Remove full size samples and feed from batch
        images = batch[self.model.largest_face_index]
 </s> add         batchsize = len(batch["samples"])
        images = [batch["targets"][self.model.largest_face_index]] </s> remove         self.samples, feed = batch[:2]
        batch = batch[2:]   # Remove full size samples and feed from batch
        self.target = batch[self.model.largest_face_index]
 </s> add         self.samples = batch["samples"]
        self.target = [batch["targets"][self.model.largest_face_index]] </s> remove             mask = batch[-1]
            batch = [[feed, mask], batch]
            images = [images, mask]
        sample = self.compile_sample(batchsize, samples=samples, images=images)
 </s> add             images = images + [batch["masks"]]
        sample = self.compile_sample(batchsize, samples=batch["samples"], images=images) </s> remove     def separate_mask(image):
        """ Return the image and the mask from a 4 channel image """
        mask = None
        if image.shape[2] == 4:
            logger.trace("Image contains mask")
            mask = np.expand_dims(image[:, :, -1], axis=2)
            image = image[:, :, :3]
        else:
            logger.trace("Image has no mask")
        return image, mask

    def get_coverage(self, image):
        """ Return coverage value for given image """
        coverage = int(image.shape[0] * self.coverage_ratio)
        logger.trace("Coverage: %s", coverage)
        return coverage
 </s> add     def _separate_target_mask(batch):
        """ Return the batch and the batch of final masks
        if self.use_mask:
            batch = [[batch["feed"], batch["masks"]], batch["targets"] + [batch["masks"]]]
        else:
            batch = [batch["feed"], batch["targets"]]
      def get_next(self, do_preview):
          """ Return the next batch from the generator
              Items should come out as: (warped, target [, mask]) """
          batch = next(self.feed)
        if self.use_mask:
            batch = [[batch["feed"], batch["masks"]], batch["targets"] + [batch["masks"]]]
        else:
            batch = [batch["feed"], batch["targets"]]
        if self.use_mask:
            batch = [[batch["feed"], batch["masks"]], batch["targets"] + [batch["masks"]]]
        else:
            batch = [batch["feed"], batch["targets"]]
        if self.use_mask:
            batch = [[batch["feed"], batch["masks"]], batch["targets"] + [batch["masks"]]]
        else:
            batch = [batch["feed"], batch["targets"]]
        if self.use_mask:
            batch = [[batch["feed"], batch["masks"]], batch["targets"] + [batch["masks"]]]
        else:
            batch = [batch["feed"], batch["targets"]]
          self.generate_preview(do_preview)
          return batch
  
      def generate_preview(self, do_preview):
          """ Generate the preview if a preview iteration """
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Optimize Data Augmentation (#881)

* Move image utils to lib.image
* Add .pylintrc file
* Remove some cv2 pylint ignores
* TrainingData: Load images from disk in batches
* TrainingData: get_landmarks to batch
* TrainingData: transform and flip to batches
* TrainingData: Optimize color augmentation
* TrainingData: Optimize target and random_warp
* TrainingData - Convert _get_closest_match for batching
* TrainingData: Warp To Landmarks optimized
* Save models to threadpoolexecutor
* Move stack_images, Rename ImageManipulation. ImageAugmentation Docstrings
* Masks: Set dtype and threshold for lib.masks based on input face
* Docstrings and Documentation 
plugins/train/trainer/_base.py