          logger.debug("header_box.shape: %s", header_box.shape)
          return header_box
  
      @staticmethod
      def duplicate_headers(headers, columns):
          """ Duplicate headers for the number of columns displayed """
          for side, header in headers.items():
              duped = tuple([header for _ in range(columns)])
              headers[side] = np.concatenate(duped, axis=1)
              logger.debug("side: %s header.shape: %s", side, header.shape)
          return headers
 
</s> remove                         lineType=cv2.LINE_AA)  # pylint: disable=no-member
 </s> add                         lineType=cv2.LINE_AA) </s> remove     def get_headers(self, side, width):
        """ Set headers for images """
 </s> add     def _get_headers(self, side, width):
        """ Set header row for the final preview frame

        Parameters
        ----------
        side: {"a" or "b"}
            The side that the headers should be generated for
        width: int
            The width of each column in the preview frame

        Returns
        -------
        :class:`numpy.ndarray`
            The column headings for the given side
        """ </s> remove             headers = self.duplicate_headers(headers, side_cols)
 </s> add             headers = self._duplicate_headers(headers, side_cols) </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
        """ </s> remove     def get_alignments(self):
        """ Obtain the landmarks for each faceset """
        landmarks = dict()
        for side, fullpath in self.paths.items():
 </s> add     # Load alignments
    @staticmethod
    def _get_image_hashes(image_list):
        """ Return the hashes for all images used for training.

        Parameters
        ----------
        image_list: dict
            The file paths for the images to be trained on for each side. The dictionary should
            contain 2 keys ("a" and "b") with the values being a list of full paths corresponding
            to each side.

        Returns
        -------
        dict
            For keys "a" and "b" the values are a ``dict`` containing keys "hashes" and "filenames"
            with their values being a list of hashes and filenames that exist within the training
            data folder
        """
        hashes = {key: dict(hashes=[], filenames=[]) for key in image_list}
        pbar = tqdm(desc="Reading training images",
                    total=sum(len(val) for val in image_list.values()))
        for side, filelist in image_list.items():
            logger.debug("side: %s, file count: %s", side, len(filelist))
            for filename, hsh in read_image_hash_batch(filelist):
                hashes[side]["hashes"].append(hsh)
                hashes[side]["filenames"].append(filename)
                pbar.update(1)
        pbar.close()
        logger.trace(hashes)
        return hashes

    def _load_alignments(self):
        """ Load the alignments and convert to :class:`lib.faces_detect.DetectedFace` objects.

        Returns
        -------
        dict
            For keys "a" and "b" values are a list of :class:`lib.faces_detect.DetectedFace`
            objects.
        """
        logger.debug("Loading alignments")
        retval = dict()
        for side, fullpath in self._training_opts["alignments"].items():
            logger.debug("side: '%s', path: '%s'", side, fullpath)
    def _duplicate_headers(headers, columns):
        """ Duplicate headers for the number of columns displayed for each side.

        Parameters
        ----------
        headers: :class:`numpy.ndarray`
            The header to be duplicated
        columns: int
            The number of columns that the header needs to be duplicated for

        Returns
        -------
        :class:`numpy.ndarray`
            The original headers duplicated by the number of columns
        """
          logger.debug("header_box.shape: %s", header_box.shape)
          return header_box
  
      @staticmethod
    def _duplicate_headers(headers, columns):
        """ Duplicate headers for the number of columns displayed for each side.

        Parameters
        ----------
        headers: :class:`numpy.ndarray`
            The header to be duplicated
        columns: int
            The number of columns that the header needs to be duplicated for

        Returns
        -------
        :class:`numpy.ndarray`
            The original headers duplicated by the number of columns
        """
    def _duplicate_headers(headers, columns):
        """ Duplicate headers for the number of columns displayed for each side.

        Parameters
        ----------
        headers: :class:`numpy.ndarray`
            The header to be duplicated
        columns: int
            The number of columns that the header needs to be duplicated for

        Returns
        -------
        :class:`numpy.ndarray`
            The original headers duplicated by the number of columns
        """
          for side, header in headers.items():
              duped = tuple([header for _ in range(columns)])
              headers[side] = np.concatenate(duped, axis=1)
              logger.debug("side: %s header.shape: %s", side, header.shape)
          return headers
keep keep keep keep replace 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