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
4622aea8
Commit
4622aea8
authored
Jan 17, 2013
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ROC test: add overlap calculation according to Pascal criteria
parent
acdf5444
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
7 deletions
+36
-7
roc_test.py
apps/sft/misk/roc_test.py
+2
-5
sft.py
apps/sft/misk/sft.py
+34
-2
No files found.
apps/sft/misk/roc_test.py
View file @
4622aea8
...
...
@@ -54,13 +54,10 @@ if __name__ == "__main__":
sft
.
draw_rects
(
img
,
boxes
,
(
255
,
0
,
0
),
lambda
x
,
y
:
y
)
frame
=
frame
+
1
# sample = samples[]
rects
,
confs
=
cascade
.
detect
(
img
,
rois
=
None
)
fp
=
sft
.
match
(
boxes
,
rects
,
confs
)
# # draw results
if
rects
is
not
None
:
sft
.
draw_rects
(
img
,
rects
[
0
],
(
0
,
255
,
0
))
...
...
apps/sft/misk/sft.py
View file @
4622aea8
#!/usr/bin/env python
import
cv2
,
re
,
glob
import
numpy
as
np
def
draw_rects
(
img
,
rects
,
color
,
l
=
lambda
x
,
y
:
x
+
y
):
if
rects
is
not
None
:
...
...
@@ -12,6 +13,24 @@ class Sample:
self
.
image
=
img
self
.
bbs
=
bb
class
Detection
:
def
__init__
(
self
,
bb
,
conf
):
self
.
bb
=
bb
self
.
conf
=
conf
# we use rect-stype for dt and box style for gt. ToDo: fix it
def
overlap
(
self
,
b
):
a
=
self
.
bb
print
"HERE:"
,
a
,
b
w
=
min
(
a
[
0
]
+
a
[
2
],
b
[
0
]
+
b
[
2
])
-
max
(
a
[
0
],
b
[
0
]);
h
=
min
(
a
[
1
]
+
a
[
3
],
b
[
1
]
+
b
[
3
])
-
max
(
a
[
1
],
b
[
1
]);
cross_area
=
0.0
if
(
w
<
0
or
h
<
0
)
else
float
(
w
*
h
)
union_area
=
(
a
[
2
]
*
a
[
3
])
+
((
b
[
2
]
-
b
[
0
])
*
(
b
[
3
]
-
b
[
1
]))
-
cross_area
;
return
cross_area
/
union_area
;
def
parse_inria
(
ipath
,
f
):
bbs
=
[]
path
=
None
...
...
@@ -39,4 +58,17 @@ def parse_idl(f):
l
=
re
.
sub
(
r"\:"
,
":["
,
l
)
l
=
re
.
sub
(
r"(\;|\.)$"
,
"]}"
,
l
)
map
.
update
(
eval
(
l
))
return
map
\ No newline at end of file
return
map
def
match
(
gts
,
rects
,
confs
):
if
rects
is
None
:
return
0
dts
=
zip
(
*
[
rects
.
tolist
(),
confs
.
tolist
()])
dts
=
zip
(
dts
[
0
][
0
],
dts
[
0
][
1
])
dts
=
[
Detection
(
r
,
c
)
for
r
,
c
in
dts
]
for
dt
in
dts
:
for
gt
in
gts
:
overlap
=
dt
.
overlap
(
gt
)
print
overlap
\ No newline at end of file
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