          output_shapes = self.model.output_shapes
          logger.debug("input_size: %s, output_shapes: %s", input_size, output_shapes)
          generator = TrainingDataGenerator(input_size,
                                            output_shapes,
                                            self.model.training_opts,
                                            self.config)
          return generator
  
      def train_one_batch(self, do_preview):
          """ Train a batch """
          logger.trace("Training one step: (side: %s)", self.side)
 
</s> remove     def train_one_batch(self, do_preview):
        """ Train a batch """
        logger.trace("Training one step: (side: %s)", self.side)
        batch = self.get_next(do_preview)
 </s> add     def train_one_batch(self):
        """ Train on a single batch of images for this :class:`Batcher`

        Returns
        -------
        list
            The list of loss values (as ``float``) for this batch
        """
        logger.trace("Training one step: (side: %s)", self._side)
        model_inputs, model_targets = self._get_next() </s> remove         logger.debug("Initializing %s: side: '%s', num_images: %s, batch_size: %s, config: %s)",
                     self.__class__.__name__, side, len(images), batch_size, config)
        self.model = model
        self.use_mask = use_mask
        self.side = side
        self.images = images
        self.config = config
        self.target = None
        self.samples = None
        self.mask = None

        generator = self.load_generator()
        self.feed = generator.minibatch_ab(images, batch_size, self.side)

        self.preview_feed = None
        self.timelapse_feed = None

    def load_generator(self):
        """ Pass arguments to TrainingDataGenerator and return object """
        logger.debug("Loading generator: %s", self.side)
        input_size = self.model.input_shape[0]
        output_shapes = self.model.output_shapes
 </s> add         logger.debug("Initializing %s: side: '%s', num_images: %s, use_mask: %s, batch_size: %s, "
                     "config: %s)",
                     self.__class__.__name__, side, len(images), use_mask, batch_size, config)
        self._model = model
        self._use_mask = use_mask
        self._side = side
        self._images = images
        self._config = config
        self._target = None
        self._samples = None
        self._masks = None

        generator = self._load_generator()
        self._feed = generator.minibatch_ab(images, batch_size, self._side)

        self._preview_feed = None
        self._timelapse_feed = None
        self._set_preview_feed()

    def _load_generator(self):
        """ Load the :class:`lib.training_data.TrainingDataGenerator` for this batcher """
        logger.debug("Loading generator: %s", self._side)
        input_size = self._model.input_shape[0]
        output_shapes = self._model.output_shapes </s> remove             loss = self.model.predictors[self.side].train_on_batch(*batch)
 </s> add             loss = self._model.predictors[self._side].train_on_batch(model_inputs, model_targets) </s> remove         snapshot_interval = self.model.training_opts.get("snapshot_interval", 0)
 </s> add         snapshot_interval = self._model.training_opts.get("snapshot_interval", 0) </s> remove         print("[{}] [#{:05d}] {}".format(self.timestamp, self.model.iterations, output), end='\r')
 </s> add         print("[{}] [#{:05d}] {}".format(self._timestamp,
                                         self._model.iterations,
                                         output), end='\r')
                                          self._model.training_opts,
                                          self._config)
          output_shapes = self.model.output_shapes
          logger.debug("input_size: %s, output_shapes: %s", input_size, output_shapes)
          generator = TrainingDataGenerator(input_size,
                                            output_shapes,
                                          self._model.training_opts,
                                          self._config)
                                          self._model.training_opts,
                                          self._config)
          return generator
  
      def train_one_batch(self, do_preview):
          """ Train a batch """
          logger.trace("Training one step: (side: %s)", self.side)
keep keep keep keep replace replace keep keep keep keep keep
 Smart Masks - Training Implementation (#914)

* Smart Masks - Training

- Reinstate smart mask training code
- Reinstate mask_type back to model.config
- change 'replicate_input_mask to 'learn_mask'
- Add learn mask option
- Add mask loading from alignments to plugins.train.trainer
- Add mask_blur and mask threshold options
- _base.py - Pass mask options through training_opts dict
- plugins.train.model - check for mask_type not None for learn_mask and penalized_mask_loss
- Limit alignments loading to just those faces that appear in the training folder
- Raise error if not all training images have an alignment, and alignment file is required
- lib.training_data - Mask generation code
- lib.faces_detect - cv2 dimension stripping bugfix
- Remove cv2 linting code

* Update mask helptext in cli.py

* Fix Warp to Landmarks
Remove SHA1 hashing from training data

* Update mask training config

* Capture missing masks at training init

* lib.image.read_image_batch - Return filenames with batch for ordering

* scripts.train - Documentation

* plugins.train.trainer - documentation

* Ensure backward compatibility.
Fix convert for new predicted masks

* Update removed masks to components for legacy models. 
plugins/train/trainer/_base.py