          ----------
          output_names: list
              The output names from the model
          """
          selected_loss = self._loss_dict[self._config["loss_function"]]
          for name, output_name in zip(self._names, output_names):
              if name.startswith("mask"):
                  loss_func = self._loss_dict[self._config["mask_loss_function"]]
              else:
                  if (self._config["loss_function"] in self._uses_l2_reg
 
</s> remove                 if (self._config["loss_function"] in self._uses_l2_reg
                        and self._config["l2_reg_term"] != 0):
                    loss_funcs = [selected_loss, self._loss_dict["mse"]]
                    loss_weights = [1.0, self._config["l2_reg_term"] / 100.0]
                else:
                    loss_funcs = [selected_loss]
                    loss_weights = [1.0]

                if self._config["penalized_mask_loss"]:
                    loss_funcs = [losses.PenalizedLoss(loss) for loss in loss_funcs]

                loss_func = losses.LossWrapper(loss_functions=list(zip(loss_funcs, loss_weights)))
 </s> add                 loss_func = losses.LossWrapper()
                loss_func.add_loss(face_loss, mask_channel=mask_channels[0])
                self._add_l2_regularization_term(loss_func, mask_channels[0])

                mask_channel = 1
                for multiplier in ("eye_multiplier", "mouth_multiplier"):
                    if self._config[multiplier] > 1:
                        loss_func.add_loss(face_loss,
                                           weight=self._config[multiplier] * 1.0,
                                           mask_channel=mask_channels[mask_channel])
                        self._add_l2_regularization_term(loss_func, mask_channel)
                    mask_channel += 1 </s> remove         masks = targets[-1]
        for idx, tgt in enumerate(targets[:-1]):
 </s> add         if not self._model.config["penalized_mask_loss"] and additional_masks is None:
            logger.trace("No masks to compile. Returning targets")
            return targets

        if not self._model.config["penalized_mask_loss"] and additional_masks is not None:
            masks = additional_masks
        elif additional_masks is not None:
            masks = np.concatenate((masks, additional_masks), axis=-1)

        for idx, tgt in enumerate(targets): </s> remove     def _get_next(self, side):
        """ Return the next batch from the :class:`lib.training_data.TrainingDataGenerator` for
        this feeder ready for feeding into the model.

        Returns
        -------
        model_inputs: list
            A list of :class:`numpy.ndarray` for feeding into the model
        model_targets: list
            A list of :class:`numpy.ndarray` for comparing the output of the model
        """
        logger.trace("Generating targets")
        batch = next(self._feeds[side])
        targets_use_mask = (self._model.config["learn_mask"]
                            or self._model.config["penalized_mask_loss"])
        model_targets = batch["targets"] + batch["masks"] if targets_use_mask else batch["targets"]
        return batch["feed"], model_targets

    @classmethod
    def _compile_masks(cls, targets):
        """ Compile the masks into the targets for penalized loss.
 </s> add     def _compile_mask_targets(self, targets, masks, additional_masks):
        """ Compile the masks into the targets for penalized loss and for targeted learning. </s> remove             side_inputs, side_targets = self._get_next(side)
            if self._model.config["penalized_mask_loss"]:
                side_targets = self._compile_masks(side_targets)
                if not self._model.config["learn_mask"]:  # Remove masks from the model targets
                    side_targets = side_targets[:-1]
 </s> add             batch = next(self._feeds[side])
            side_inputs = batch["feed"]
            side_targets = self._compile_mask_targets(batch["targets"],
                                                      batch["masks"],
                                                      batch.get("additional_masks", None))
            if self._model.config["learn_mask"]:
                side_targets = side_targets + [batch["masks"]] </s> remove         loss_functions: list
            A list of either a tuple of (:class:`keras.losses.Loss`, scalar weight) or just a
            :class:`keras.losses.Loss` function. If just the loss function is passed, then the
            weight is assumed to be 1.0 """
        for loss_func in loss_functions:
            if isinstance(loss_func, tuple):
                assert len(loss_func) == 2, "Tuple loss functions should contain 2 items"
                assert isinstance(loss_func[1], float), "weight should be a float"
                func, weight = loss_func
            else:
                func = loss_func
                weight = 1.0
            self._loss_functions.append(compile_utils.LossesContainer(func))
            self._loss_weights.append(weight)
        logger.debug("Compiled losses: (functions: %s, weights: %s",
                     self._loss_functions, self._loss_weights)
 </s> add         function: :class:`keras.losses.Loss`
            The loss function to add to the loss chain
        weight: float, optional
            The weighting to apply to the loss function. Default: `1.0`
        mask_channel: int, optional
            The channel in the `y_true` image that the mask exists in. Set to `-1` if there is no
            mask for the given loss function. Default: `-1`
        """
        logger.debug("Adding loss: (function: %s, weight: %s, mask_channel: %s)",
                     function, weight, mask_channel)
        self._loss_functions.append(compile_utils.LossesContainer(function))
        self._loss_weights.append(weight)
        self._mask_channels.append(mask_channel)
        mask_channels = self._get_mask_channels()
        face_loss = self._loss_dict[self._config["loss_function"]]

          ----------
          output_names: list
              The output names from the model
          """
        mask_channels = self._get_mask_channels()
        face_loss = self._loss_dict[self._config["loss_function"]]

          for name, output_name in zip(self._names, output_names):
              if name.startswith("mask"):
                  loss_func = self._loss_dict[self._config["mask_loss_function"]]
              else:
                  if (self._config["loss_function"] in self._uses_l2_reg
keep keep keep keep replace keep keep keep keep keep
 Add Mouth and Eye Priority to Loss options (#1054)

* Priority Training for Mouth and Eyes - Tensorflow

* Use chosen loss function for area multipliers

* loss multipliers for AMD

* Fix mask multipliers for plaid and roll PenalizedMaskLoss into LossWrapper

* losses_tf: roll PenalizedMaskLoss into LossWrapper 
plugins/train/model/_base.py