              The detected face object that holds the masks
          area: str
              `"eye"` or `"mouth"`. The area of the face to obtain the mask for
          """
          if not self._config["penalized_mask_loss"] or self._config[f"{area}_multiplier"] <= 1:
              return
          key = "eyes" if area == "eye" else area
  
          logger.trace("Caching localized '%s' mask for: %s", key, filename)
          self._cache[os.path.basename(filename)][f"mask_{key}"] = detected_face.get_landmark_mask(
              self._size,
              key,
              aligned=True,
              centering=self._centering,
              dilation=self._size // 32,
              blur_kernel=self._size // 16,
              as_zip=True)
  
  
  class TrainingDataGenerator():  # pylint:disable=too-few-public-methods
      """ A Training Data Generator for compiling data for feeding to a model.
  
 
</s> remove         Parameters
        ----------
        filename: str
            The file path for the current image
        detected_face: :class:`lib.align.DetectedFace`
            The detected face object that holds the masks
        area: str
            `"eye"` or `"mouth"`. The area of the face to obtain the mask for
 </s> add         in_array: :class:`numpy.ndarray`
            The input uint8 array </s> remove class TrainingDataGenerator():  # pylint:disable=too-few-public-methods
 </s> add class TrainingDataGenerator(DataGenerator):  # pylint:disable=too-few-public-methods </s> remove     def _add_localized_mask(self, filename, detected_face, area):
        """ Load a localized mask to the cache for the given area if it is required for training.
 </s> add     def _to_float32(self, in_array: np.ndarray) -> np.ndarray:
        """ Cast an UINT8 array in 0-255 range to float32 in 0.0-1.0 range. </s> remove         logger.trace("Caching mask for: %s", filename)
        self._cache[key]["mask"] = mask
 </s> add         batch: :class:`numpy.ndarray`
            The pre-allocated batch with images in the first 3 channels in BGR order
        """
        if self._color_order == "rgb":
            batch[..., :3] = batch[..., [2, 1, 0]] </s> remove         Raises
        ------
        FaceswapError
            If the requested mask type is not available an error is returned along with a list
            of available masks
 </s> add         Returns
        -------
        list
            4-dimensional array of faces to feed the training the model.
        list
            List of 4-dimensional :class:`numpy.ndarray`. The number of channels here will vary.
            The first 3 channels are (rgb/bgr). The 4th channel is the face mask. Any subsequent
            channels are area masks (e.g. eye/mouth masks)
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
              The detected face object that holds the masks
          area: str
              `"eye"` or `"mouth"`. The area of the face to obtain the mask for
          """
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
        return ne.evaluate("x / c",
                           local_dict=dict(x=in_array, c=np.float32(255)),
                           casting="unsafe")
  
  
  class TrainingDataGenerator():  # pylint:disable=too-few-public-methods
      """ A Training Data Generator for compiling data for feeding to a model.
  
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Data Augmentation update (#1263)

- lib.detected_face
    - Subclass Masks for Landmark based masks
    - Add training mask propery + methods to DetectedFace
  - lib.training_training
    - subclass TrainingDataGenerator for training and preview data
    - Split cache into own module
    - Reduce thread count to 1 to prevent image corruption + data re-use
    - Process on largest model input/output size rather than stored image size
    - Size and crop masks during caching stage
    - Implement ring buffer for data flow
    - Fix preview reload bug
  - augmentation
    - typing
    - switch color aug order
    - better initialization
    - Fix warp + landmark warp to correctly apply at different image scales
    - Slightly improved warp caching
    - Don't store whether image is_preview. Handle all data as training images implicitly
  - plugins.trainer: Typing and fixes to work with trainingdata refactor 
lib/training/generator.py