              model_name = self.config_section
              logger.debug("Loading config for: %s", model_name)
              _CONFIG = Config(model_name, configfile=self.configfile).config_dict
  
      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)
  
      def calculate_coverage_ratio(self):
          """ Coverage must be a ratio, leading to a cropped shape divisible by 2 """
          coverage_ratio = self.config.get("coverage", 62.5) / 100
          logger.debug("Requested coverage_ratio: %s", coverage_ratio)
          cropped_size = (self.state.training_size * coverage_ratio) // 2 * 2
 
</s> remove     """ Display samples for preview and timelapse """
 </s> add     """ Compile samples for display for preview and time-lapse

    Parameters
    ----------
    model: plugin from :mod:`plugins.train.model`
        The selected model that will be running this trainer
    use_mask: bool
        ``True`` if a mask should be displayed otherwise ``False``
    coverage_ratio: float
        Ratio of face to be cropped out of the training image.
    scaling: float, optional
        The amount to scale the final preview image by. Default: `1.0`

    Attributes
    ----------
    images: dict
        The :class:`numpy.ndarray` training images for generating previews on each side. The
        dictionary should contain 2 keys ("a" and "b") with the values being the training images
        for generating samples corresponding to each side.
    """ </s> remove     """ Create the timelapse """
    def __init__(self, model, use_mask, coverage_ratio, preview_images, batchers):
 </s> add     """ Create a time-lapse preview image.

    Parameters
    ----------
    model: plugin from :mod:`plugins.train.model`
        The selected model that will be running this trainer
    use_mask: bool
        ``True`` if a mask should be displayed otherwise ``False``
    coverage_ratio: float
        Ratio of face to be cropped out of the training image.
    scaling: float, optional
        The amount to scale the final preview image by. Default: `1.0`
    image_count: int
        The number of preview images to be displayed in the time-lapse
    batchers: dict
        The dictionary should contain 2 keys ("a" and "b") with the values being the
        :class:`Batcher` for each side.
    """
    def __init__(self, model, use_mask, coverage_ratio, image_count, batchers): </s> remove         self.model = model
        self.use_mask = use_mask
 </s> add         self._model = model
        self._use_mask = use_mask </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         self.coverage_ratio = coverage_ratio
        self.scaling = scaling
 </s> add         self._coverage_ratio = coverage_ratio
        self._scaling = scaling
              model_name = self.config_section
              logger.debug("Loading config for: %s", model_name)
              _CONFIG = Config(model_name, configfile=self.configfile).config_dict
  












      def calculate_coverage_ratio(self):
          """ Coverage must be a ratio, leading to a cropped shape divisible by 2 """
          coverage_ratio = self.config.get("coverage", 62.5) / 100
          logger.debug("Requested coverage_ratio: %s", coverage_ratio)
          cropped_size = (self.state.training_size * coverage_ratio) // 2 * 2
keep keep keep keep replace replace replace replace replace replace replace replace replace replace 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/model/_base.py