Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
6cfe3643
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看板
未验证
提交
6cfe3643
编写于
5月 18, 2021
作者:
G
George Ni
提交者:
GitHub
5月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MOT] fix for_mot in yolo_fpn (#3039)
* fix for_mot in PPYOLOTinyFPN and PPYOLOPAN * fix yolo_fpn
上级
fa474195
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
39 addition
and
12 deletion
+39
-12
ppdet/modeling/architectures/yolo.py
ppdet/modeling/architectures/yolo.py
+2
-1
ppdet/modeling/necks/yolo_fpn.py
ppdet/modeling/necks/yolo_fpn.py
+37
-11
未找到文件。
ppdet/modeling/architectures/yolo.py
浏览文件 @
6cfe3643
...
...
@@ -30,7 +30,8 @@ class YOLOv3(BaseArch):
yolo_head (nn.Layer): anchor_head instance
bbox_post_process (object): `BBoxPostProcess` instance
data_format (str): data format, NCHW or NHWC
for_mot (bool): whether return other features used in tracking model
for_mot (bool): whether return other features for multi-object tracking
models, default False in pure object detection models.
"""
super
(
YOLOv3
,
self
).
__init__
(
data_format
=
data_format
)
self
.
backbone
=
backbone
...
...
ppdet/modeling/necks/yolo_fpn.py
浏览文件 @
6cfe3643
...
...
@@ -18,11 +18,9 @@ import paddle.nn.functional as F
from
paddle
import
ParamAttr
from
ppdet.core.workspace
import
register
,
serializable
from
..backbones.darknet
import
ConvBNLayer
import
numpy
as
np
from
..shape_spec
import
ShapeSpec
__all__
=
[
'YOLOv3FPN'
,
'PPYOLOFPN'
]
__all__
=
[
'YOLOv3FPN'
,
'PPYOLOFPN'
,
'PPYOLOTinyFPN'
,
'PPYOLOPAN'
]
def
add_coord
(
x
,
data_format
):
...
...
@@ -492,8 +490,11 @@ class YOLOv3FPN(nn.Layer):
assert
len
(
blocks
)
==
self
.
num_blocks
blocks
=
blocks
[::
-
1
]
yolo_feats
=
[]
# add embedding features output for multi-object tracking model
if
for_mot
:
emb_feats
=
[]
for
i
,
block
in
enumerate
(
blocks
):
if
i
>
0
:
if
self
.
data_format
==
'NCHW'
:
...
...
@@ -504,7 +505,7 @@ class YOLOv3FPN(nn.Layer):
yolo_feats
.
append
(
tip
)
if
for_mot
:
# add emb
_feat
s output
# add emb
edding feature
s output
emb_feats
.
append
(
route
)
if
i
<
self
.
num_blocks
-
1
:
...
...
@@ -668,8 +669,11 @@ class PPYOLOFPN(nn.Layer):
assert
len
(
blocks
)
==
self
.
num_blocks
blocks
=
blocks
[::
-
1
]
yolo_feats
=
[]
# add embedding features output for multi-object tracking model
if
for_mot
:
emb_feats
=
[]
for
i
,
block
in
enumerate
(
blocks
):
if
i
>
0
:
if
self
.
data_format
==
'NCHW'
:
...
...
@@ -680,7 +684,7 @@ class PPYOLOFPN(nn.Layer):
yolo_feats
.
append
(
tip
)
if
for_mot
:
# add emb
_feat
s output
# add emb
edding feature
s output
emb_feats
.
append
(
route
)
if
i
<
self
.
num_blocks
-
1
:
...
...
@@ -780,11 +784,15 @@ class PPYOLOTinyFPN(nn.Layer):
name
=
name
))
self
.
routes
.
append
(
route
)
def
forward
(
self
,
blocks
):
def
forward
(
self
,
blocks
,
for_mot
=
False
):
assert
len
(
blocks
)
==
self
.
num_blocks
blocks
=
blocks
[::
-
1
]
yolo_feats
=
[]
# add embedding features output for multi-object tracking model
if
for_mot
:
emb_feats
=
[]
for
i
,
block
in
enumerate
(
blocks
):
if
i
==
0
and
self
.
spp_
:
block
=
self
.
spp
(
block
)
...
...
@@ -797,11 +805,18 @@ class PPYOLOTinyFPN(nn.Layer):
route
,
tip
=
self
.
yolo_blocks
[
i
](
block
)
yolo_feats
.
append
(
tip
)
if
for_mot
:
# add embedding features output
emb_feats
.
append
(
route
)
if
i
<
self
.
num_blocks
-
1
:
route
=
self
.
routes
[
i
](
route
)
route
=
F
.
interpolate
(
route
,
scale_factor
=
2.
,
data_format
=
self
.
data_format
)
if
for_mot
:
return
{
'yolo_feats'
:
yolo_feats
,
'emb_feats'
:
emb_feats
}
else
:
return
yolo_feats
@
classmethod
...
...
@@ -964,11 +979,15 @@ class PPYOLOPAN(nn.Layer):
self
.
_out_channels
=
self
.
_out_channels
[::
-
1
]
def
forward
(
self
,
blocks
):
def
forward
(
self
,
blocks
,
for_mot
=
False
):
assert
len
(
blocks
)
==
self
.
num_blocks
blocks
=
blocks
[::
-
1
]
# fpn
fpn_feats
=
[]
# add embedding features output for multi-object tracking model
if
for_mot
:
emb_feats
=
[]
for
i
,
block
in
enumerate
(
blocks
):
if
i
>
0
:
if
self
.
data_format
==
'NCHW'
:
...
...
@@ -978,6 +997,10 @@ class PPYOLOPAN(nn.Layer):
route
,
tip
=
self
.
fpn_blocks
[
i
](
block
)
fpn_feats
.
append
(
tip
)
if
for_mot
:
# add embedding features output
emb_feats
.
append
(
route
)
if
i
<
self
.
num_blocks
-
1
:
route
=
self
.
fpn_routes
[
i
](
route
)
route
=
F
.
interpolate
(
...
...
@@ -996,6 +1019,9 @@ class PPYOLOPAN(nn.Layer):
route
,
tip
=
self
.
pan_blocks
[
i
](
block
)
pan_feats
.
append
(
tip
)
if
for_mot
:
return
{
'yolo_feats'
:
pan_feats
[::
-
1
],
'emb_feats'
:
emb_feats
}
else
:
return
pan_feats
[::
-
1
]
@
classmethod
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录