Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
4fc516d2
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
You need to sign in or sign up before continuing.
未验证
提交
4fc516d2
编写于
8月 19, 2020
作者:
W
wangguanzhong
提交者:
GitHub
8月 19, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update elementwise api in fcos (#1245)
上级
18cdc508
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
12 deletion
+16
-12
ppdet/modeling/losses/fcos_loss.py
ppdet/modeling/losses/fcos_loss.py
+16
-12
未找到文件。
ppdet/modeling/losses/fcos_loss.py
浏览文件 @
4fc516d2
...
...
@@ -76,14 +76,14 @@ class FCOSLoss(object):
Return:
loss (Varialbes): location loss
"""
plw
=
pred
[:,
0
]
*
positive_mask
pth
=
pred
[:,
1
]
*
positive_mask
prw
=
pred
[:,
2
]
*
positive_mask
pbh
=
pred
[:,
3
]
*
positive_mask
tlw
=
targets
[:,
0
]
*
positive_mask
tth
=
targets
[:,
1
]
*
positive_mask
trw
=
targets
[:,
2
]
*
positive_mask
tbh
=
targets
[:,
3
]
*
positive_mask
plw
=
fluid
.
layers
.
elementwise_mul
(
pred
[:,
0
],
positive_mask
,
axis
=
0
)
pth
=
fluid
.
layers
.
elementwise_mul
(
pred
[:,
1
],
positive_mask
,
axis
=
0
)
prw
=
fluid
.
layers
.
elementwise_mul
(
pred
[:,
2
],
positive_mask
,
axis
=
0
)
pbh
=
fluid
.
layers
.
elementwise_mul
(
pred
[:,
3
],
positive_mask
,
axis
=
0
)
tlw
=
fluid
.
layers
.
elementwise_mul
(
targets
[:,
0
],
positive_mask
,
axis
=
0
)
tth
=
fluid
.
layers
.
elementwise_mul
(
targets
[:,
1
],
positive_mask
,
axis
=
0
)
trw
=
fluid
.
layers
.
elementwise_mul
(
targets
[:,
2
],
positive_mask
,
axis
=
0
)
tbh
=
fluid
.
layers
.
elementwise_mul
(
targets
[:,
3
],
positive_mask
,
axis
=
0
)
tlw
.
stop_gradient
=
True
trw
.
stop_gradient
=
True
tth
.
stop_gradient
=
True
...
...
@@ -101,7 +101,7 @@ class FCOSLoss(object):
area_inter
=
(
ilw
+
irw
)
*
(
ith
+
ibh
)
ious
=
(
area_inter
+
1.0
)
/
(
area_predict
+
area_target
-
area_inter
+
1.0
)
ious
=
ious
*
positive_mask
ious
=
fluid
.
layers
.
elementwise_mul
(
ious
,
positive_mask
,
axis
=
0
)
if
self
.
iou_loss_type
.
lower
()
==
"linear_iou"
:
loss
=
1.0
-
ious
elif
self
.
iou_loss_type
.
lower
()
==
"giou"
:
...
...
@@ -187,16 +187,20 @@ class FCOSLoss(object):
normalize_sum
.
stop_gradient
=
True
normalize_sum
=
fluid
.
layers
.
reduce_sum
(
mask_positive_float
*
normalize_sum
)
normalize_sum
.
stop_gradient
=
True
cls_loss
=
fluid
.
layers
.
sigmoid_focal_loss
(
cls_logits_flatten
,
tag_labels_flatten
,
num_positive_int32
)
/
num_positive_fp32
reg_loss
=
self
.
__iou_loss
(
bboxes_reg_flatten
,
tag_bboxes_flatten
,
mask_positive_float
,
tag_center_flatten
)
*
mask_positive_float
/
normalize_sum
reg_loss
=
self
.
__iou_loss
(
bboxes_reg_flatten
,
tag_bboxes_flatten
,
mask_positive_float
,
tag_center_flatten
)
reg_loss
=
fluid
.
layers
.
elementwise_mul
(
reg_loss
,
mask_positive_float
,
axis
=
0
)
/
normalize_sum
ctn_loss
=
fluid
.
layers
.
sigmoid_cross_entropy_with_logits
(
x
=
centerness_flatten
,
label
=
tag_center_flatten
)
*
mask_positive_float
/
num_positive_fp32
ctn_loss
=
fluid
.
layers
.
elementwise_mul
(
ctn_loss
,
mask_positive_float
,
axis
=
0
)
/
normalize_sum
loss_all
=
{
"loss_centerness"
:
fluid
.
layers
.
reduce_sum
(
ctn_loss
),
"loss_cls"
:
fluid
.
layers
.
reduce_sum
(
cls_loss
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录