utils/model.py
def _compute_losses(
        self,
        # Predictions
        l1_cls_preds, l2_cls_preds, l3_cls_preds,
        # Groundtruths
        l1_cls_gt, l2_cls_gt, l3_cls_gt,
    ):
        """Compute losses (including total loss) given loss weights"""

        l1_cls_loss = F.cross_entropy(l1_cls_preds, l1_cls_gt)
        l2_cls_loss = F.cross_entropy(l2_cls_preds, l2_cls_gt)
        l3_cls_loss = F.cross_entropy(l3_cls_preds, l3_cls_gt)

        # Total loss
        total_loss = 0
        for weight, loss in \
                zip(self.lambdas, [l1_cls_loss, l2_cls_loss, l3_cls_loss]):
            total_loss += weight * loss

        return {"total_loss": total_loss,
                "l1_cls_loss": l1_cls_loss, "l2_cls_loss": l2_cls_loss, "l3_cls_loss": l3_cls_loss}
Compute losses (including total loss) given loss weights
Compute losses (including total loss) given loss weights
Compute losses ( including total loss ) given loss weights
def _compute_losses(
        self,
        l1_cls_preds, l2_cls_preds, l3_cls_preds,
        l1_cls_gt, l2_cls_gt, l3_cls_gt,
    ):
        l1_cls_loss = F.cross_entropy(l1_cls_preds, l1_cls_gt)
        l2_cls_loss = F.cross_entropy(l2_cls_preds, l2_cls_gt)
        l3_cls_loss = F.cross_entropy(l3_cls_preds, l3_cls_gt)
        total_loss = 0
        for weight, loss in \
                zip(self.lambdas, [l1_cls_loss, l2_cls_loss, l3_cls_loss]):
            total_loss += weight * loss
        return {"total_loss": total_loss,
                "l1_cls_loss": l1_cls_loss, "l2_cls_loss": l2_cls_loss, "l3_cls_loss": l3_cls_loss}
def _compute_losses ( self , l1_cls_preds , l2_cls_preds , l3_cls_preds , l1_cls_gt , l2_cls_gt , l3_cls_gt , ) : l1_cls_loss = F . cross_entropy ( l1_cls_preds , l1_cls_gt ) l2_cls_loss = F . cross_entropy ( l2_cls_preds , l2_cls_gt ) l3_cls_loss = F . cross_entropy ( l3_cls_preds , l3_cls_gt ) total_loss = 0 for weight , loss in zip ( self . lambdas , [ l1_cls_loss , l2_cls_loss , l3_cls_loss ] ) : total_loss += weight * loss return { "total_loss" : total_loss , "l1_cls_loss" : l1_cls_loss , "l2_cls_loss" : l2_cls_loss , "l3_cls_loss" : l3_cls_loss }
Compute losses (including total loss) given loss weights
Compute losses ( including total loss ) given loss weights
# Predictions # Groundtruths """Compute losses (including total loss) given loss weights""" # Total loss
self
l1_cls_preds
l2_cls_preds
l3_cls_preds
l1_cls_gt
l2_cls_gt
l3_cls_gt