Shortcuts

MaskedDiceLoss

class mmocr.models.common.MaskedDiceLoss(eps=1e-06)[源代码]

Masked dice loss.

参数

eps (float, optional) – Eps to avoid zero-divison error. Defaults to 1e-6.

返回类型

None

forward(pred, gt, mask=None)[源代码]

Forward function.

参数
  • pred (torch.Tensor) – The prediction in any shape.

  • gt (torch.Tensor) – The learning target of the prediction in the same shape as pred.

  • mask (torch.Tensor, optional) – Binary mask in the same shape of pred, indicating positive regions to calculate the loss. Whole region will be taken into account if not provided. Defaults to None.

返回

The loss value.

返回类型

torch.Tensor

Read the Docs v: latest
Versions
latest
stable
0.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.