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.1 kB

123456789101112131415161718192021222324252627282930313233
  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 \bigcup true}
  9. **参数:**
  10. - **smooth** (float) - 将添加到分母中,以提高数值稳定性的参数。取值大于0。默认值:1e-5。
  11. **输入:**
  12. - **logits** (Tensor) - 输入预测值,任意维度的Tensor。数据类型必须为float16或float32。
  13. - **labels** (Tensor) - 输入目标值,任意维度的Tensor,一般与 `logits` 的shape相同。 数据类型必须为float16或float32。
  14. **输出:**
  15. Tensor,shape为每样本采样的Dice loss的Tensor。
  16. **异常:**
  17. - **ValueError** - `logits` 的维度与 `labels` 不同。
  18. - **TypeError** - `logits` 或 `labels` 的类型不是Tensor。