Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
33f02d99
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
33f02d99
编写于
6月 10, 2020
作者:
D
dengkaipeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix comments
上级
0f148a62
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
19 addition
and
16 deletion
+19
-16
ppdet/modeling/losses/pisa_utils.py
ppdet/modeling/losses/pisa_utils.py
+1
-1
ppdet/modeling/losses/yolo_loss.py
ppdet/modeling/losses/yolo_loss.py
+18
-15
未找到文件。
ppdet/modeling/losses/pisa_utils.py
浏览文件 @
33f02d99
...
...
@@ -59,7 +59,7 @@ def get_isr_p_func(pos_iou_thresh=0.25, bias=0, k=2):
weight_factor
=
np
.
clip
(
max_l_num
-
l_max_iou_rank
,
0.
,
None
)
/
max_l_num
weight_factor
=
np
.
power
(
bias
+
(
1
-
bias
)
*
weight_factor
,
k
)
pos_weights
[
l_inds
]
*=
weight_factor
*
1.2
pos_weights
[
l_inds
]
*=
weight_factor
pos_weights
=
pos_weights
/
np
.
mean
(
pos_weights
)
all_pos_weights
[
pos_mask
]
=
pos_weights
...
...
ppdet/modeling/losses/yolo_loss.py
浏览文件 @
33f02d99
...
...
@@ -142,21 +142,24 @@ class YOLOv3Loss(object):
iou
=
self
.
_calc_iou
(
output
,
target
,
gt_box
,
anchors
,
batch_size
,
num_classes
,
downsample
,
scale_x_y
)
# sorted_iou, sorted_gt_inds = fluid.layers.argsort(iou, axis=-1, descending=True)
# max_iou = sorted_iou[:, :, 0:1]
# gt_inds = fluid.layers.cast(sorted_gt_inds[:, :, 0:1], dtype='float32')
# pred_cls = fluid.layers.argmax(cls, axis=-1)
# pred_cls = fluid.layers.reshape(pred_cls, [batch_size, -1, 1])
# pred_cls = fluid.layers.cast(pred_cls, dtype='float32')
# isr_p_input = fluid.layers.concat([max_iou, gt_inds, pred_cls], axis=-1)
# isr_p = get_isr_p_func()
# pos_weights = fluid.layers.zeros_like(max_iou)
# fluid.layers.py_func(isr_p, isr_p_input, pos_weights)
#
# tobj_shape = fluid.layers.shape(tobj)
# pos_weights = fluid.layers.reshape(pos_weights, (-1, an_num, tobj_shape[2],
# tobj_shape[3]))
# tobj = tobj * pos_weights
sorted_iou
,
sorted_gt_inds
=
fluid
.
layers
.
argsort
(
iou
,
axis
=-
1
,
descending
=
True
)
max_iou
=
sorted_iou
[:,
:,
0
:
1
]
gt_inds
=
fluid
.
layers
.
cast
(
sorted_gt_inds
[:,
:,
0
:
1
],
dtype
=
'float32'
)
pred_cls
=
fluid
.
layers
.
argmax
(
cls
,
axis
=-
1
)
pred_cls
=
fluid
.
layers
.
reshape
(
pred_cls
,
[
batch_size
,
-
1
,
1
])
pred_cls
=
fluid
.
layers
.
cast
(
pred_cls
,
dtype
=
'float32'
)
isr_p_input
=
fluid
.
layers
.
concat
(
[
max_iou
,
gt_inds
,
pred_cls
],
axis
=-
1
)
isr_p
=
get_isr_p_func
()
pos_weights
=
fluid
.
layers
.
zeros_like
(
max_iou
)
fluid
.
layers
.
py_func
(
isr_p
,
isr_p_input
,
pos_weights
)
tobj_shape
=
fluid
.
layers
.
shape
(
tobj
)
pos_weights
=
fluid
.
layers
.
reshape
(
pos_weights
,
(
-
1
,
an_num
,
tobj_shape
[
2
],
tobj_shape
[
3
]))
tobj
=
tobj
*
pos_weights
# isr_tobj = tobj * pos_weights
# loss_cls = fluid.layers.sigmoid_cross_entropy_with_logits(cls, tcls)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录