未验证 提交 79e661e5 编写于 作者: F FlyingQianMM 提交者: GitHub

fix sample code diff for OP(retinanet_detection_output,...

fix sample code diff for OP(retinanet_detection_output, retinanet_target_assign), fix `gamma` default value for OP(sigmoid_focal_loss) (#1971)

* 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
上级 7421aaa7
......@@ -34,27 +34,27 @@ retinanet_detection_output
import paddle.fluid as fluid
bboxes_low = fluid.data(name='bboxes_low', shape=[1, 44, 4],
dtype='float32')
bboxes_high = fluid.data(name='bboxes_high', shape=[1, 11, 4],
dtype='float32')
scores_low = fluid.data(name='scores_low', shape=[1, 44, 10],
dtype='float32')
scores_high = fluid.data(name='scores_high', shape=[1, 11, 10],
dtype='float32')
anchors_low = fluid.data(name='anchors_low', shape=[44, 4],
dtype='float32')
anchors_high = fluid.data(name='anchors_high', shape=[11, 4],
dtype='float32')
im_info = fluid.data(name="im_info", shape=[1, 3],
dtype='float32')
bboxes_low = fluid.data(
name='bboxes_low', shape=[1, 44, 4], dtype='float32')
bboxes_high = fluid.data(
name='bboxes_high', shape=[1, 11, 4], dtype='float32')
scores_low = fluid.data(
name='scores_low', shape=[1, 44, 10], dtype='float32')
scores_high = fluid.data(
name='scores_high', shape=[1, 11, 10], dtype='float32')
anchors_low = fluid.data(
name='anchors_low', shape=[44, 4], dtype='float32')
anchors_high = fluid.data(
name='anchors_high', shape=[11, 4], dtype='float32')
im_info = fluid.data(
name="im_info", shape=[1, 3], dtype='float32')
nmsed_outs = fluid.layers.retinanet_detection_output(
bboxes=[bboxes_low, bboxes_high],
scores=[scores_low, scores_high],
anchors=[anchors_low, anchors_high],
im_info=im_info,
score_threshold=0.05,
nms_top_k=1000,
keep_top_k=100,
nms_threshold=0.45,
nms_eta=1.)
bboxes=[bboxes_low, bboxes_high],
scores=[scores_low, scores_high],
anchors=[anchors_low, anchors_high],
im_info=im_info,
score_threshold=0.05,
nms_top_k=1000,
keep_top_k=100,
nms_threshold=0.45,
nms_eta=1.0)
......@@ -50,7 +50,6 @@ retinanet_target_assign
.. code-block:: python
import paddle.fluid as fluid
import numpy as np
bbox_pred = fluid.data(name='bbox_pred', shape=[1, 100, 4],
dtype='float32')
......
......@@ -3,7 +3,7 @@
sigmoid_focal_loss
-------------------------------
.. py:function:: paddle.fluid.layers.sigmoid_focal_loss(x, label, fg_num, gamma=2, alpha=0.25)
.. py:function:: paddle.fluid.layers.sigmoid_focal_loss(x, label, fg_num, gamma=2.0, alpha=0.25)
`Focal Loss <https://arxiv.org/abs/1708.02002>`_ 被提出用于解决计算机视觉任务中前景-背景不平衡的问题。该OP先计算输入x中每个元素的sigmoid值,然后计算sigmoid值与类别目标值label之间的Focal Loss。
......@@ -49,5 +49,5 @@ Focal Loss的计算过程如下:
loss = fluid.layers.sigmoid_focal_loss(x=input,
label=label,
fg_num=fg_num,
gamma=2.,
gamma=2.0,
alpha=0.25)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册