Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
e9232a4b
Commit
e9232a4b
authored
Jan 24, 2013
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add parameter to control range and extended range for annotations
parent
decb1371
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
roc_test.py
apps/sft/misc/roc_test.py
+14
-0
sft.py
apps/sft/misc/sft.py
+7
-4
No files found.
apps/sft/misc/roc_test.py
View file @
e9232a4b
...
...
@@ -14,6 +14,13 @@ bgr = { "red" : ( 0, 0, 255),
"green"
:
(
0
,
255
,
0
),
"blue"
:
(
255
,
0
,
0
)}
def
range
(
s
):
try
:
lb
,
rb
=
map
(
int
,
s
.
split
(
','
))
return
lb
,
rb
except
:
raise
argparse
.
ArgumentTypeError
(
"Must be lb, rb"
)
def
call_parser
(
f
,
a
):
return
eval
(
"sft.parse_"
+
f
+
"('"
+
a
+
"')"
)
...
...
@@ -31,11 +38,16 @@ if __name__ == "__main__":
parser
.
add_argument
(
"-o"
,
"--output"
,
dest
=
"output"
,
type
=
str
,
metavar
=
"path"
,
help
=
"Path to store resultiong image."
,
default
=
"./roc.png"
)
parser
.
add_argument
(
"-n"
,
"--nscales"
,
dest
=
"nscales"
,
type
=
int
,
metavar
=
"n"
,
help
=
"Prefered count of scales from min to max."
,
default
=
55
)
parser
.
add_argument
(
"-r"
,
"--scale-range"
,
dest
=
"scale_range"
,
type
=
range
,
default
=
(
128
*
0.4
,
128
*
2.4
))
parser
.
add_argument
(
"-e"
,
"--extended-range-ratio"
,
dest
=
"ext_ratio"
,
type
=
float
,
default
=
1.25
)
# required
parser
.
add_argument
(
"-f"
,
"--anttn-format"
,
dest
=
"anttn_format"
,
choices
=
[
'inria'
,
'caltech'
,
"idl"
],
help
=
"Annotation file for test sequence."
,
required
=
True
)
args
=
parser
.
parse_args
()
print
args
.
scale_range
print
args
.
cascade
# # parse annotations
sft
.
initPlot
()
...
...
@@ -64,6 +76,8 @@ if __name__ == "__main__":
boxes
=
samples
[
tail
]
boxes
=
sft
.
norm_acpect_ratio
(
boxes
,
0.5
)
boxes
=
[
b
for
b
in
boxes
if
(
b
[
3
]
-
b
[
1
])
>
args
.
scale_range
[
0
]
/
args
.
ext_ratio
]
boxes
=
[
b
for
b
in
boxes
if
(
b
[
3
]
-
b
[
1
])
<
args
.
scale_range
[
1
]
*
args
.
ext_ratio
]
nannotated
=
nannotated
+
len
(
boxes
)
nframes
=
nframes
+
1
...
...
apps/sft/misc/sft.py
View file @
e9232a4b
...
...
@@ -75,19 +75,22 @@ def initPlot(name = "ROC curve Bahnhof"):
"""Show resulted plot"""
def
showPlot
(
file_name
):
#
plt.savefig(file_name)
plt
.
savefig
(
file_name
)
plt
.
axis
((
pow
(
10
,
-
3
),
pow
(
10
,
1
),
0.0
,
1
))
plt
.
yticks
(
[
0.05
,
0.1
,
0.2
,
0.3
,
0.4
,
0.5
,
0.64
,
0.8
,
1
],
[
'.05'
,
'.10'
,
'.20'
,
'.30'
,
'.40'
,
'.50'
,
'.64'
,
'.80'
,
'1'
]
)
plt
.
show
()
def
match
(
gts
,
dts
):
# Cartesian product for each detection BB_dt with each BB_gt
overlaps
=
[[
dt
.
overlap
(
gt
)
for
gt
in
gts
]
for
dt
in
dts
]
matches_gt
=
[
0
]
*
len
(
gts
)
matches_dt
=
[
0
]
*
len
(
dts
)
matches_ignore
=
[
0
]
*
len
(
dts
)
if
len
(
gts
)
==
0
:
return
matches_dt
,
matches_ignore
# Cartesian product for each detection BB_dt with each BB_gt
overlaps
=
[[
dt
.
overlap
(
gt
)
for
gt
in
gts
]
for
dt
in
dts
]
for
idx
,
row
in
enumerate
(
overlaps
):
imax
=
row
.
index
(
max
(
row
))
...
...
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