(self, proposals, mask_logits, targets)
return mask_loss
Arguments:
            proposals (list[BoxList])
            mask_logits (Tensor)
            targets (list[BoxList])

        Return:
            mask_loss (Tensor): scalar tensor containing the loss
Arguments:
            proposals (list[BoxList])
            mask_logits (Tensor)
            targets (list[BoxList])
Arguments : proposals ( list [ BoxList ] ) mask_logits ( Tensor ) targets ( list [ BoxList ] )
def __call__(self, proposals, mask_logits, targets):
        """
        Arguments:
            proposals (list[BoxList])
            mask_logits (Tensor)
            targets (list[BoxList])

        Return:
            mask_loss (Tensor): scalar tensor containing the loss
        """
        labels, mask_targets = self.prepare_targets(proposals, targets)

        labels = cat(labels, dim=0)
        mask_targets = cat(mask_targets, dim=0)

        positive_inds = torch.nonzero(labels > 0).squeeze(1)
        labels_pos = labels[positive_inds]

        # torch.mean (in binary_cross_entropy_with_logits) doesn't
        # accept empty tensors, so handle it separately
        if mask_targets.numel() == 0:
            return mask_logits.sum() * 0

        mask_loss = F.binary_cross_entropy_with_logits(
            mask_logits[positive_inds, labels_pos], mask_targets
        )
        return mask_loss
def __call__ ( self , proposals , mask_logits , targets ) : labels , mask_targets = self . prepare_targets ( proposals , targets ) labels = cat ( labels , dim = 0 ) mask_targets = cat ( mask_targets , dim = 0 ) positive_inds = torch . nonzero ( labels > 0 ) . squeeze ( 1 ) labels_pos = labels [ positive_inds ] # torch.mean (in binary_cross_entropy_with_logits) doesn't # accept empty tensors, so handle it separately if mask_targets . numel ( ) == 0 : return mask_logits . sum ( ) * 0 mask_loss = F . binary_cross_entropy_with_logits ( mask_logits [ positive_inds , labels_pos ] , mask_targets ) return mask_loss