              setattr(arguments, option, value)
          logger.debug(arguments)
          return arguments
  
      def process(self, trigger_event, shutdown_event, patch_queue_in, samples, tk_vars):
          """ Wait for event trigger and run when process when set """
          patch_queue_out = queue_manager.get_queue("preview_patch_out")
          while True:
              trigger = trigger_event.wait(1)
              if shutdown_event.is_set():
                  logger.debug("Shutdown received")
 
</s> remove             self.feed_swapped_faces(patch_queue_in, samples)
            with self.lock:
                self.update_converter_arguments()
                self.converter.reinitialize(config=self.current_config)
            swapped = self.patch_faces(patch_queue_in, patch_queue_out, samples.sample_size)
            with self.lock:
                self.display.destination = swapped
 </s> add             self._feed_swapped_faces(patch_queue_in, samples)
            with self._lock:
                self._update_converter_arguments()
                self._converter.reinitialize(config=self.current_config)
            swapped = self._patch_faces(patch_queue_in, patch_queue_out, samples.sample_size)
            with self._lock:
                self._display.destination = swapped </s> remove         self.samples = samples
        self.queue_patch_in = queue_manager.get_queue("preview_patch_in")
        self.display = display
        self.lock = lock
        self.trigger = trigger
 </s> add         self._samples = samples
        self._queue_patch_in = queue_manager.get_queue("preview_patch_in")
        self._display = display
        self._lock = lock
        self._trigger = trigger </s> remove             setattr(self.converter.args, key, val)
 </s> add             setattr(self._converter.cli_arguments, key, val) </s> remove         """ Generate a random test set """
        self.load_frames()
        self.predict()
        self.trigger_patch.set()

    def load_frames(self):
        """ Load a sample of random frames """
        self.input_images = list()
        for selection in self.random_choice:
            filename = os.path.basename(self.filelist[selection])
            image = self.images.load_one_image(self.filelist[selection])
 </s> add         """ Generate a sample set.

        Selects :attr:`sample_size` random faces. Runs them through prediction to obtain the
        swap, then trigger the patch event to run the faces through patching.
        """
        self._load_frames()
        self._predict()
        self._trigger_patch.set()

    def _load_frames(self):
        """ Load a sample of random frames.

        * Picks a random face from each indices group.

        * Takes the first face from the image (if there) are multiple faces. Adds the images to \
            :attr:`self._input_images`.

        * Sets :attr:`_display.source` to the input images and flags that the display should \
            be updated
        """
        self._input_images = list()
        for selection in self._random_choice:
            filename = os.path.basename(self._filelist[selection])
            image = self._images.load_one_image(self._filelist[selection]) </s> remove     """ The patch pipeline
        To be run within it's own thread """
 </s> add     """ The Patch pipeline

    Runs in it's own thread. Takes the output from the Faceswap model predictor and runs the faces
    through the convert pipeline using the currently selected options.

    Parameters
    ----------
    arguments: :class:`argparse.Namespace`
        The :mod:`argparse` arguments as passed in from :mod:`tools.py`
    samples: :class:`Samples`
        The Samples for display.
    display: :class:`FacesDisplay`
        The display section of the Preview GUI.
    lock: :class:`threading.Lock`
        A threading lock to prevent multiple GUI updates at the same time.
    trigger:  :class:`threading.Event`
        An event to indicate that a converter patch should be run
    config_tools: :class:`ConfigTools`
        Tools for loading and saving configuration files
    tk_vars: dict
        Global tkinter variables. `Refresh` and `Busy` :class:`tkinter.BooleanVar`

    Attributes
    ----------
    converter_arguments: dict
        The currently selected converter command line arguments for the patch queue
    current_config::class:`lib.config.FaceswapConfig`
        The currently set configuration for the patch queue
    """
    def _process(self, trigger_event, shutdown_event, patch_queue_in, samples, tk_vars):
        """ The face patching process.

        Runs in a thread, and waits for an event to be set. Once triggered, runs a patching
        cycle and sets the :class:`Display` destination images.

        Parameters
        ----------
        trigger_event: :class:`threading.Event`
            Set by parent process when a patching run should be executed
        shutdown_event :class:`threading.Event`
            Set by parent process if a shutdown has been requested
        patch_queue_in: :class:`queue.Queue`
            The input queue for the patching process
        samples: :class:`Samples`
            The Samples for display.
        tk_vars: dict
            Global tkinter variables. `Refresh` and `Busy` :class:`tkinter.BooleanVar`
        """
              setattr(arguments, option, value)
          logger.debug(arguments)
          return arguments
  
    def _process(self, trigger_event, shutdown_event, patch_queue_in, samples, tk_vars):
        """ The face patching process.

        Runs in a thread, and waits for an event to be set. Once triggered, runs a patching
        cycle and sets the :class:`Display` destination images.

        Parameters
        ----------
        trigger_event: :class:`threading.Event`
            Set by parent process when a patching run should be executed
        shutdown_event :class:`threading.Event`
            Set by parent process if a shutdown has been requested
        patch_queue_in: :class:`queue.Queue`
            The input queue for the patching process
        samples: :class:`Samples`
            The Samples for display.
        tk_vars: dict
            Global tkinter variables. `Refresh` and `Busy` :class:`tkinter.BooleanVar`
        """
    def _process(self, trigger_event, shutdown_event, patch_queue_in, samples, tk_vars):
        """ The face patching process.

        Runs in a thread, and waits for an event to be set. Once triggered, runs a patching
        cycle and sets the :class:`Display` destination images.

        Parameters
        ----------
        trigger_event: :class:`threading.Event`
            Set by parent process when a patching run should be executed
        shutdown_event :class:`threading.Event`
            Set by parent process if a shutdown has been requested
        patch_queue_in: :class:`queue.Queue`
            The input queue for the patching process
        samples: :class:`Samples`
            The Samples for display.
        tk_vars: dict
            Global tkinter variables. `Refresh` and `Busy` :class:`tkinter.BooleanVar`
        """
          patch_queue_out = queue_manager.get_queue("preview_patch_out")
          while True:
              trigger = trigger_event.wait(1)
              if shutdown_event.is_set():
                  logger.debug("Shutdown received")
keep keep keep keep 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 
tools/preview.py