          new_image, background = self.get_new_image(predicted, frame_size)
          patched_face = self.post_warp_adjustments(background, new_image)
          patched_face = self.scale_image(patched_face)
          patched_face *= 255.0
          patched_face = np.rint(
              patched_face,
              out=np.empty(patched_face.shape, dtype="uint8"),
              casting='unsafe'
          )
          if self.writer_pre_encode is not None:
              patched_face = self.writer_pre_encode(patched_face)
          logger.trace("Patched image: '%s'", predicted["filename"])
          return patched_face
  
      def get_new_image(self, predicted, frame_size):
          """ Get the new face from the predictor and apply box manipulations """
 
</s> remove         new_image, background = self.get_new_image(predicted, frame_size)
        patched_face = self.post_warp_adjustments(background, new_image)
        patched_face = self.scale_image(patched_face)
 </s> add         new_image, background = self._get_new_image(predicted, frame_size)
        patched_face = self._post_warp_adjustments(background, new_image)
        patched_face = self._scale_image(patched_face) </s> remove     def get_new_image(self, predicted, frame_size):
        """ Get the new face from the predictor and apply box manipulations """
 </s> add     def _get_new_image(self, predicted, frame_size):
        """ Get the new face from the predictor and apply pre-warp manipulations.

        Applies any requested adjustments to the raw output of the Faceswap model
        before transforming the image into the target frame.

        Parameters
        ----------
        predicted: dict
            The output from :class:`scripts.convert.Predictor`.
        frame_size: tuple
            The (`width`, `height`) of the final frame in pixels

        Returns
        -------
        placeholder:  :class: `numpy.ndarray`
            The original frame with the swapped faces patched onto it
        background:  :class: `numpy.ndarray`
            The original frame
        """ </s> remove     def patch_image(self, predicted):
        """ Patch the image """
 </s> add     def _patch_image(self, predicted):
        """ Patch a swapped face onto a frame.

        Run selected adjustments and swap the faces in a frame.

        Parameters
        ----------
        predicted: dict
            The output from :class:`scripts.convert.Predictor`.

        Returns
        -------
        :class: `numpy.ndarray` or pre-encoded image output
            The final frame ready for writing by a :mod:`plugins.convert.writer` plugin.
            Frame is either an array, or the pre-encoded output from the writer's pre-encode
            function (if it has one)

        """ </s> remove         if self.draw_transparent:
 </s> add         if self._draw_transparent: </s> remove         # Signal that this process has finished
        if completion_queue is not None:
            completion_queue.put(1)
 </s> add 
        patched_face = np.rint(patched_face,
                               out=np.empty(patched_face.shape, dtype="uint8"),
                               casting='unsafe')
        if self._writer_pre_encode is not None:
            patched_face = self._writer_pre_encode(patched_face)
          new_image, background = self.get_new_image(predicted, frame_size)
          patched_face = self.post_warp_adjustments(background, new_image)
          patched_face = self.scale_image(patched_face)
          patched_face *= 255.0
        patched_face = np.rint(patched_face,
                               out=np.empty(patched_face.shape, dtype="uint8"),
                               casting='unsafe')
        if self._writer_pre_encode is not None:
            patched_face = self._writer_pre_encode(patched_face)
        patched_face = np.rint(patched_face,
                               out=np.empty(patched_face.shape, dtype="uint8"),
                               casting='unsafe')
        if self._writer_pre_encode is not None:
            patched_face = self._writer_pre_encode(patched_face)
        patched_face = np.rint(patched_face,
                               out=np.empty(patched_face.shape, dtype="uint8"),
                               casting='unsafe')
        if self._writer_pre_encode is not None:
            patched_face = self._writer_pre_encode(patched_face)
        patched_face = np.rint(patched_face,
                               out=np.empty(patched_face.shape, dtype="uint8"),
                               casting='unsafe')
        if self._writer_pre_encode is not None:
            patched_face = self._writer_pre_encode(patched_face)
        patched_face = np.rint(patched_face,
                               out=np.empty(patched_face.shape, dtype="uint8"),
                               casting='unsafe')
        if self._writer_pre_encode is not None:
            patched_face = self._writer_pre_encode(patched_face)
        patched_face = np.rint(patched_face,
                               out=np.empty(patched_face.shape, dtype="uint8"),
                               casting='unsafe')
        if self._writer_pre_encode is not None:
            patched_face = self._writer_pre_encode(patched_face)
        patched_face = np.rint(patched_face,
                               out=np.empty(patched_face.shape, dtype="uint8"),
                               casting='unsafe')
        if self._writer_pre_encode is not None:
            patched_face = self._writer_pre_encode(patched_face)
          logger.trace("Patched image: '%s'", predicted["filename"])
          return patched_face
  
      def get_new_image(self, predicted, frame_size):
          """ Get the new face from the predictor and apply box manipulations """
keep keep keep keep replace replace replace replace replace replace 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