                   "\n\t62.5%% spans from eyebrow to eyebrow."
                   "\n\t75.0%% spans from temple to temple."
                   "\n\t87.5%% spans from ear to ear."
                   "\n\t100.0%% is a mugshot.")
          self.add_item(
              section=section,
              title="mask_type",
              datatype=str,
              default="extended",
              choices=PluginLoader.get_available_extractors("mask", add_none=True),
              group="mask",
              gui_radio=True,
              info="The mask to be used for training. If you have selected 'Learn Mask' or "
                   "'Penalized Mask Loss' you must select a value other than 'none'. The required "
                   "mask should have been selected as part of the Extract process. If it does not "
                   "exist in the alignments file then it will be generated prior to training "
                   "commencing."
                   "\n\tnone: Don't use a mask."
                   "\n\tcomponents: Mask designed to provide facial segmentation based on the "
                   "positioning of landmark locations. A convex hull is constructed around the "
                   "exterior of the landmarks to create a mask."
                   "\n\textended: Mask designed to provide facial segmentation based on the "
                   "positioning of landmark locations. A convex hull is constructed around the "
                   "exterior of the landmarks and the mask is extended upwards onto the forehead."
                   "\n\tvgg-clear: Mask designed to provide smart segmentation of mostly frontal "
                   "faces clear of obstructions. Profile faces and obstructions may result in "
                   "sub-par performance."
                   "\n\tvgg-obstructed: Mask designed to provide smart segmentation of mostly "
                   "frontal faces. The mask model has been specifically trained to recognize "
                   "some facial obstructions (hands and eyeglasses). Profile faces may result in "
                   "sub-par performance."
                   "\n\tunet-dfl: Mask designed to provide smart segmentation of mostly frontal "
                   "faces. The mask model has been trained by community members and will need "
                   "testing for further description. Profile faces may result in sub-par "
                   "performance.")
          self.add_item(
              section=section,
              title="mask_blur_kernel",
              datatype=int,
              min_max=(0, 9),
              rounding=1,
              default=3,
              group="mask",
              info="Apply gaussian blur to the mask input. This has the effect of smoothing the "
                   "edges of the mask, which can help with poorly calculated masks and give less "
                   "of a hard edge to the predicted mask. The size is in pixels (calculated from "
                   "a 128px mask). Set to 0 to not apply gaussian blur. This value should be odd, "
                   "if an even number is passed in then it will be rounded to the next odd number.")
          self.add_item(
              section=section,
              title="mask_threshold",
              datatype=int,
              default=4,
              min_max=(0, 50),
              rounding=1,
              group="mask",
              info="Sets pixels that are near white to white and near black to black. Set to 0 for "
                   "off.")
          self.add_item(
              section=section,
              title="learn_mask",
              datatype=bool,
              default=False,
              group="mask",
              info="Dedicate a portion of the model to learning how to duplicate the input "
                   "mask. Increases VRAM usage in exchange for learning a quick ability to try "
                   "to replicate more complex mask models.")
          self.add_item(
              section=section,
              title="penalized_mask_loss",
              datatype=bool,
              default=True,
              group="loss",
              info="Image loss function is weighted by mask presence. For areas of "
                   "the image without the facial mask, reconstuction errors will be "
                   "ignored while the masked face area is prioritized. May increase "
                   "overall quality by focusing attention on the core face area.")
          self.add_item(
              section=section,
              title="loss_function",
              datatype=str,
              group="loss",
              default="mae",
              choices=["mae", "mse", "logcosh", "smooth_loss", "l_inf_norm", "ssim", "gmsd",
                       "pixel_gradient_diff"],
              info="The loss function to use."
                   "\n\t MAE - Mean absolute error will guide reconstructions of each pixel "
                   "towards its median value in the training dataset. Robust to outliers but as "
                   "a median, it can potentially ignore some infrequent image types in the dataset."
                   "\n\t MSE - Mean squared error will guide reconstructions of each pixel "
                   "towards its average value in the training dataset. As an avg, it will be "
                   "suspectible to outliers and typically produces slightly blurrier results."
                   "\n\t LogCosh - log(cosh(x)) acts similiar to MSE for small errors and to "
                   "MAE for large errors. Like MSE, it is very stable and prevents overshoots "
                   "when errors are near zero. Like MAE, it is robust to outliers. NB: Due to a bug "
                   "in PlaidML, this loss does not work on AMD cards."
                   "\n\t Smooth_L1 --- Modification of the MAE loss to correct two of its "
                   "disadvantages. This loss has improved stability and guidance for small errors."
                   "\n\t L_inf_norm --- The L_inf norm will reduce the largest individual pixel "
                   "error in an image. As each largest error is minimized sequentially, the "
                   "overall error is improved. This loss will be extremely focused on outliers."
                   "\n\t SSIM - Structural Similarity Index Metric is a perception-based "
                   "loss that considers changes in texture, luminance, contrast, and local spatial "
                   "statistics of an image. Potentially delivers more realistic looking images."
                   "\n\t GMSD - Gradient Magnitude Similarity Deviation seeks to match "
                   "the global standard deviation of the pixel to pixel differences between two "
                   "images. Similiar in approach to SSIM. NB: This loss does not currently work on "
                   "AMD cards."
                   "\n\t Pixel_Gradient_Difference - Instead of minimizing the difference between "
                   "the absolute value of each pixel in two reference images, compute the pixel to "
                   "pixel spatial difference in each image and then minimize that difference "
                   "between two images. Allows for large color shifts,but maintains the structure "
                   "of the image.\n")
          self.add_item(
              section=section,
              title="icnr_init",
              datatype=bool,
              default=False,
 
</s> remove     @property
    def _selected_mask_loss(self):
        """ :func:`keras.losses.Loss`: The selected mask loss function. Currently returns mean
        standard error as the default function. """
        loss_func = self._loss_dict["mse"]
        logger.debug("loss_func: %s", loss_func)
        return loss_func

 </s> add  </s> remove     """ Holds loss names and functions for an Autoencoder.

    Parameters
    ----------
    inputs: list
        A list of input tensors to the model in the order ("a", "b")
    outputs: list
        A list of output tensors to the model in the order ("a", "b")
    """
    def __init__(self, inputs, outputs):
        logger.debug("Initializing %s: (inputs: %s, outputs: %s)",
                     self.__class__.__name__, inputs, outputs)
 </s> add     """ Holds loss names and functions for an Autoencoder. """
    def __init__(self):
        logger.debug("Initializing %s", self.__class__.__name__) </s> remove     def set_globals(self):
        """
        Set the global options for training

        Loss Documentation
        MAE https://heartbeat.fritz.ai/5-regression-loss-functions-all-machine
            -learners-should-know-4fb140e9d4b0
        MSE https://heartbeat.fritz.ai/5-regression-loss-functions-all-machine
            -learners-should-know-4fb140e9d4b0
        LogCosh https://heartbeat.fritz.ai/5-regression-loss-functions-all-machine
                -learners-should-know-4fb140e9d4b0
        Smooth L1 https://arxiv.org/pdf/1701.03077.pdf
        L_inf_norm https://medium.com/@montjoile/l0-norm-l1-norm-l2-norm-l-infinity
                   -norm-7a7d18a4f40c
        SSIM http://www.cns.nyu.edu/pub/eero/wang03-reprint.pdf
        GMSD https://arxiv.org/ftp/arxiv/papers/1308/1308.3052.pdf
        """
 </s> add     def _set_globals(self):
        """ Set the global options for training """ </s> remove         selected_loss = self._loss_dict[self._config.get("loss_function", "mae")]
 </s> add         selected_loss = self._loss_dict[self._config["loss_function"]]
        mask_loss = self._loss_dict[self._config["mask_loss_function"]]
                   "\n\t62.5%% spans from eyebrow to eyebrow."
                   "\n\t75.0%% spans from temple to temple."
                   "\n\t87.5%% spans from ear to ear."
                   "\n\t100.0%% is a mugshot.")













































































































          self.add_item(
              section=section,
              title="icnr_init",
              datatype=bool,
              default=False,
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Training Config - Split Loss to it's own section 
plugins/train/_config.py