Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
3519626d
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
3519626d
编写于
9月 12, 2019
作者:
W
wangguanzhong
提交者:
GitHub
9月 12, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix error info in map_utils (#3317)
上级
a40349a4
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
13 addition
and
23 deletion
+13
-23
PaddleCV/PaddleDetection/ppdet/utils/map_utils.py
PaddleCV/PaddleDetection/ppdet/utils/map_utils.py
+13
-23
未找到文件。
PaddleCV/PaddleDetection/ppdet/utils/map_utils.py
浏览文件 @
3519626d
...
...
@@ -22,9 +22,7 @@ import numpy as np
import
logging
logger
=
logging
.
getLogger
(
__name__
)
__all__
=
[
'bbox_area'
,
'jaccard_overlap'
,
'DetectionMAP'
]
__all__
=
[
'bbox_area'
,
'jaccard_overlap'
,
'DetectionMAP'
]
def
bbox_area
(
bbox
,
is_bbox_normalized
):
...
...
@@ -48,13 +46,11 @@ def jaccard_overlap(pred, gt, is_bbox_normalized=False):
inter_ymin
=
max
(
pred
[
1
],
gt
[
1
])
inter_xmax
=
min
(
pred
[
2
],
gt
[
2
])
inter_ymax
=
min
(
pred
[
3
],
gt
[
3
])
inter_size
=
bbox_area
([
inter_xmin
,
inter_ymin
,
inter_xmax
,
inter_ymax
],
inter_size
=
bbox_area
([
inter_xmin
,
inter_ymin
,
inter_xmax
,
inter_ymax
],
is_bbox_normalized
)
pred_size
=
bbox_area
(
pred
,
is_bbox_normalized
)
gt_size
=
bbox_area
(
gt
,
is_bbox_normalized
)
overlap
=
float
(
inter_size
)
/
(
pred_size
+
gt_size
-
inter_size
)
overlap
=
float
(
inter_size
)
/
(
pred_size
+
gt_size
-
inter_size
)
return
overlap
...
...
@@ -126,15 +122,12 @@ class DetectionMAP(object):
if
self
.
evaluate_difficult
or
\
int
(
np
.
array
(
difficult
[
max_idx
]))
==
0
:
if
not
visited
[
max_idx
]:
self
.
class_score_poss
[
int
(
label
)].
append
([
score
,
1.0
])
self
.
class_score_poss
[
int
(
label
)].
append
([
score
,
1.0
])
visited
[
max_idx
]
=
True
else
:
self
.
class_score_poss
[
int
(
label
)].
append
([
score
,
0.0
])
self
.
class_score_poss
[
int
(
label
)].
append
([
score
,
0.0
])
else
:
self
.
class_score_poss
[
int
(
label
)].
append
([
score
,
0.0
])
self
.
class_score_poss
[
int
(
label
)].
append
([
score
,
0.0
])
def
reset
(
self
):
"""
...
...
@@ -190,7 +183,7 @@ class DetectionMAP(object):
mAP
+=
ap
valid_cnt
+=
1
else
:
logger
.
error
(
"Unspported mAP type {}"
.
format
(
map_type
))
logger
.
error
(
"Unspported mAP type {}"
.
format
(
self
.
map_type
))
sys
.
exit
(
1
)
self
.
mAP
=
mAP
/
float
(
valid_cnt
)
if
valid_cnt
>
0
else
mAP
...
...
@@ -208,9 +201,7 @@ class DetectionMAP(object):
Calculate accumulating true/false positive results from
[score, pos] records
"""
sorted_list
=
sorted
(
score_pos_list
,
key
=
lambda
s
:
s
[
0
],
reverse
=
True
)
sorted_list
=
sorted
(
score_pos_list
,
key
=
lambda
s
:
s
[
0
],
reverse
=
True
)
accum_tp
=
0
accum_fp
=
0
accum_tp_list
=
[]
...
...
@@ -221,4 +212,3 @@ class DetectionMAP(object):
accum_fp
+=
1
-
int
(
pos
)
accum_fp_list
.
append
(
accum_fp
)
return
accum_tp_list
,
accum_fp_list
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录