Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FL1623863129
YOLOX
提交
25f116b3
Y
YOLOX
项目概览
FL1623863129
/
YOLOX
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YOLOX
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
25f116b3
编写于
1月 12, 2022
作者:
F
Feng Wang
提交者:
GitHub
1月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(evaluator): fix attr bug in COCOEvaluator (#1067)
上级
147a8a35
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
11 deletion
+13
-11
tools/eval.py
tools/eval.py
+1
-1
yolox/evaluators/coco_evaluator.py
yolox/evaluators/coco_evaluator.py
+12
-10
未找到文件。
tools/eval.py
浏览文件 @
25f116b3
...
...
@@ -143,7 +143,7 @@ def main(exp, args, num_gpu):
logger
.
info
(
"Model Structure:
\n
{}"
.
format
(
str
(
model
)))
evaluator
=
exp
.
get_evaluator
(
args
.
batch_size
,
is_distributed
,
args
.
test
,
args
.
legacy
)
evaluator
.
per_class_
m
AP
=
True
evaluator
.
per_class_AP
=
True
evaluator
.
per_class_AR
=
True
torch
.
cuda
.
set_device
(
rank
)
...
...
yolox/evaluators/coco_evaluator.py
浏览文件 @
25f116b3
...
...
@@ -50,8 +50,8 @@ def per_class_AR_table(coco_eval, class_names=COCO_CLASSES, headers=["class", "A
return
table
def
per_class_
m
AP_table
(
coco_eval
,
class_names
=
COCO_CLASSES
,
headers
=
[
"class"
,
"AP"
],
colums
=
6
):
per_class_
m
AP
=
{}
def
per_class_AP_table
(
coco_eval
,
class_names
=
COCO_CLASSES
,
headers
=
[
"class"
,
"AP"
],
colums
=
6
):
per_class_AP
=
{}
precisions
=
coco_eval
.
eval
[
"precision"
]
# dimension of precisions: [TxRxKxAxM]
# precision has dims (iou, recall, cls, area range, max dets)
...
...
@@ -63,10 +63,10 @@ def per_class_mAP_table(coco_eval, class_names=COCO_CLASSES, headers=["class", "
precision
=
precisions
[:,
:,
idx
,
0
,
-
1
]
precision
=
precision
[
precision
>
-
1
]
ap
=
np
.
mean
(
precision
)
if
precision
.
size
else
float
(
"nan"
)
per_class_
m
AP
[
name
]
=
float
(
ap
*
100
)
per_class_AP
[
name
]
=
float
(
ap
*
100
)
num_cols
=
min
(
colums
,
len
(
per_class_
m
AP
)
*
len
(
headers
))
result_pair
=
[
x
for
pair
in
per_class_
m
AP
.
items
()
for
x
in
pair
]
num_cols
=
min
(
colums
,
len
(
per_class_AP
)
*
len
(
headers
))
result_pair
=
[
x
for
pair
in
per_class_AP
.
items
()
for
x
in
pair
]
row_pair
=
itertools
.
zip_longest
(
*
[
result_pair
[
i
::
num_cols
]
for
i
in
range
(
num_cols
)])
table_headers
=
headers
*
(
num_cols
//
len
(
headers
))
table
=
tabulate
(
...
...
@@ -89,7 +89,7 @@ class COCOEvaluator:
nmsthre
:
float
,
num_classes
:
int
,
testdev
:
bool
=
False
,
per_class_
m
AP
:
bool
=
False
,
per_class_AP
:
bool
=
False
,
per_class_AR
:
bool
=
False
,
):
"""
...
...
@@ -100,7 +100,8 @@ class COCOEvaluator:
confthre: confidence threshold ranging from 0 to 1, which
is defined in the config file.
nmsthre: IoU threshold of non-max supression ranging from 0 to 1.
per_class_mAP: Show per class mAP during evalution or not. Default to False.
per_class_AP: Show per class AP during evalution or not. Default to False.
per_class_AR: Show per class AR during evalution or not. Default to False.
"""
self
.
dataloader
=
dataloader
self
.
img_size
=
img_size
...
...
@@ -108,7 +109,8 @@ class COCOEvaluator:
self
.
nmsthre
=
nmsthre
self
.
num_classes
=
num_classes
self
.
testdev
=
testdev
self
.
per_class_mAP
=
per_class_mAP
self
.
per_class_AP
=
per_class_AP
self
.
per_class_AR
=
per_class_AR
def
evaluate
(
self
,
...
...
@@ -278,8 +280,8 @@ class COCOEvaluator:
with
contextlib
.
redirect_stdout
(
redirect_string
):
cocoEval
.
summarize
()
info
+=
redirect_string
.
getvalue
()
if
self
.
per_class_
m
AP
:
info
+=
"per class
mAP:
\n
"
+
per_class_m
AP_table
(
cocoEval
)
+
"
\n
"
if
self
.
per_class_AP
:
info
+=
"per class
AP:
\n
"
+
per_class_
AP_table
(
cocoEval
)
+
"
\n
"
if
self
.
per_class_AR
:
info
+=
"per class AR:
\n
"
+
per_class_AR_table
(
cocoEval
)
+
"
\n
"
return
cocoEval
.
stats
[
0
],
cocoEval
.
stats
[
1
],
info
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录