Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
bd7838d0
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看板
未验证
提交
bd7838d0
编写于
8月 08, 2021
作者:
C
cnn
提交者:
GitHub
8月 08, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix detach bug (#3913)
上级
a5873d38
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
24 deletion
+20
-24
configs/dota/README.md
configs/dota/README.md
+2
-1
configs/dota/s2anet_1x_spine.yml
configs/dota/s2anet_1x_spine.yml
+1
-0
configs/dota/s2anet_alignconv_2x_dota.yml
configs/dota/s2anet_alignconv_2x_dota.yml
+1
-0
configs/dota/s2anet_conv_2x_dota.yml
configs/dota/s2anet_conv_2x_dota.yml
+1
-0
ppdet/modeling/heads/s2anet_head.py
ppdet/modeling/heads/s2anet_head.py
+15
-23
未找到文件。
configs/dota/README.md
浏览文件 @
bd7838d0
...
@@ -121,7 +121,7 @@ python3.7 tools/infer.py -c configs/dota/s2anet_1x_spine.yml -o weights=output/s
...
@@ -121,7 +121,7 @@ python3.7 tools/infer.py -c configs/dota/s2anet_1x_spine.yml -o weights=output/s
### 5. DOTA数据评估
### 5. DOTA数据评估
执行如下命令,会在
`output`
文件夹下将每个图像预测结果保存到同文件夹名的txt文本中。
执行如下命令,会在
`output`
文件夹下将每个图像预测结果保存到同文件夹名的txt文本中。
```
```
python3.7 tools/infer.py -c configs/dota/s2anet_
1x_dota.yml -o weights=./weights/s2anet_1
x_dota.pdparams --infer_dir=dota_test_images --draw_threshold=0.05 --save_txt=True --output_dir=output
python3.7 tools/infer.py -c configs/dota/s2anet_
alignconv_2x_dota.yml -o weights=./weights/s2anet_alignconv_2
x_dota.pdparams --infer_dir=dota_test_images --draw_threshold=0.05 --save_txt=True --output_dir=output
```
```
请参考
[
DOTA_devkit
](
https://github.com/CAPTAIN-WHU/DOTA_devkit
)
生成评估文件,评估文件格式请参考
[
DOTA Test
](
http://captain.whu.edu.cn/DOTAweb/tasks.html
)
,生成zip文件,每个类一个txt文件,txt文件中每行格式为:
`image_id score x1 y1 x2 y2 x3 y3 x4 y4`
,提交服务器进行评估。
请参考
[
DOTA_devkit
](
https://github.com/CAPTAIN-WHU/DOTA_devkit
)
生成评估文件,评估文件格式请参考
[
DOTA Test
](
http://captain.whu.edu.cn/DOTAweb/tasks.html
)
,生成zip文件,每个类一个txt文件,txt文件中每行格式为:
`image_id score x1 y1 x2 y2 x3 y3 x4 y4`
,提交服务器进行评估。
...
@@ -144,6 +144,7 @@ Paddle中`multiclass_nms`算子的输入支持四边形输入,因此部署时
...
@@ -144,6 +144,7 @@ Paddle中`multiclass_nms`算子的输入支持四边形输入,因此部署时
部署教程请参考
[
预测部署
](
../../deploy/README.md
)
部署教程请参考
[
预测部署
](
../../deploy/README.md
)
**注意:**
由于paddle.detach函数动转静时会导致导出模型尺寸错误,因此在配置文件中增加了
`is_training`
参数,导出模型预测部署时需要将改参数设置为
`False`
## Citations
## Citations
```
```
...
...
configs/dota/s2anet_1x_spine.yml
浏览文件 @
bd7838d0
...
@@ -27,3 +27,4 @@ S2ANetHead:
...
@@ -27,3 +27,4 @@ S2ANetHead:
reg_loss_weight
:
[
1.0
,
1.0
,
1.0
,
1.0
,
1.05
]
reg_loss_weight
:
[
1.0
,
1.0
,
1.0
,
1.0
,
1.05
]
cls_loss_weight
:
[
1.05
,
1.0
]
cls_loss_weight
:
[
1.05
,
1.0
]
reg_loss_type
:
'
l1'
reg_loss_type
:
'
l1'
is_training
:
True
configs/dota/s2anet_alignconv_2x_dota.yml
浏览文件 @
bd7838d0
...
@@ -24,3 +24,4 @@ S2ANetHead:
...
@@ -24,3 +24,4 @@ S2ANetHead:
reg_loss_weight
:
[
1.0
,
1.0
,
1.0
,
1.0
,
1.05
]
reg_loss_weight
:
[
1.0
,
1.0
,
1.0
,
1.0
,
1.05
]
cls_loss_weight
:
[
1.05
,
1.0
]
cls_loss_weight
:
[
1.05
,
1.0
]
reg_loss_type
:
'
l1'
reg_loss_type
:
'
l1'
is_training
:
True
configs/dota/s2anet_conv_2x_dota.yml
浏览文件 @
bd7838d0
...
@@ -21,3 +21,4 @@ S2ANetHead:
...
@@ -21,3 +21,4 @@ S2ANetHead:
use_sigmoid_cls
:
True
use_sigmoid_cls
:
True
reg_loss_weight
:
[
1.0
,
1.0
,
1.0
,
1.0
,
1.1
]
reg_loss_weight
:
[
1.0
,
1.0
,
1.0
,
1.0
,
1.1
]
cls_loss_weight
:
[
1.1
,
1.05
]
cls_loss_weight
:
[
1.1
,
1.05
]
is_training
:
True
ppdet/modeling/heads/s2anet_head.py
浏览文件 @
bd7838d0
...
@@ -228,9 +228,10 @@ class S2ANetHead(nn.Layer):
...
@@ -228,9 +228,10 @@ class S2ANetHead(nn.Layer):
align_conv_size
=
3
,
align_conv_size
=
3
,
use_sigmoid_cls
=
True
,
use_sigmoid_cls
=
True
,
anchor_assign
=
RBoxAssigner
().
__dict__
,
anchor_assign
=
RBoxAssigner
().
__dict__
,
reg_loss_weight
=
[
1.0
,
1.0
,
1.0
,
1.0
,
1.0
],
reg_loss_weight
=
[
1.0
,
1.0
,
1.0
,
1.0
,
1.1
],
cls_loss_weight
=
[
1.0
,
1.0
],
cls_loss_weight
=
[
1.1
,
1.05
],
reg_loss_type
=
'l1'
):
reg_loss_type
=
'l1'
,
is_training
=
True
):
super
(
S2ANetHead
,
self
).
__init__
()
super
(
S2ANetHead
,
self
).
__init__
()
self
.
stacked_convs
=
stacked_convs
self
.
stacked_convs
=
stacked_convs
self
.
feat_in
=
feat_in
self
.
feat_in
=
feat_in
...
@@ -256,6 +257,7 @@ class S2ANetHead(nn.Layer):
...
@@ -256,6 +257,7 @@ class S2ANetHead(nn.Layer):
self
.
alpha
=
1.0
self
.
alpha
=
1.0
self
.
beta
=
1.0
self
.
beta
=
1.0
self
.
reg_loss_type
=
reg_loss_type
self
.
reg_loss_type
=
reg_loss_type
self
.
is_training
=
is_training
self
.
s2anet_head_out
=
None
self
.
s2anet_head_out
=
None
...
@@ -446,10 +448,12 @@ class S2ANetHead(nn.Layer):
...
@@ -446,10 +448,12 @@ class S2ANetHead(nn.Layer):
init_anchors
=
self
.
rect2rbox
(
init_anchors
)
init_anchors
=
self
.
rect2rbox
(
init_anchors
)
self
.
base_anchors_list
.
append
(
init_anchors
)
self
.
base_anchors_list
.
append
(
init_anchors
)
fam_reg1
=
fam_reg
if
self
.
is_training
:
fam_reg1
.
stop_gradient
=
True
refine_anchor
=
self
.
bbox_decode
(
fam_reg
.
detach
(),
init_anchors
)
refine_anchor
=
self
.
bbox_decode
(
fam_reg1
,
init_anchors
)
else
:
#refine_anchor = self.bbox_decode(fam_reg.detach(), init_anchors)
fam_reg1
=
fam_reg
.
clone
()
fam_reg1
.
stop_gradient
=
True
refine_anchor
=
self
.
bbox_decode
(
fam_reg1
,
init_anchors
)
self
.
refine_anchor_list
.
append
(
refine_anchor
)
self
.
refine_anchor_list
.
append
(
refine_anchor
)
...
@@ -615,19 +619,13 @@ class S2ANetHead(nn.Layer):
...
@@ -615,19 +619,13 @@ class S2ANetHead(nn.Layer):
iou
=
rbox_iou
(
fam_bbox_decode
,
bbox_gt_bboxes
)
iou
=
rbox_iou
(
fam_bbox_decode
,
bbox_gt_bboxes
)
iou
=
paddle
.
diag
(
iou
)
iou
=
paddle
.
diag
(
iou
)
if
reg_loss_type
==
'iou'
:
if
reg_loss_type
==
'gwd'
:
EPS
=
paddle
.
to_tensor
(
1e-8
,
dtype
=
'float32'
,
stop_gradient
=
True
)
iou_factor
=
-
1.0
*
paddle
.
log
(
iou
+
EPS
)
/
(
fam_bbox
+
EPS
)
iou_factor
.
stop_gradient
=
True
#fam_bbox = fam_bbox * iou_factor
elif
reg_loss_type
==
'gwd'
:
bbox_gt_bboxes_level
=
bbox_gt_bboxes
[
st_idx
:
st_idx
+
bbox_gt_bboxes_level
=
bbox_gt_bboxes
[
st_idx
:
st_idx
+
feat_anchor_num
,
:]
feat_anchor_num
,
:]
fam_bbox_total
=
self
.
gwd_loss
(
fam_bbox_decode
,
fam_bbox_total
=
self
.
gwd_loss
(
fam_bbox_decode
,
bbox_gt_bboxes_level
)
bbox_gt_bboxes_level
)
fam_bbox_total
=
fam_bbox_total
*
feat_bbox_weights
fam_bbox_total
=
fam_bbox_total
*
feat_bbox_weights
fam_bbox_total
=
paddle
.
sum
(
fam_bbox_total
)
fam_bbox_total
=
paddle
.
sum
(
fam_bbox_total
)
/
num_total_samples
fam_bbox_losses
.
append
(
fam_bbox_total
)
fam_bbox_losses
.
append
(
fam_bbox_total
)
st_idx
+=
feat_anchor_num
st_idx
+=
feat_anchor_num
...
@@ -735,19 +733,13 @@ class S2ANetHead(nn.Layer):
...
@@ -735,19 +733,13 @@ class S2ANetHead(nn.Layer):
iou
=
rbox_iou
(
odm_bbox_decode
,
bbox_gt_bboxes
)
iou
=
rbox_iou
(
odm_bbox_decode
,
bbox_gt_bboxes
)
iou
=
paddle
.
diag
(
iou
)
iou
=
paddle
.
diag
(
iou
)
if
reg_loss_type
==
'iou'
:
if
reg_loss_type
==
'gwd'
:
EPS
=
paddle
.
to_tensor
(
1e-8
,
dtype
=
'float32'
,
stop_gradient
=
True
)
iou_factor
=
-
1.0
*
paddle
.
log
(
iou
+
EPS
)
/
(
odm_bbox
+
EPS
)
iou_factor
.
stop_gradient
=
True
# odm_bbox = odm_bbox * iou_factor
elif
reg_loss_type
==
'gwd'
:
bbox_gt_bboxes_level
=
bbox_gt_bboxes
[
st_idx
:
st_idx
+
bbox_gt_bboxes_level
=
bbox_gt_bboxes
[
st_idx
:
st_idx
+
feat_anchor_num
,
:]
feat_anchor_num
,
:]
odm_bbox_total
=
self
.
gwd_loss
(
odm_bbox_decode
,
odm_bbox_total
=
self
.
gwd_loss
(
odm_bbox_decode
,
bbox_gt_bboxes_level
)
bbox_gt_bboxes_level
)
odm_bbox_total
=
odm_bbox_total
*
feat_bbox_weights
odm_bbox_total
=
odm_bbox_total
*
feat_bbox_weights
odm_bbox_total
=
paddle
.
sum
(
odm_bbox_total
)
odm_bbox_total
=
paddle
.
sum
(
odm_bbox_total
)
/
num_total_samples
odm_bbox_losses
.
append
(
odm_bbox_total
)
odm_bbox_losses
.
append
(
odm_bbox_total
)
st_idx
+=
feat_anchor_num
st_idx
+=
feat_anchor_num
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录