Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
eaf2dbe0
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看板
未验证
提交
eaf2dbe0
编写于
6月 15, 2022
作者:
G
Guanghua Yu
提交者:
GitHub
6月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve the usability of voc metric (#6198)
上级
d10e6af4
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
19 addition
and
9 deletion
+19
-9
ppdet/metrics/metrics.py
ppdet/metrics/metrics.py
+19
-9
未找到文件。
ppdet/metrics/metrics.py
浏览文件 @
eaf2dbe0
...
@@ -248,11 +248,13 @@ class VOCMetric(Metric):
...
@@ -248,11 +248,13 @@ class VOCMetric(Metric):
self
.
detection_map
.
reset
()
self
.
detection_map
.
reset
()
def
update
(
self
,
inputs
,
outputs
):
def
update
(
self
,
inputs
,
outputs
):
bbox_np
=
outputs
[
'bbox'
].
numpy
()
bbox_np
=
outputs
[
'bbox'
].
numpy
()
if
isinstance
(
outputs
[
'bbox'
],
paddle
.
Tensor
)
else
outputs
[
'bbox'
]
bboxes
=
bbox_np
[:,
2
:]
bboxes
=
bbox_np
[:,
2
:]
scores
=
bbox_np
[:,
1
]
scores
=
bbox_np
[:,
1
]
labels
=
bbox_np
[:,
0
]
labels
=
bbox_np
[:,
0
]
bbox_lengths
=
outputs
[
'bbox_num'
].
numpy
()
bbox_lengths
=
outputs
[
'bbox_num'
].
numpy
()
if
isinstance
(
outputs
[
'bbox_num'
],
paddle
.
Tensor
)
else
outputs
[
'bbox_num'
]
if
bboxes
.
shape
==
(
1
,
1
)
or
bboxes
is
None
:
if
bboxes
.
shape
==
(
1
,
1
)
or
bboxes
is
None
:
return
return
...
@@ -261,18 +263,26 @@ class VOCMetric(Metric):
...
@@ -261,18 +263,26 @@ class VOCMetric(Metric):
difficults
=
inputs
[
'difficult'
]
if
not
self
.
evaluate_difficult
\
difficults
=
inputs
[
'difficult'
]
if
not
self
.
evaluate_difficult
\
else
None
else
None
scale_factor
=
inputs
[
'scale_factor'
].
numpy
(
if
'scale_factor'
in
inputs
:
)
if
'scale_factor'
in
inputs
else
np
.
ones
(
scale_factor
=
inputs
[
'scale_factor'
].
numpy
()
if
isinstance
(
(
gt_boxes
.
shape
[
0
],
2
)).
astype
(
'float32'
)
inputs
[
'scale_factor'
],
paddle
.
Tensor
)
else
inputs
[
'scale_factor'
]
else
:
scale_factor
=
np
.
ones
((
gt_boxes
.
shape
[
0
],
2
)).
astype
(
'float32'
)
bbox_idx
=
0
bbox_idx
=
0
for
i
in
range
(
len
(
gt_boxes
)):
for
i
in
range
(
len
(
gt_boxes
)):
gt_box
=
gt_boxes
[
i
].
numpy
()
gt_box
=
gt_boxes
[
i
].
numpy
()
if
isinstance
(
gt_boxes
[
i
],
paddle
.
Tensor
)
else
gt_boxes
[
i
]
h
,
w
=
scale_factor
[
i
]
h
,
w
=
scale_factor
[
i
]
gt_box
=
gt_box
/
np
.
array
([
w
,
h
,
w
,
h
])
gt_box
=
gt_box
/
np
.
array
([
w
,
h
,
w
,
h
])
gt_label
=
gt_labels
[
i
].
numpy
()
gt_label
=
gt_labels
[
i
].
numpy
()
if
isinstance
(
difficult
=
None
if
difficults
is
None
\
gt_labels
[
i
],
paddle
.
Tensor
)
else
gt_labels
[
i
]
else
difficults
[
i
].
numpy
()
if
difficults
is
not
None
:
difficult
=
difficults
[
i
].
numpy
()
if
isinstance
(
difficults
[
i
],
paddle
.
Tensor
)
else
difficults
[
i
]
else
:
difficult
=
None
bbox_num
=
bbox_lengths
[
i
]
bbox_num
=
bbox_lengths
[
i
]
bbox
=
bboxes
[
bbox_idx
:
bbox_idx
+
bbox_num
]
bbox
=
bboxes
[
bbox_idx
:
bbox_idx
+
bbox_num
]
score
=
scores
[
bbox_idx
:
bbox_idx
+
bbox_num
]
score
=
scores
[
bbox_idx
:
bbox_idx
+
bbox_num
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录