Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
fbf981d1
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
694
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
fbf981d1
编写于
1月 07, 2022
作者:
W
wangxinxin08
提交者:
GitHub
1月 07, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "fix solov2 infer (#4972)" (#5074)
This reverts commit
3e0e3585
.
上级
b3a7649e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
8 addition
and
25 deletion
+8
-25
ppdet/engine/trainer.py
ppdet/engine/trainer.py
+3
-3
ppdet/modeling/architectures/meta_arch.py
ppdet/modeling/architectures/meta_arch.py
+4
-21
ppdet/modeling/backbones/esnet.py
ppdet/modeling/backbones/esnet.py
+1
-1
未找到文件。
ppdet/engine/trainer.py
浏览文件 @
fbf981d1
...
@@ -34,7 +34,6 @@ from paddle.static import InputSpec
...
@@ -34,7 +34,6 @@ from paddle.static import InputSpec
from
ppdet.optimizer
import
ModelEMA
from
ppdet.optimizer
import
ModelEMA
from
ppdet.core.workspace
import
create
from
ppdet.core.workspace
import
create
from
ppdet.modeling.architectures.meta_arch
import
BaseArch
from
ppdet.utils.checkpoint
import
load_weight
,
load_pretrain_weight
from
ppdet.utils.checkpoint
import
load_weight
,
load_pretrain_weight
from
ppdet.utils.visualizer
import
visualize_results
,
save_result
from
ppdet.utils.visualizer
import
visualize_results
,
save_result
from
ppdet.metrics
import
Metric
,
COCOMetric
,
VOCMetric
,
WiderFaceMetric
,
get_infer_results
,
KeyPointTopDownCOCOEval
,
KeyPointTopDownMPIIEval
from
ppdet.metrics
import
Metric
,
COCOMetric
,
VOCMetric
,
WiderFaceMetric
,
get_infer_results
,
KeyPointTopDownCOCOEval
,
KeyPointTopDownMPIIEval
...
@@ -346,10 +345,11 @@ class Trainer(object):
...
@@ -346,10 +345,11 @@ class Trainer(object):
assert
self
.
mode
==
'train'
,
"Model not in 'train' mode"
assert
self
.
mode
==
'train'
,
"Model not in 'train' mode"
Init_mark
=
False
Init_mark
=
False
sync_bn
=
(
getattr
(
self
.
cfg
,
'norm_type'
,
None
)
in
[
None
,
'sync_bn'
]
and
sync_bn
=
(
getattr
(
self
.
cfg
,
'norm_type'
,
None
)
==
'sync_bn'
and
self
.
cfg
.
use_gpu
and
self
.
_nranks
>
1
)
self
.
cfg
.
use_gpu
and
self
.
_nranks
>
1
)
if
sync_bn
:
if
sync_bn
:
self
.
model
=
BaseArch
.
convert_sync_batchnorm
(
self
.
model
)
self
.
model
=
paddle
.
nn
.
SyncBatchNorm
.
convert_sync_batchnorm
(
self
.
model
)
model
=
self
.
model
model
=
self
.
model
if
self
.
cfg
.
get
(
'fleet'
,
False
):
if
self
.
cfg
.
get
(
'fleet'
,
False
):
...
...
ppdet/modeling/architectures/meta_arch.py
浏览文件 @
fbf981d1
...
@@ -70,7 +70,7 @@ class BaseArch(nn.Layer):
...
@@ -70,7 +70,7 @@ class BaseArch(nn.Layer):
outs
.
append
(
self
.
get_pred
())
outs
.
append
(
self
.
get_pred
())
# multi-scale test
# multi-scale test
if
len
(
outs
)
>
1
:
if
len
(
outs
)
>
1
:
out
=
self
.
merge_multi_scale_predictions
(
outs
)
out
=
self
.
merge_multi_scale_predictions
(
outs
)
else
:
else
:
out
=
outs
[
0
]
out
=
outs
[
0
]
...
@@ -87,9 +87,7 @@ class BaseArch(nn.Layer):
...
@@ -87,9 +87,7 @@ class BaseArch(nn.Layer):
keep_top_k
=
self
.
bbox_post_process
.
nms
.
keep_top_k
keep_top_k
=
self
.
bbox_post_process
.
nms
.
keep_top_k
nms_threshold
=
self
.
bbox_post_process
.
nms
.
nms_threshold
nms_threshold
=
self
.
bbox_post_process
.
nms
.
nms_threshold
else
:
else
:
raise
Exception
(
raise
Exception
(
"Multi scale test only supports CascadeRCNN, FasterRCNN and MaskRCNN for now"
)
"Multi scale test only supports CascadeRCNN, FasterRCNN and MaskRCNN for now"
)
final_boxes
=
[]
final_boxes
=
[]
all_scale_outs
=
paddle
.
concat
([
o
[
'bbox'
]
for
o
in
outs
]).
numpy
()
all_scale_outs
=
paddle
.
concat
([
o
[
'bbox'
]
for
o
in
outs
]).
numpy
()
...
@@ -98,11 +96,9 @@ class BaseArch(nn.Layer):
...
@@ -98,11 +96,9 @@ class BaseArch(nn.Layer):
if
np
.
count_nonzero
(
idxs
)
==
0
:
if
np
.
count_nonzero
(
idxs
)
==
0
:
continue
continue
r
=
nms
(
all_scale_outs
[
idxs
,
1
:],
nms_threshold
)
r
=
nms
(
all_scale_outs
[
idxs
,
1
:],
nms_threshold
)
final_boxes
.
append
(
final_boxes
.
append
(
np
.
concatenate
([
np
.
full
((
r
.
shape
[
0
],
1
),
c
),
r
],
1
))
np
.
concatenate
([
np
.
full
((
r
.
shape
[
0
],
1
),
c
),
r
],
1
))
out
=
np
.
concatenate
(
final_boxes
)
out
=
np
.
concatenate
(
final_boxes
)
out
=
np
.
concatenate
(
sorted
(
out
=
np
.
concatenate
(
sorted
(
out
,
key
=
lambda
e
:
e
[
1
])[
-
keep_top_k
:]).
reshape
((
-
1
,
6
))
out
,
key
=
lambda
e
:
e
[
1
])[
-
keep_top_k
:]).
reshape
((
-
1
,
6
))
out
=
{
out
=
{
'bbox'
:
paddle
.
to_tensor
(
out
),
'bbox'
:
paddle
.
to_tensor
(
out
),
'bbox_num'
:
paddle
.
to_tensor
(
np
.
array
([
out
.
shape
[
0
],
]))
'bbox_num'
:
paddle
.
to_tensor
(
np
.
array
([
out
.
shape
[
0
],
]))
...
@@ -124,16 +120,3 @@ class BaseArch(nn.Layer):
...
@@ -124,16 +120,3 @@ class BaseArch(nn.Layer):
def
get_pred
(
self
,
):
def
get_pred
(
self
,
):
raise
NotImplementedError
(
"Should implement get_pred method!"
)
raise
NotImplementedError
(
"Should implement get_pred method!"
)
@
classmethod
def
convert_sync_batchnorm
(
cls
,
layer
):
layer_output
=
layer
if
getattr
(
layer
,
'norm_type'
,
None
)
==
'sync_bn'
:
layer_output
=
nn
.
SyncBatchNorm
.
convert_sync_batchnorm
(
layer
)
else
:
for
name
,
sublayer
in
layer
.
named_children
():
layer_output
.
add_sublayer
(
name
,
cls
.
convert_sync_batchnorm
(
sublayer
))
del
layer
return
layer_output
ppdet/modeling/backbones/esnet.py
浏览文件 @
fbf981d1
...
@@ -20,7 +20,7 @@ import paddle
...
@@ -20,7 +20,7 @@ import paddle
import
paddle.nn
as
nn
import
paddle.nn
as
nn
import
paddle.nn.functional
as
F
import
paddle.nn.functional
as
F
from
paddle
import
ParamAttr
from
paddle
import
ParamAttr
from
paddle.nn
import
Conv2D
,
MaxPool2D
,
AdaptiveAvgPool2D
from
paddle.nn
import
Conv2D
,
MaxPool2D
,
AdaptiveAvgPool2D
,
BatchNorm
from
paddle.nn.initializer
import
KaimingNormal
from
paddle.nn.initializer
import
KaimingNormal
from
paddle.regularizer
import
L2Decay
from
paddle.regularizer
import
L2Decay
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录