              new_face[:, :, -1] = np.minimum(new_face[:, :, -1], mask.squeeze())
          else:
              logger.trace("Adding mask to alpha channel")
              new_face = np.concatenate((new_face, mask), -1)
          np.clip(new_face, 0.0, 1.0, out=new_face)
          logger.trace("Got mask. Image shape: %s", new_face.shape)
          return new_face, raw_mask
  
      def post_warp_adjustments(self, background, new_image):
          """ Apply fixes to the image after warping """
 
</s> remove         mask, raw_mask = self.adjustments["mask"].run(detected_face, predicted_mask)
 </s> add         mask, raw_mask = self._adjustments["mask"].run(detected_face, predicted_mask) </s> remove     def post_warp_adjustments(self, background, new_image):
        """ Apply fixes to the image after warping """
        if self.adjustments["scaling"] is not None:
            new_image = self.adjustments["scaling"].run(new_image)
 </s> add     def _post_warp_adjustments(self, background, new_image):
        """ Perform any requested adjustments to the swapped faces after they have been transformed
        into the final frame.

        Parameters
        ----------
        background: :class:`numpy.ndarray`
            The original frame
        new_image: :class:`numpy.ndarray`
            A blank frame of original frame size with the faces warped onto it

        Returns
        -------
        :class:`numpy.ndarray`
            The final merged and swapped frame with any requested post-warp adjustments applied
        """
        if self._adjustments["scaling"] is not None:
            new_image = self._adjustments["scaling"].run(new_image) </s> remove     def get_image_mask(self, new_face, detected_face, predicted_mask):
        """ Get the image mask """
 </s> add     def _get_image_mask(self, new_face, detected_face, predicted_mask):
        """ Return any selected image mask and intersect with any box mask.

        Places the requested mask into the new face's Alpha channel, intersecting with any box
        mask that has already been applied.

        Parameters
        ----------
        new_face: :class:`numpy.ndarray`
            The swapped face received from the faceswap model, with any box mask applied
        detected_face: :class:`~lib.faces_detect.DetectedFace`
            The detected_face object as defined in :class:`scripts.convert.Predictor`
        predicted_mask: :class:`numpy.ndarray` or ``None``
            The predicted mask output from the Faceswap model. ``None`` if the model
            did not learn a mask

        Returns
        :class:`numpy.ndarray`
            The swapped face with the requested mask added to the Alpha channel
        """ </s> remove             src_face = detected_face.reference_face[..., :3] / 255.0
 </s> add  </s> remove         new_face = self.adjustments["box"].run(new_face)
        new_face, raw_mask = self.get_image_mask(new_face, detected_face, predicted_mask)
        if self.adjustments["color"] is not None:
            new_face = self.adjustments["color"].run(old_face, new_face, raw_mask)
        if self.adjustments["seamless"] is not None:
            new_face = self.adjustments["seamless"].run(old_face, new_face, raw_mask)
 </s> add         old_face = detected_face.reference_face[..., :3] / 255.0
        new_face = self._adjustments["box"].run(new_face)
        new_face, raw_mask = self._get_image_mask(new_face, detected_face, predicted_mask)
        if self._adjustments["color"] is not None:
            new_face = self._adjustments["color"].run(old_face, new_face, raw_mask)
        if self._adjustments["seamless"] is not None:
            new_face = self._adjustments["seamless"].run(old_face, new_face, raw_mask)
              new_face[:, :, -1] = np.minimum(new_face[:, :, -1], mask.squeeze())
          else:
              logger.trace("Adding mask to alpha channel")
              new_face = np.concatenate((new_face, mask), -1)

          logger.trace("Got mask. Image shape: %s", new_face.shape)
          return new_face, raw_mask
  
      def post_warp_adjustments(self, background, new_image):
          """ Apply fixes to the image after warping """
keep keep keep keep replace keep keep keep keep keep
 Smart Masks to Convert (#957)

- scripts.convert - Use Smart Masks for Convert
    * Make on-the-fly conversion an explicit option

- Move BlurMask to lib.faces_detect

- tools.preview - Fix for smart masks
    * Subclass from tk.Tk
    * Options to lib.gui.control_helper
    *variable cleanup

- lib.logger - Demote more tensorflow deprecation messages

- Documentation:
    * lib.faces_detect.BlurMask
    * plugins.convert.mask
    * lib.convert
    * scripts.convert
    * scripts.fsmedia
    * tools.preview 
lib/convert.py