Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
SOLOv2-pytorch
Commits
d13997c3
Unverified
Commit
d13997c3
authored
Oct 10, 2018
by
Kai Chen
Committed by
GitHub
Oct 10, 2018
Browse files
Merge pull request #12 from hellock/dev
Bug fix for recall evaluation
parents
14a7dfb9
7c2b8148
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
9 deletions
+30
-9
mmdet/core/evaluation/coco_utils.py
mmdet/core/evaluation/coco_utils.py
+2
-2
tools/test.py
tools/test.py
+28
-7
No files found.
mmdet/core/evaluation/coco_utils.py
View file @
d13997c3
...
@@ -16,8 +16,8 @@ def coco_eval(result_file, result_types, coco, max_dets=(100, 300, 1000)):
...
@@ -16,8 +16,8 @@ def coco_eval(result_file, result_types, coco, max_dets=(100, 300, 1000)):
coco
=
COCO
(
coco
)
coco
=
COCO
(
coco
)
assert
isinstance
(
coco
,
COCO
)
assert
isinstance
(
coco
,
COCO
)
if
res_type
==
'proposal_fast'
:
if
res
ult
_type
s
==
[
'proposal_fast'
]
:
ar
=
fast_eval_recall
(
result_file
,
coco
,
max_dets
)
ar
=
fast_eval_recall
(
result_file
,
coco
,
np
.
array
(
max_dets
)
)
for
i
,
num
in
enumerate
(
max_dets
):
for
i
,
num
in
enumerate
(
max_dets
):
print
(
'AR@{}
\t
= {:.4f}'
.
format
(
num
,
ar
[
i
]))
print
(
'AR@{}
\t
= {:.4f}'
.
format
(
num
,
ar
[
i
]))
return
return
...
...
tools/test.py
View file @
d13997c3
...
@@ -39,7 +39,13 @@ def parse_args():
...
@@ -39,7 +39,13 @@ def parse_args():
parser
=
argparse
.
ArgumentParser
(
description
=
'MMDet test detector'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'MMDet test detector'
)
parser
.
add_argument
(
'config'
,
help
=
'test config file path'
)
parser
.
add_argument
(
'config'
,
help
=
'test config file path'
)
parser
.
add_argument
(
'checkpoint'
,
help
=
'checkpoint file'
)
parser
.
add_argument
(
'checkpoint'
,
help
=
'checkpoint file'
)
parser
.
add_argument
(
'--gpus'
,
default
=
1
,
type
=
int
)
parser
.
add_argument
(
'--gpus'
,
default
=
1
,
type
=
int
,
help
=
'GPU number used for testing'
)
parser
.
add_argument
(
'--proc_per_gpu'
,
default
=
1
,
type
=
int
,
help
=
'Number of processes per GPU'
)
parser
.
add_argument
(
'--out'
,
help
=
'output result file'
)
parser
.
add_argument
(
'--out'
,
help
=
'output result file'
)
parser
.
add_argument
(
parser
.
add_argument
(
'--eval'
,
'--eval'
,
...
@@ -55,6 +61,9 @@ def parse_args():
...
@@ -55,6 +61,9 @@ def parse_args():
def
main
():
def
main
():
args
=
parse_args
()
args
=
parse_args
()
if
args
.
out
is
not
None
and
not
args
.
out
.
endswith
((
'.pkl'
,
'.pickle'
)):
raise
ValueError
(
'The output file must be a pkl file.'
)
cfg
=
mmcv
.
Config
.
fromfile
(
args
.
config
)
cfg
=
mmcv
.
Config
.
fromfile
(
args
.
config
)
cfg
.
model
.
pretrained
=
None
cfg
.
model
.
pretrained
=
None
cfg
.
data
.
test
.
test_mode
=
True
cfg
.
data
.
test
.
test_mode
=
True
...
@@ -78,15 +87,27 @@ def main():
...
@@ -78,15 +87,27 @@ def main():
model_args
=
cfg
.
model
.
copy
()
model_args
=
cfg
.
model
.
copy
()
model_args
.
update
(
train_cfg
=
None
,
test_cfg
=
cfg
.
test_cfg
)
model_args
.
update
(
train_cfg
=
None
,
test_cfg
=
cfg
.
test_cfg
)
model_type
=
getattr
(
detectors
,
model_args
.
pop
(
'type'
))
model_type
=
getattr
(
detectors
,
model_args
.
pop
(
'type'
))
outputs
=
parallel_test
(
model_type
,
model_args
,
args
.
checkpoint
,
outputs
=
parallel_test
(
dataset
,
_data_func
,
range
(
args
.
gpus
))
model_type
,
model_args
,
args
.
checkpoint
,
dataset
,
_data_func
,
range
(
args
.
gpus
),
workers_per_gpu
=
args
.
proc_per_gpu
)
if
args
.
out
:
if
args
.
out
:
print
(
'writing results to {}'
.
format
(
args
.
out
))
mmcv
.
dump
(
outputs
,
args
.
out
)
mmcv
.
dump
(
outputs
,
args
.
out
)
if
args
.
eval
:
eval_types
=
args
.
eval
json_file
=
args
.
out
+
'.json'
if
eval_types
:
results2json
(
dataset
,
outputs
,
json_file
)
print
(
'Starting evaluate {}'
.
format
(
' and '
.
join
(
eval_types
)))
coco_eval
(
json_file
,
args
.
eval
,
dataset
.
coco
)
if
eval_types
==
[
'proposal_fast'
]:
result_file
=
args
.
out
else
:
result_file
=
args
.
out
+
'.json'
results2json
(
dataset
,
outputs
,
result_file
)
coco_eval
(
result_file
,
eval_types
,
dataset
.
coco
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment