  
          masks = dict()
          for fhash, face in detected_faces.items():
              mask = face.mask[self._training_opts["mask_type"]]
              mask.set_blur_kernel_and_threshold(blur_kernel=self._training_opts["mask_blur_kernel"],
                                                 threshold=self._training_opts["mask_threshold"])
              for filename in self._hash_to_filenames(side, fhash):
                  masks[filename] = mask
          return masks
  
      # Pre flight checks
 
</s> remove             choices = [self.format_to_display(choice) for choice in choices]
            ctl = ControlBuilder(parent,
                                 opt,
                                 str,
                                 defaults[opt],
                                 choices=choices,
                                 is_radio=False,
                                 label_width=10,
                                 control_width=12)
            self.tk_vars[opt] = ctl.tk_var
 </s> add             cp_option = ControlPanelOption(title=opt,
                                           dtype=str,
                                           default=defaults[opt],
                                           initial_value=defaults[opt],
                                           choices=choices,
                                           is_radio=False)
            self._tk_vars[opt] = cp_option.tk_var
            cp_options.append(cp_option)
        return cp_options

    @staticmethod
    def _create_mask_choices(defaults, available_masks, has_predicted_mask):
        """ Set the mask choices and default mask based on available masks.

        Parameters
        ----------
        defaults: dict
            The default command line options
        available_masks: list
            The available masks that exist within the alignments file
        has_predicted_mask: bool
            Whether the model was trained with a mask

        Returns
        -------
        list
            The masks that are available to use from the alignments file
        """
        logger.debug("Initial mask choices: %s", available_masks)
        if has_predicted_mask:
            available_masks += ["predicted"]
        if "none" not in available_masks:
            available_masks += ["none"]
        if defaults["mask_type"] not in available_masks:
            logger.debug("Setting default mask to first available: %s", available_masks[0])
            defaults["mask_type"] = available_masks[0]
        logger.debug("Final mask choices: %s", available_masks)
        return available_masks </s> remove             face = self.alignments.get_faces_in_frame(filename)[0]
 </s> add             face = self._alignments.get_faces_in_frame(filename)[0] </s> remove     def add_comboboxes(self, parent, defaults):
        """ Add the comboboxes to the Action Frame """
        for opt in self.options:
 </s> add     def _add_cli_choices(self, parent, defaults, available_masks, has_predicted_mask):
        """ Create :class:`lib.gui.control_helper.ControlPanel` object for the command
        line options.

        parent: :class:`ttk.Frame`
            The frame to hold the command line choices
        defaults: dict
            The default command line options
        available_masks: list
            The available masks that exist within the alignments file
        has_predicted_mask: bool
            Whether the model was trained with a mask
        """
        cp_options = self._get_control_panel_options(defaults, available_masks, has_predicted_mask)
        panel_kwargs = dict(blank_nones=False, label_width=10)
        ControlPanel(parent, cp_options, header_text=None, **panel_kwargs)

    def _get_control_panel_options(self, defaults, available_masks, has_predicted_mask):
        """ Create :class:`lib.gui.control_helper.ControlPanelOption` objects for the command
        line options.

        defaults: dict
            The default command line options
        available_masks: list
            The available masks that exist within the alignments file
        has_predicted_mask: bool
            Whether the model was trained with a mask

        Returns
        -------
        list
            The list of `lib.gui.control_helper.ControlPanelOption` objects for the Action Frame
        """
        cp_options = []
        for opt in self._options: </s> remove             src_face = detected_face.reference_face[..., :3] / 255.0
 </s> add  </s> remove import cv2
 </s> add 
            mask.set_blur_and_threshold(blur_kernel=self._training_opts["mask_blur_kernel"],
                                        threshold=self._training_opts["mask_threshold"])
  
          masks = dict()
          for fhash, face in detected_faces.items():
              mask = face.mask[self._training_opts["mask_type"]]
            mask.set_blur_and_threshold(blur_kernel=self._training_opts["mask_blur_kernel"],
                                        threshold=self._training_opts["mask_threshold"])
            mask.set_blur_and_threshold(blur_kernel=self._training_opts["mask_blur_kernel"],
                                        threshold=self._training_opts["mask_threshold"])
              for filename in self._hash_to_filenames(side, fhash):
                  masks[filename] = mask
          return masks
  
      # Pre flight checks
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 
plugins/train/trainer/_base.py