Python mmdet.core.mask_cross_entropy() Examples
The following are 6
code examples of mmdet.core.mask_cross_entropy().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
mmdet.core
, or try the search function
.
Example #1
Source File: fcn_mask_head.py From Grid-R-CNN with Apache License 2.0 | 5 votes |
def loss(self, mask_pred, mask_targets, labels): loss = dict() if self.class_agnostic: loss_mask = mask_cross_entropy(mask_pred, mask_targets, torch.zeros_like(labels)) else: loss_mask = mask_cross_entropy(mask_pred, mask_targets, labels) loss['loss_mask'] = loss_mask return loss
Example #2
Source File: fcn_mask_head.py From Reasoning-RCNN with Apache License 2.0 | 5 votes |
def loss(self, mask_pred, mask_targets, labels): loss = dict() if self.class_agnostic: loss_mask = mask_cross_entropy(mask_pred, mask_targets, torch.zeros_like(labels)) else: loss_mask = mask_cross_entropy(mask_pred, mask_targets, labels) loss['loss_mask'] = loss_mask return loss
Example #3
Source File: fcn_mask_head.py From kaggle-imaterialist with MIT License | 5 votes |
def loss(self, mask_pred, mask_targets, labels): loss = dict() if self.class_agnostic: loss_mask = mask_cross_entropy(mask_pred, mask_targets, torch.zeros_like(labels)) else: loss_mask = mask_cross_entropy(mask_pred, mask_targets, labels) loss['loss_mask'] = loss_mask return loss
Example #4
Source File: fcn_mask_head.py From hrnet with MIT License | 5 votes |
def loss(self, mask_pred, mask_targets, labels): loss = dict() if self.class_agnostic: loss_mask = mask_cross_entropy(mask_pred, mask_targets, torch.zeros_like(labels)) else: loss_mask = mask_cross_entropy(mask_pred, mask_targets, labels) loss['loss_mask'] = loss_mask return loss
Example #5
Source File: fcn_mask_head.py From AugFPN with Apache License 2.0 | 5 votes |
def loss(self, mask_pred, mask_targets, labels): loss = dict() if self.class_agnostic: loss_mask = mask_cross_entropy(mask_pred, mask_targets, torch.zeros_like(labels)) else: loss_mask = mask_cross_entropy(mask_pred, mask_targets, labels) loss['loss_mask'] = loss_mask return loss
Example #6
Source File: fcn_mask_head.py From AugFPN with Apache License 2.0 | 5 votes |
def loss_aux(self, mask_pred, mask_targets, labels, alpha=0.25): loss = dict() mask_pred_level0 = mask_pred[0::4,:] mask_pred_level1 = mask_pred[1::4,:] mask_pred_level2 = mask_pred[2::4,:] mask_pred_level3 = mask_pred[3::4,:] if self.class_agnostic: loss_mask_level0 = mask_cross_entropy(mask_pred_level0, mask_targets, torch.zeros_like(labels)) loss_mask_level1 = mask_cross_entropy(mask_pred_level1, mask_targets, torch.zeros_like(labels)) loss_mask_level2 = mask_cross_entropy(mask_pred_level2, mask_targets, torch.zeros_like(labels)) loss_mask_level3 = mask_cross_entropy(mask_pred_level3, mask_targets, torch.zeros_like(labels)) else: loss_mask_level0 = mask_cross_entropy(mask_pred_level0, mask_targets, labels) loss_mask_level1 = mask_cross_entropy(mask_pred_level1, mask_targets, labels) loss_mask_level2 = mask_cross_entropy(mask_pred_level2, mask_targets, labels) loss_mask_level3 = mask_cross_entropy(mask_pred_level3, mask_targets, labels) loss['loss_mask_level0'] = loss_mask_level0 * alpha loss['loss_mask_level1'] = loss_mask_level1 * alpha loss['loss_mask_level2'] = loss_mask_level2 * alpha loss['loss_mask_level3'] = loss_mask_level3 * alpha return loss