Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
d70598ec
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看板
未验证
提交
d70598ec
编写于
7月 21, 2023
作者:
X
xiaoting
提交者:
GitHub
7月 21, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add nms_cpu for layout_picodet (#8453)
上级
484510a9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
5 deletion
+25
-5
configs/picodet/legacy_model/application/layout_analysis/picodet_lcnet_x1_0_layout.yml
...application/layout_analysis/picodet_lcnet_x1_0_layout.yml
+1
-0
configs/picodet/legacy_model/application/layout_analysis/picodet_lcnet_x2_5_layout.yml
...application/layout_analysis/picodet_lcnet_x2_5_layout.yml
+1
-0
ppdet/modeling/architectures/picodet.py
ppdet/modeling/architectures/picodet.py
+6
-2
ppdet/modeling/heads/pico_head.py
ppdet/modeling/heads/pico_head.py
+17
-3
未找到文件。
configs/picodet/legacy_model/application/layout_analysis/picodet_lcnet_x1_0_layout.yml
浏览文件 @
d70598ec
...
...
@@ -17,6 +17,7 @@ PicoDet:
backbone
:
LCNet
neck
:
CSPPAN
head
:
PicoHead
nms_cpu
:
True
LCNet
:
scale
:
1.0
...
...
configs/picodet/legacy_model/application/layout_analysis/picodet_lcnet_x2_5_layout.yml
浏览文件 @
d70598ec
...
...
@@ -10,6 +10,7 @@ PicoDet:
backbone
:
LCNet
neck
:
CSPPAN
head
:
PicoHead
nms_cpu
:
True
LCNet
:
scale
:
2.5
...
...
ppdet/modeling/architectures/picodet.py
浏览文件 @
d70598ec
...
...
@@ -36,13 +36,14 @@ class PicoDet(BaseArch):
__category__
=
'architecture'
def
__init__
(
self
,
backbone
,
neck
,
head
=
'PicoHead'
):
def
__init__
(
self
,
backbone
,
neck
,
head
=
'PicoHead'
,
nms_cpu
=
False
):
super
(
PicoDet
,
self
).
__init__
()
self
.
backbone
=
backbone
self
.
neck
=
neck
self
.
head
=
head
self
.
export_post_process
=
True
self
.
export_nms
=
True
self
.
nms_cpu
=
nms_cpu
@
classmethod
def
from_config
(
cls
,
cfg
,
*
args
,
**
kwargs
):
...
...
@@ -69,7 +70,10 @@ class PicoDet(BaseArch):
else
:
scale_factor
=
self
.
inputs
[
'scale_factor'
]
bboxes
,
bbox_num
=
self
.
head
.
post_process
(
head_outs
,
scale_factor
,
export_nms
=
self
.
export_nms
)
head_outs
,
scale_factor
,
export_nms
=
self
.
export_nms
,
nms_cpu
=
self
.
nms_cpu
)
return
bboxes
,
bbox_num
def
get_loss
(
self
,
):
...
...
ppdet/modeling/heads/pico_head.py
浏览文件 @
d70598ec
...
...
@@ -242,6 +242,7 @@ class PicoHead(OTAVFLHead):
self
.
nms_pre
=
nms_pre
self
.
cell_offset
=
cell_offset
self
.
eval_size
=
eval_size
self
.
device
=
paddle
.
device
.
get_device
()
self
.
use_sigmoid
=
self
.
loss_vfl
.
use_sigmoid
if
self
.
use_sigmoid
:
...
...
@@ -397,7 +398,11 @@ class PicoHead(OTAVFLHead):
stride_tensor
=
paddle
.
concat
(
stride_tensor
)
return
anchor_points
,
stride_tensor
def
post_process
(
self
,
head_outs
,
scale_factor
,
export_nms
=
True
):
def
post_process
(
self
,
head_outs
,
scale_factor
,
export_nms
=
True
,
nms_cpu
=
False
):
pred_scores
,
pred_bboxes
=
head_outs
if
not
export_nms
:
return
pred_bboxes
,
pred_scores
...
...
@@ -409,7 +414,12 @@ class PicoHead(OTAVFLHead):
axis
=-
1
).
reshape
([
-
1
,
1
,
4
])
# scale bbox to origin image size.
pred_bboxes
/=
scale_factor
bbox_pred
,
bbox_num
,
_
=
self
.
nms
(
pred_bboxes
,
pred_scores
)
if
nms_cpu
:
paddle
.
set_device
(
"cpu"
)
bbox_pred
,
bbox_num
,
_
=
self
.
nms
(
pred_bboxes
,
pred_scores
)
paddle
.
set_device
(
self
.
device
)
else
:
bbox_pred
,
bbox_num
,
_
=
self
.
nms
(
pred_bboxes
,
pred_scores
)
return
bbox_pred
,
bbox_num
...
...
@@ -767,7 +777,11 @@ class PicoHeadV2(GFLHead):
stride_tensor
=
paddle
.
concat
(
stride_tensor
)
return
anchor_points
,
stride_tensor
def
post_process
(
self
,
head_outs
,
scale_factor
,
export_nms
=
True
):
def
post_process
(
self
,
head_outs
,
scale_factor
,
export_nms
=
True
,
nms_cpu
=
False
):
pred_scores
,
pred_bboxes
=
head_outs
if
not
export_nms
:
return
pred_bboxes
,
pred_scores
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录