  
      def get_loss_functions(self, mask):
          """ Set the loss function """
          loss_funcs = []
          largest_face = self.largest_output
          loss_dict = {'mae':                     losses.mean_absolute_error,
                       'mse':                     losses.mean_squared_error,
                       'logcosh':                 losses.logcosh,
                       'smooth_l1':               generalized_loss,
                       'l_inf_norm':              l_inf_norm,
                       'ssim':                    DSSIMObjective(),
                       'gmsd':                    gmsd_loss,
                       'pixel_gradient_diff':     gradient_loss}
          img_loss_config = self.config.get("loss_function", "mae")
          mask_loss_config = "mse"
  
          for idx, loss_name in enumerate(self.names):
              if loss_name.startswith("mask"):
                  loss_funcs.append(loss_dict[mask_loss_config])
                  logger.debug("mask loss: %s", mask_loss_config)
              elif mask and idx == largest_face and self.config.get("penalized_mask_loss", False):
 
</s> remove     def get_loss_functions(self, mask):
 </s> add     def get_loss_functions(self): </s> remove                 loss_funcs.append(loss_dict[mask_loss_config])
                logger.debug("mask loss: %s", mask_loss_config)
            elif mask and idx == largest_face and self.config.get("penalized_mask_loss", False):
                loss_funcs.append(PenalizedLoss(mask[0], loss_dict[img_loss_config]))
                logger.debug("final face loss: %s", img_loss_config)
 </s> add                 loss_funcs.append(self.selected_mask_loss)
            elif self.mask_input is not None and self.config.get("penalized_mask_loss", False):
                face_size = self.output_shapes[idx][1]
                mask_size = self.mask_shape[1]
                scaling = face_size / mask_size
                logger.debug("face_size: %s mask_size: %s, mask_scaling: %s",
                             face_size, mask_size, scaling)
                loss_funcs.append(PenalizedLoss(self.mask_input, self.selected_loss,
                                                mask_scaling=scaling)) </s> remove                 loss_funcs.append(loss_dict[img_loss_config])
                logger.debug("face loss func: %s", img_loss_config)
 </s> add                 loss_funcs.append(self.selected_loss)
            logger.debug("%s: %s", loss_name, loss_funcs[-1]) </s> remove     def largest_output(self):
        """ Return the index of the largest face output """
        max_size = max(shape[0] for shape in self.loss_shapes if shape[2] == 3)
        largest_idx = [idx for idx, shape in enumerate(self.loss_shapes)
                       if shape[0] == max_size and shape[2] == 3][0]
        return largest_idx
 </s> add     def mask_input(self):
        """ Return the mask input or None """
        mask_inputs = [inp for inp in self.inputs if inp.name.startswith("mask")]
        if not mask_inputs:
            return None
        return mask_inputs[0]

    @property
    def mask_shape(self):
        """ Return the mask shape """
        if self.mask_input is None:
            return None
        return K.int_shape(self.mask_input)[1:] </s> remove         output_types = ["mask" if shape[-1] == 1 else "face" for shape in self.loss_shapes]
 </s> add         output_types = ["mask" if shape[-1] == 1 else "face" for shape in self.output_shapes]
  
      def get_loss_functions(self, mask):
          """ Set the loss function """
          loss_funcs = []












          for idx, loss_name in enumerate(self.names):
              if loss_name.startswith("mask"):
                  loss_funcs.append(loss_dict[mask_loss_config])
                  logger.debug("mask loss: %s", mask_loss_config)
              elif mask and idx == largest_face and self.config.get("penalized_mask_loss", False):
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Fix penalized loss for multiscale decoders 
plugins/train/model/_base.py