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
9efd7019
Commit
9efd7019
authored
Sep 14, 2012
by
yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A more reasonable verify method for ocl::HOG accuracy test
parent
1052a0b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
12 deletions
+73
-12
test_hog.cpp
modules/ocl/test/test_hog.cpp
+73
-12
No files found.
modules/ocl/test/test_hog.cpp
View file @
9efd7019
...
...
@@ -53,12 +53,10 @@ PARAM_TEST_CASE(HOG,cv::Size,int)
{
cv
::
Size
winSize
;
int
type
;
//vector<cv::ocl::Info> info;
virtual
void
SetUp
()
{
winSize
=
GET_PARAM
(
0
);
type
=
GET_PARAM
(
1
);
//cv::ocl::getDevice(info);
}
};
...
...
@@ -113,6 +111,12 @@ TEST_P(HOG, GetDescriptors)
}
bool
match_rect
(
cv
::
Rect
r1
,
cv
::
Rect
r2
,
int
threshold
)
{
return
((
abs
(
r1
.
x
-
r2
.
x
)
<
threshold
)
&&
(
abs
(
r1
.
y
-
r2
.
y
)
<
threshold
)
&&
(
abs
(
r1
.
width
-
r2
.
width
)
<
threshold
)
&&
(
abs
(
r1
.
height
-
r2
.
height
)
<
threshold
));
}
TEST_P
(
HOG
,
Detect
)
{
// Load image
...
...
@@ -161,32 +165,89 @@ TEST_P(HOG, Detect)
}
// OpenCL detection
std
::
vector
<
cv
::
Point
>
d_v_locations
;
ocl_hog
.
detect
(
d_img
,
d_v_locations
,
0
);
cv
::
Mat
d_locations
(
d_v_locations
);
std
::
vector
<
cv
::
Rect
>
d_found
;
ocl_hog
.
detectMultiScale
(
d_img
,
d_found
,
0
,
cv
::
Size
(
8
,
8
),
cv
::
Size
(
0
,
0
),
1.05
,
2
);
// CPU detection
std
::
vector
<
cv
::
Point
>
v_locations
;
std
::
vector
<
cv
::
Rect
>
found
;
switch
(
type
)
{
case
CV_8UC1
:
hog
.
detect
(
img
,
v_locations
,
0
);
hog
.
detect
MultiScale
(
img
,
found
,
0
,
cv
::
Size
(
8
,
8
),
cv
::
Size
(
0
,
0
),
1.05
,
2
);
break
;
case
CV_8UC4
:
default
:
hog
.
detect
(
img_rgb
,
v_locations
,
0
);
hog
.
detect
MultiScale
(
img_rgb
,
found
,
0
,
cv
::
Size
(
8
,
8
),
cv
::
Size
(
0
,
0
),
1.05
,
2
);
break
;
}
cv
::
Mat
locations
(
v_locations
);
// Ground-truth rectangular people window
cv
::
Rect
win1_64x128
(
231
,
190
,
72
,
144
);
cv
::
Rect
win2_64x128
(
621
,
156
,
97
,
194
);
cv
::
Rect
win1_48x96
(
238
,
198
,
63
,
126
);
cv
::
Rect
win2_48x96
(
619
,
161
,
92
,
185
);
cv
::
Rect
win3_48x96
(
488
,
136
,
56
,
112
);
// Compare whether ground-truth windows are detected and compare the number of windows detected.
std
::
vector
<
int
>
d_comp
(
4
);
std
::
vector
<
int
>
comp
(
4
);
for
(
int
i
=
0
;
i
<
(
int
)
d_comp
.
size
();
i
++
)
{
d_comp
[
i
]
=
0
;
comp
[
i
]
=
0
;
}
int
threshold
=
10
;
int
val
=
32
;
d_comp
[
0
]
=
d_found
.
size
();
comp
[
0
]
=
found
.
size
();
if
(
winSize
==
cv
::
Size
(
48
,
96
))
{
for
(
int
i
=
0
;
i
<
(
int
)
d_found
.
size
();
i
++
)
{
if
(
match_rect
(
d_found
[
i
],
win1_48x96
,
threshold
))
d_comp
[
1
]
=
val
;
if
(
match_rect
(
d_found
[
i
],
win2_48x96
,
threshold
))
d_comp
[
2
]
=
val
;
if
(
match_rect
(
d_found
[
i
],
win3_48x96
,
threshold
))
d_comp
[
3
]
=
val
;
}
for
(
int
i
=
0
;
i
<
(
int
)
found
.
size
();
i
++
)
{
if
(
match_rect
(
found
[
i
],
win1_48x96
,
threshold
))
comp
[
1
]
=
val
;
if
(
match_rect
(
found
[
i
],
win2_48x96
,
threshold
))
comp
[
2
]
=
val
;
if
(
match_rect
(
found
[
i
],
win3_48x96
,
threshold
))
comp
[
3
]
=
val
;
}
}
else
if
(
winSize
==
cv
::
Size
(
64
,
128
))
{
for
(
int
i
=
0
;
i
<
(
int
)
d_found
.
size
();
i
++
)
{
if
(
match_rect
(
d_found
[
i
],
win1_64x128
,
threshold
))
d_comp
[
1
]
=
val
;
if
(
match_rect
(
d_found
[
i
],
win2_64x128
,
threshold
))
d_comp
[
2
]
=
val
;
}
for
(
int
i
=
0
;
i
<
(
int
)
found
.
size
();
i
++
)
{
if
(
match_rect
(
found
[
i
],
win1_64x128
,
threshold
))
comp
[
1
]
=
val
;
if
(
match_rect
(
found
[
i
],
win2_64x128
,
threshold
))
comp
[
2
]
=
val
;
}
}
char
s
[
100
]
=
{
0
};
EXPECT_MAT_NEAR
(
d_locations
,
locations
,
0
,
s
);
EXPECT_MAT_NEAR
(
cv
::
Mat
(
d_comp
),
cv
::
Mat
(
comp
),
3
,
s
);
}
INSTANTIATE_TEST_CASE_P
(
OCL_ObjDetect
,
HOG
,
testing
::
Combine
(
INSTANTIATE_TEST_CASE_P
(
GPU_ImgProc
,
HOG
,
testing
::
Combine
(
testing
::
Values
(
cv
::
Size
(
64
,
128
),
cv
::
Size
(
48
,
96
)),
testing
::
Values
(
MatType
(
CV_8UC1
),
MatType
(
CV_8UC
3
),
MatType
(
CV_8UC
4
))));
testing
::
Values
(
MatType
(
CV_8UC1
),
MatType
(
CV_8UC4
))));
#endif //HAVE_OPENCL
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