Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
78a4d0bf
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看板
提交
78a4d0bf
编写于
9月 17, 2019
作者:
W
wangguanzhong
提交者:
GitHub
9月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix rcnn eval on voc (#3344)
* fix rcnn eval on voc * update comment
上级
28e19603
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
4 deletion
+48
-4
ppdet/data/data_feed.py
ppdet/data/data_feed.py
+5
-4
ppdet/data/transform/arrange_sample.py
ppdet/data/transform/arrange_sample.py
+43
-0
未找到文件。
ppdet/data/data_feed.py
浏览文件 @
78a4d0bf
...
@@ -30,8 +30,8 @@ from ppdet.data.transform.operators import (
...
@@ -30,8 +30,8 @@ from ppdet.data.transform.operators import (
Permute
)
Permute
)
from
ppdet.data.transform.arrange_sample
import
(
from
ppdet.data.transform.arrange_sample
import
(
ArrangeRCNN
,
Arrange
TestRCNN
,
ArrangeSSD
,
ArrangeEvalSSD
,
ArrangeTestSSD
,
ArrangeRCNN
,
Arrange
EvalRCNN
,
ArrangeTestRCNN
,
ArrangeSSD
,
ArrangeEvalSSD
,
ArrangeYOLO
,
ArrangeEvalYOLO
,
ArrangeTestYOLO
)
Arrange
TestSSD
,
Arrange
YOLO
,
ArrangeEvalYOLO
,
ArrangeTestYOLO
)
__all__
=
[
__all__
=
[
'PadBatch'
,
'MultiScale'
,
'RandomShape'
,
'DataSet'
,
'CocoDataSet'
,
'PadBatch'
,
'MultiScale'
,
'RandomShape'
,
'DataSet'
,
'CocoDataSet'
,
...
@@ -476,7 +476,8 @@ class FasterRCNNEvalFeed(DataFeed):
...
@@ -476,7 +476,8 @@ class FasterRCNNEvalFeed(DataFeed):
def
__init__
(
self
,
def
__init__
(
self
,
dataset
=
CocoDataSet
(
COCO_VAL_ANNOTATION
,
dataset
=
CocoDataSet
(
COCO_VAL_ANNOTATION
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
fields
=
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
],
fields
=
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
,
'gt_box'
,
'gt_label'
,
'is_difficult'
],
image_shape
=
[
3
,
800
,
1333
],
image_shape
=
[
3
,
800
,
1333
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
),
DecodeImage
(
to_rgb
=
True
),
...
@@ -494,7 +495,7 @@ class FasterRCNNEvalFeed(DataFeed):
...
@@ -494,7 +495,7 @@ class FasterRCNNEvalFeed(DataFeed):
drop_last
=
False
,
drop_last
=
False
,
num_workers
=
2
,
num_workers
=
2
,
use_padded_im_info
=
True
):
use_padded_im_info
=
True
):
sample_transforms
.
append
(
Arrange
Test
RCNN
())
sample_transforms
.
append
(
Arrange
Eval
RCNN
())
super
(
FasterRCNNEvalFeed
,
self
).
__init__
(
super
(
FasterRCNNEvalFeed
,
self
).
__init__
(
dataset
,
dataset
,
fields
,
fields
,
...
...
ppdet/data/transform/arrange_sample.py
浏览文件 @
78a4d0bf
...
@@ -90,6 +90,47 @@ class ArrangeRCNN(BaseOperator):
...
@@ -90,6 +90,47 @@ class ArrangeRCNN(BaseOperator):
return
outs
return
outs
@
register_op
class
ArrangeEvalRCNN
(
BaseOperator
):
"""
Transform dict to the tuple format needed for evaluation.
"""
def
__init__
(
self
):
super
(
ArrangeEvalRCNN
,
self
).
__init__
()
def
__call__
(
self
,
sample
,
context
=
None
):
"""
Args:
sample: a dict which contains image
info and annotation info.
context: a dict which contains additional info.
Returns:
sample: a tuple containing the following items:
(image, im_info, im_id, im_shape, gt_bbox,
gt_class, difficult)
"""
im
=
sample
[
'image'
]
keys
=
list
(
sample
.
keys
())
if
'im_info'
in
keys
:
im_info
=
sample
[
'im_info'
]
else
:
raise
KeyError
(
"The dataset doesn't have 'im_info' key."
)
im_id
=
sample
[
'im_id'
]
h
=
sample
[
'h'
]
w
=
sample
[
'w'
]
# For rcnn models in eval and infer stage, original image size
# is needed to clip the bounding boxes. And box clip op in
# bbox prediction needs im_info as input in format of [N, 3],
# so im_shape is appended by 1 to match dimension.
im_shape
=
np
.
array
((
h
,
w
,
1
),
dtype
=
np
.
float32
)
gt_bbox
=
sample
[
'gt_bbox'
]
gt_class
=
sample
[
'gt_class'
]
difficult
=
sample
[
'difficult'
]
outs
=
(
im
,
im_info
,
im_id
,
im_shape
,
gt_bbox
,
gt_class
,
difficult
)
return
outs
@
register_op
@
register_op
class
ArrangeTestRCNN
(
BaseOperator
):
class
ArrangeTestRCNN
(
BaseOperator
):
"""
"""
...
@@ -152,6 +193,7 @@ class ArrangeSSD(BaseOperator):
...
@@ -152,6 +193,7 @@ class ArrangeSSD(BaseOperator):
outs
=
(
im
,
gt_bbox
,
gt_class
)
outs
=
(
im
,
gt_bbox
,
gt_class
)
return
outs
return
outs
@
register_op
@
register_op
class
ArrangeEvalSSD
(
BaseOperator
):
class
ArrangeEvalSSD
(
BaseOperator
):
"""
"""
...
@@ -184,6 +226,7 @@ class ArrangeEvalSSD(BaseOperator):
...
@@ -184,6 +226,7 @@ class ArrangeEvalSSD(BaseOperator):
return
outs
return
outs
@
register_op
@
register_op
class
ArrangeTestSSD
(
BaseOperator
):
class
ArrangeTestSSD
(
BaseOperator
):
"""
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录