From 01d6e54708df388e6f7f2fd25a1286d40903d6e5 Mon Sep 17 00:00:00 2001 From: FlyingQianMM <245467267@qq.com> Date: Wed, 15 Apr 2020 11:44:28 +0800 Subject: [PATCH] add int type for gamma and alpha of sigmoid_focal_loss (#1984) * fix sample code diff for OP(retinanet_detection_output, retinanet_target_assign), fix default value for OP(sigmoid_focal_loss). test=develop * fix float value. test=develop * add int type for gamma and alpha of sigmoid_focal_loss.test=develop --- doc/fluid/api_cn/layers_cn/sigmoid_focal_loss_cn.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/fluid/api_cn/layers_cn/sigmoid_focal_loss_cn.rst b/doc/fluid/api_cn/layers_cn/sigmoid_focal_loss_cn.rst index 0dd282715..43baa30ad 100644 --- a/doc/fluid/api_cn/layers_cn/sigmoid_focal_loss_cn.rst +++ b/doc/fluid/api_cn/layers_cn/sigmoid_focal_loss_cn.rst @@ -28,8 +28,8 @@ Focal Loss的计算过程如下: - **x** (Variable) – 维度为 :math:`[N, C]` 的2-D Tensor,表示全部样本的分类预测值。其中,第一维N是批量内参与训练的样本数量,例如在目标检测中,样本为框级别,N为批量内所有图像的正负样本的数量总和;在图像分类中,样本为图像级别,N为批量内的图像数量总和。第二维:math:`C` 是类别数量( **不包括背景类** )。数据类型为float32或float64。 - **label** (Variable) – 维度为 :math:`[N, 1]` 的2-D Tensor,表示全部样本的分类目标值。其中,第一维N是批量内参与训练的样本数量,第二维1表示每个样本只有一个类别目标值。正样本的目标类别值的取值范围是 :math:`[1, C]` , 负样本的目标类别值是0。数据类型为int32。 - **fg_num** (Variable) – 维度为 :math:`[1]` 的1-D Tensor,表示批量内正样本的数量,需在进入此OP前获取正样本的数量。数据类型为int32。 - - **gamma** (float) – 用于平衡易分样本和难分样本的超参数, 默认值设置为2.0。 - - **alpha** (float) – 用于平衡正样本和负样本的超参数,默认值设置为0.25。 + - **gamma** (int|float) – 用于平衡易分样本和难分样本的超参数, 默认值设置为2.0。 + - **alpha** (int|float) – 用于平衡正样本和负样本的超参数,默认值设置为0.25。 返回: 输入x中每个元素的Focal loss,即维度为 :math:`[N, C]` 的2-D Tensor。 -- GitLab