Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
399b7846
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看板
提交
399b7846
编写于
9月 13, 2022
作者:
W
Wenyu
提交者:
GitHub
9月 13, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "add gt as proposals for cascade (#6901)"
This reverts commit
dafd365a
.
上级
78f27c28
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
8 addition
and
24 deletion
+8
-24
configs/vitdet/cascade_rcnn_vit_base_hrfpn_cae_1x_coco.yml
configs/vitdet/cascade_rcnn_vit_base_hrfpn_cae_1x_coco.yml
+0
-2
ppdet/modeling/heads/cascade_head.py
ppdet/modeling/heads/cascade_head.py
+4
-16
ppdet/modeling/proposal_generator/target.py
ppdet/modeling/proposal_generator/target.py
+2
-3
ppdet/modeling/proposal_generator/target_layer.py
ppdet/modeling/proposal_generator/target_layer.py
+2
-3
未找到文件。
configs/vitdet/cascade_rcnn_vit_base_hrfpn_cae_1x_coco.yml
浏览文件 @
399b7846
...
@@ -98,8 +98,6 @@ CascadeHead:
...
@@ -98,8 +98,6 @@ CascadeHead:
reg_class_agnostic
:
False
reg_class_agnostic
:
False
stage_loss_weights
:
[
1
,
0.5
,
0.25
]
stage_loss_weights
:
[
1
,
0.5
,
0.25
]
loss_normalize_pos
:
True
loss_normalize_pos
:
True
add_gt_as_proposals
:
[
True
,
True
,
True
]
BBoxAssigner
:
BBoxAssigner
:
batch_size_per_im
:
512
batch_size_per_im
:
512
...
...
ppdet/modeling/heads/cascade_head.py
浏览文件 @
399b7846
...
@@ -163,8 +163,7 @@ class CascadeHead(BBoxHead):
...
@@ -163,8 +163,7 @@ class CascadeHead(BBoxHead):
bbox_loss
=
None
,
bbox_loss
=
None
,
reg_class_agnostic
=
True
,
reg_class_agnostic
=
True
,
stage_loss_weights
=
None
,
stage_loss_weights
=
None
,
loss_normalize_pos
=
False
,
loss_normalize_pos
=
False
):
add_gt_as_proposals
=
[
True
,
False
,
False
]):
nn
.
Layer
.
__init__
(
self
,
)
nn
.
Layer
.
__init__
(
self
,
)
self
.
head
=
head
self
.
head
=
head
...
@@ -180,8 +179,6 @@ class CascadeHead(BBoxHead):
...
@@ -180,8 +179,6 @@ class CascadeHead(BBoxHead):
self
.
stage_loss_weights
=
[
self
.
stage_loss_weights
=
[
1.
/
num_cascade_stages
for
_
in
range
(
num_cascade_stages
)
1.
/
num_cascade_stages
for
_
in
range
(
num_cascade_stages
)
]
if
stage_loss_weights
is
None
else
stage_loss_weights
]
if
stage_loss_weights
is
None
else
stage_loss_weights
self
.
add_gt_as_proposals
=
add_gt_as_proposals
assert
len
(
assert
len
(
self
.
stage_loss_weights
self
.
stage_loss_weights
)
==
num_cascade_stages
,
f
'stage_loss_weights(
{
len
(
self
.
stage_loss_weights
)
}
) do not equal to num_cascade_stages(
{
num_cascade_stages
}
)'
)
==
num_cascade_stages
,
f
'stage_loss_weights(
{
len
(
self
.
stage_loss_weights
)
}
) do not equal to num_cascade_stages(
{
num_cascade_stages
}
)'
...
@@ -224,11 +221,7 @@ class CascadeHead(BBoxHead):
...
@@ -224,11 +221,7 @@ class CascadeHead(BBoxHead):
"""
"""
targets
=
[]
targets
=
[]
if
self
.
training
:
if
self
.
training
:
rois
,
rois_num
,
targets
=
self
.
bbox_assigner
(
rois
,
rois_num
,
targets
=
self
.
bbox_assigner
(
rois
,
rois_num
,
inputs
)
rois
,
rois_num
,
inputs
,
add_gt_as_proposals
=
self
.
add_gt_as_proposals
[
0
])
targets_list
=
[
targets
]
targets_list
=
[
targets
]
self
.
assigned_rois
=
(
rois
,
rois_num
)
self
.
assigned_rois
=
(
rois
,
rois_num
)
self
.
assigned_targets
=
targets
self
.
assigned_targets
=
targets
...
@@ -241,12 +234,7 @@ class CascadeHead(BBoxHead):
...
@@ -241,12 +234,7 @@ class CascadeHead(BBoxHead):
inputs
[
'im_shape'
])
inputs
[
'im_shape'
])
if
self
.
training
:
if
self
.
training
:
rois
,
rois_num
,
targets
=
self
.
bbox_assigner
(
rois
,
rois_num
,
targets
=
self
.
bbox_assigner
(
rois
,
rois
,
rois_num
,
inputs
,
i
,
is_cascade
=
True
)
rois_num
,
inputs
,
i
,
is_cascade
=
True
,
add_gt_as_proposals
=
self
.
add_gt_as_proposals
[
i
])
targets_list
.
append
(
targets
)
targets_list
.
append
(
targets
)
rois_feat
=
self
.
roi_extractor
(
body_feats
,
rois
,
rois_num
)
rois_feat
=
self
.
roi_extractor
(
body_feats
,
rois
,
rois_num
)
...
@@ -318,7 +306,7 @@ class CascadeHead(BBoxHead):
...
@@ -318,7 +306,7 @@ class CascadeHead(BBoxHead):
# num_or_sections in paddle.split does not support LoDTensorArray,
# num_or_sections in paddle.split does not support LoDTensorArray,
# so we use [-1] to replace it if num_prop is not list. The modification
# so we use [-1] to replace it if num_prop is not list. The modification
# This ensures the correctness of both dynamic and static graphs.
# This ensures the correctness of both dynamic and static graphs.
if
not
isinstance
(
num_prop
,
list
):
if
not
isinstance
(
num_prop
,
list
):
num_prop
=
[
-
1
]
num_prop
=
[
-
1
]
return
pred_bbox
.
split
(
num_prop
)
return
pred_bbox
.
split
(
num_prop
)
...
...
ppdet/modeling/proposal_generator/target.py
浏览文件 @
399b7846
...
@@ -186,8 +186,7 @@ def generate_proposal_target(rpn_rois,
...
@@ -186,8 +186,7 @@ def generate_proposal_target(rpn_rois,
use_random
=
True
,
use_random
=
True
,
is_cascade
=
False
,
is_cascade
=
False
,
cascade_iou
=
0.5
,
cascade_iou
=
0.5
,
assign_on_cpu
=
False
,
assign_on_cpu
=
False
):
add_gt_as_proposals
=
True
):
rois_with_gt
=
[]
rois_with_gt
=
[]
tgt_labels
=
[]
tgt_labels
=
[]
...
@@ -205,7 +204,7 @@ def generate_proposal_target(rpn_rois,
...
@@ -205,7 +204,7 @@ def generate_proposal_target(rpn_rois,
gt_class
=
paddle
.
squeeze
(
gt_classes
[
i
],
axis
=-
1
)
gt_class
=
paddle
.
squeeze
(
gt_classes
[
i
],
axis
=-
1
)
# Concat RoIs and gt boxes except cascade rcnn or none gt
# Concat RoIs and gt boxes except cascade rcnn or none gt
if
add_gt_as_proposals
and
gt_bbox
.
shape
[
0
]
>
0
:
if
not
is_cascade
and
gt_bbox
.
shape
[
0
]
>
0
:
bbox
=
paddle
.
concat
([
rpn_roi
,
gt_bbox
])
bbox
=
paddle
.
concat
([
rpn_roi
,
gt_bbox
])
else
:
else
:
bbox
=
rpn_roi
bbox
=
rpn_roi
...
...
ppdet/modeling/proposal_generator/target_layer.py
浏览文件 @
399b7846
...
@@ -156,8 +156,7 @@ class BBoxAssigner(object):
...
@@ -156,8 +156,7 @@ class BBoxAssigner(object):
rpn_rois_num
,
rpn_rois_num
,
inputs
,
inputs
,
stage
=
0
,
stage
=
0
,
is_cascade
=
False
,
is_cascade
=
False
):
add_gt_as_proposals
=
True
):
gt_classes
=
inputs
[
'gt_class'
]
gt_classes
=
inputs
[
'gt_class'
]
gt_boxes
=
inputs
[
'gt_bbox'
]
gt_boxes
=
inputs
[
'gt_bbox'
]
is_crowd
=
inputs
.
get
(
'is_crowd'
,
None
)
is_crowd
=
inputs
.
get
(
'is_crowd'
,
None
)
...
@@ -167,7 +166,7 @@ class BBoxAssigner(object):
...
@@ -167,7 +166,7 @@ class BBoxAssigner(object):
rpn_rois
,
gt_classes
,
gt_boxes
,
self
.
batch_size_per_im
,
rpn_rois
,
gt_classes
,
gt_boxes
,
self
.
batch_size_per_im
,
self
.
fg_fraction
,
self
.
fg_thresh
,
self
.
bg_thresh
,
self
.
num_classes
,
self
.
fg_fraction
,
self
.
fg_thresh
,
self
.
bg_thresh
,
self
.
num_classes
,
self
.
ignore_thresh
,
is_crowd
,
self
.
use_random
,
is_cascade
,
self
.
ignore_thresh
,
is_crowd
,
self
.
use_random
,
is_cascade
,
self
.
cascade_iou
[
stage
],
self
.
assign_on_cpu
,
add_gt_as_proposals
)
self
.
cascade_iou
[
stage
],
self
.
assign_on_cpu
)
rois
=
outs
[
0
]
rois
=
outs
[
0
]
rois_num
=
outs
[
-
1
]
rois_num
=
outs
[
-
1
]
# tgt_labels, tgt_bboxes, tgt_gt_inds
# tgt_labels, tgt_bboxes, tgt_gt_inds
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录