          self._model_output_shapes = model_output_shapes
          self._training_opts = training_opts
          self._landmarks = self._training_opts.get("landmarks", None)
          self._nearest_landmarks = {}
  
          # Batchsize and processing class are set when this class is called by a batcher
          # from lib.training_data
          self._batchsize = 0
 
</s> remove         self._mask_class = self._set__mask_class()
 </s> add  </s> remove     """ The training process.  """
 </s> add     """ The Faceswap Training Process.

    The training process is responsible for training a model on a set of source faces and a set of
    destination faces.

    The training process is self contained and should not be referenced by any other scripts, so it
    contains no public properties.

    Parameters
    ----------
    arguments: argparse.Namespace
        The arguments to be passed to the training process as generated from Faceswap's command
        line arguments
    """ </s> remove                      {key: val for key, val in training_opts.items() if key != "landmarks"},
                     bool(training_opts.get("landmarks", None)), config)
 </s> add                      {key: val
                      for key, val in training_opts.items() if key not in ("landmarks", "masks")},
                     {key: len(val)
                      for key, val in training_opts.get("landmarks", dict()).items()},
                     {key: len(val) for key, val in training_opts.get("masks", dict()).items()},
                     config) </s> remove     def _set__mask_class(self):
        """ Returns the correct mask class from :mod:`lib`.model.masks` as defined in the
        :attr:`mask_type` parameter. """
        mask_type = self._training_opts.get("mask_type", None)
        if mask_type:
            logger.debug("Mask type: '%s'", mask_type)
            _mask_class = getattr(masks, mask_type)
        else:
            _mask_class = None
        logger.debug("Mask class: %s", _mask_class)
        return _mask_class

 </s> add  </s> remove     def set_training_data(self):
        """ Override to set model specific training data.

            super() this method for defaults otherwise be sure to add """
        logger.debug("Setting training data")
        # Force number of preview images to between 2 and 16
        self.training_opts["training_size"] = self.state.training_size
        self.training_opts["no_logs"] = self.state.current_session["no_logs"]
        self.training_opts["mask_type"] = self.config.get("mask_type", None)
        self.training_opts["coverage_ratio"] = self.calculate_coverage_ratio()
        logger.debug("Set training data: %s", self.training_opts)

 </s> add 
        self._masks = self._training_opts.get("masks", None)
          self._model_output_shapes = model_output_shapes
          self._training_opts = training_opts
          self._landmarks = self._training_opts.get("landmarks", None)
        self._masks = self._training_opts.get("masks", None)
          self._nearest_landmarks = {}
  
          # Batchsize and processing class are set when this class is called by a batcher
          # from lib.training_data
          self._batchsize = 0
keep keep add 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. 
lib/training_data.py