          images = [faces] + predictions
          full_size = full.shape[1]
          target_size = int(full_size * self.coverage_ratio)
          if target_size != full_size:
              frame = self.frame_overlay(full, target_size, (0, 0, 255))
  
          if self.use_mask:
              images = self.compile_masked(images, samples[-1])
          images = [self.resize_sample(side, image, target_size) for image in images]
          if target_size != full_size:
 
</s> remove         if self.use_mask:
            images = self.compile_masked(images, samples[-1])
        images = [self.resize_sample(side, image, target_size) for image in images]
 </s> add         if self._use_mask:
            images = self._compile_masked(images, samples[-1])
        images = [self._resize_sample(side, image, target_size) for image in images] </s> remove         target_size = int(full_size * self.coverage_ratio)
 </s> add         target_size = int(full_size * self._coverage_ratio) </s> remove             images = [self.overlay_foreground(frame, image) for image in images]
        if self.scaling != 1.0:
            new_size = int(full_size * self.scaling)
            images = [self.resize_sample(side, image, new_size) for image in images]
 </s> add             images = [self._overlay_foreground(frame, image) for image in images]
        if self._scaling != 1.0:
            new_size = int(full_size * self._scaling)
            images = [self._resize_sample(side, image, new_size) for image in images] </s> remove     def frame_overlay(images, target_size, color):
        """ Add roi frame to a backfround image """
 </s> add     def _frame_overlay(images, target_size, color):
        """ Add a frame overlay to preview images indicating the region of interest.

        This is the red border that appears in the preview images.

        Parameters
        ----------
        images: :class:`numpy.ndarray`
            The samples to apply the frame to
        target_size: int
            The size of the sample within the full size frame
        color: tuple
            The (Blue, Green, Red) color to use for the frame

        Returns
        -------
        :class:`numpy,ndarray`
            The samples with the frame overlay applied
        """ </s> remove     def to_full_frame(self, side, samples, predictions):
        """ Patch the images into the full frame """
 </s> add     def _to_full_frame(self, side, samples, predictions):
        """ Patch targets and prediction images into images of training image size.

        Parameters
        ----------
        side: {"a" or "b"}
            The side that these samples are for
        samples: list
            List of :class:`numpy.ndarray` of target images and feed images
        predictions: list
            List of :class: `numpy.ndarray` of predictions from the model
        """
            frame = self._frame_overlay(full, target_size, (0, 0, 255))
          images = [faces] + predictions
          full_size = full.shape[1]
          target_size = int(full_size * self.coverage_ratio)
          if target_size != full_size:
            frame = self._frame_overlay(full, target_size, (0, 0, 255))
  
          if self.use_mask:
              images = self.compile_masked(images, samples[-1])
          images = [self.resize_sample(side, image, target_size) for image in images]
          if target_size != full_size:
keep keep keep keep 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