You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.nn.DiceLoss.rst 1.2 kB

1234567891011121314151617181920212223242526272829303132333435
  1. mindspore.nn.DiceLoss
  2. ======================
  3. .. py:class:: mindspore.nn.DiceLoss(smooth=1e-5)
  4. Dice系数是一个集合相似性loss,用于计算两个样本之间的相似性。当分割结果最好时,Dice系数的值为1,当分割结果最差时,Dice系数的值为0。
  5. Dice系数表示两个对象之间的面积与总面积的比率。
  6. 函数如下:
  7. .. math::
  8. dice = 1 - \frac{2 * |pred \bigcap true|}{|pred| + |true| + smooth}
  9. :math:`pred` 表示 `logits` , :math:`true` 表示 `labels` 。
  10. **参数:**
  11. - **smooth** (float) - 将添加到分母中,以提高数值稳定性的参数。取值大于0。默认值:1e-5。
  12. **输入:**
  13. - **logits** (Tensor) - 输入预测值,任意维度的Tensor。数据类型必须为float16或float32。
  14. - **labels** (Tensor) - 输入目标值,任意维度的Tensor,一般与 `logits` 的shape相同。 数据类型必须为float16或float32。
  15. **输出:**
  16. Tensor,shape为每样本采样的Dice系数的Tensor。
  17. **异常:**
  18. - **ValueError** - `logits` 的维度与 `labels` 不同。
  19. - **TypeError** - `logits` 或 `labels` 的类型不是Tensor。