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
767b28f2
Commit
767b28f2
authored
Mar 01, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests
parent
c1c31393
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
275 additions
and
207 deletions
+275
-207
perf_arithm.cpp
modules/ocl/perf/perf_arithm.cpp
+38
-156
perf_brute_force_matcher.cpp
modules/ocl/perf/perf_brute_force_matcher.cpp
+23
-10
perf_fft.cpp
modules/ocl/perf/perf_fft.cpp
+0
-3
perf_gemm.cpp
modules/ocl/perf/perf_gemm.cpp
+8
-4
perf_hog.cpp
modules/ocl/perf/perf_hog.cpp
+1
-1
perf_imgproc.cpp
modules/ocl/perf/perf_imgproc.cpp
+4
-16
perf_imgwarp.cpp
modules/ocl/perf/perf_imgwarp.cpp
+0
-3
perf_kalman.cpp
modules/ocl/perf/perf_kalman.cpp
+2
-2
perf_match_template.cpp
modules/ocl/perf/perf_match_template.cpp
+1
-2
perf_ml.cpp
modules/ocl/perf/perf_ml.cpp
+8
-6
perf_opticalflow.cpp
modules/ocl/perf/perf_opticalflow.cpp
+3
-4
perf_stat.cpp
modules/ocl/perf/perf_stat.cpp
+187
-0
No files found.
modules/ocl/perf/perf_arithm.cpp
View file @
767b28f2
...
...
@@ -60,15 +60,14 @@ OCL_PERF_TEST_P(LUTFixture, LUT,
// getting params
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
const
int
type
=
get
<
1
>
(
params
)
,
cn
=
CV_MAT_CN
(
type
)
;
// creating src data
Mat
src
(
srcSize
,
CV_8UC
1
),
lut
(
1
,
256
,
type
);
Mat
src
(
srcSize
,
CV_8UC
(
cn
)
),
lut
(
1
,
256
,
type
);
int
dstType
=
CV_MAKETYPE
(
lut
.
depth
(),
src
.
channels
());
Mat
dst
(
srcSize
,
dstType
);
randu
(
lut
,
0
,
2
);
declare
.
in
(
src
,
WARMUP_RNG
).
in
(
lut
).
out
(
dst
);
declare
.
in
(
src
,
lut
,
WARMUP_RNG
).
out
(
dst
);
// select implementation
if
(
RUN_OCL_IMPL
)
...
...
@@ -564,158 +563,6 @@ OCL_PERF_TEST_P(FlipFixture, Flip,
OCL_PERF_ELSE
}
///////////// MinMax ////////////////////////
typedef
Size_MatType
MinMaxFixture
;
PERF_TEST_P
(
MinMaxFixture
,
MinMax
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
);
double
min_val
=
std
::
numeric_limits
<
double
>::
max
(),
max_val
=
std
::
numeric_limits
<
double
>::
min
();
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
minMax
(
oclSrc
,
&
min_val
,
&
max_val
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
Point
min_loc
,
max_loc
;
TEST_CYCLE
()
cv
::
minMaxLoc
(
src
,
&
min_val
,
&
max_val
,
&
min_loc
,
&
max_loc
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
OCL_PERF_ELSE
}
///////////// MinMaxLoc ////////////////////////
typedef
Size_MatType
MinMaxLocFixture
;
OCL_PERF_TEST_P
(
MinMaxLocFixture
,
MinMaxLoc
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
randu
(
src
,
0
,
1
);
declare
.
in
(
src
);
double
min_val
=
0.0
,
max_val
=
0.0
;
Point
min_loc
,
max_loc
;
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
minMaxLoc
(
oclSrc
,
&
min_val
,
&
max_val
,
&
min_loc
,
&
max_loc
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
cv
::
minMaxLoc
(
src
,
&
min_val
,
&
max_val
,
&
min_loc
,
&
max_loc
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
OCL_PERF_ELSE
}
///////////// Sum ////////////////////////
typedef
Size_MatType
SumFixture
;
OCL_PERF_TEST_P
(
SumFixture
,
Sum
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
Scalar
result
;
randu
(
src
,
0
,
60
);
declare
.
in
(
src
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
result
=
cv
::
ocl
::
sum
(
oclSrc
);
SANITY_CHECK
(
result
,
1e-6
,
ERROR_RELATIVE
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
result
=
cv
::
sum
(
src
);
SANITY_CHECK
(
result
,
1e-6
,
ERROR_RELATIVE
);
}
else
OCL_PERF_ELSE
}
///////////// countNonZero ////////////////////////
typedef
Size_MatType
CountNonZeroFixture
;
OCL_PERF_TEST_P
(
CountNonZeroFixture
,
CountNonZero
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
int
result
=
0
;
randu
(
src
,
0
,
256
);
declare
.
in
(
src
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
result
=
cv
::
ocl
::
countNonZero
(
oclSrc
);
SANITY_CHECK
(
result
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
result
=
cv
::
countNonZero
(
src
);
SANITY_CHECK
(
result
);
}
else
OCL_PERF_ELSE
}
///////////// Phase ////////////////////////
typedef
Size_MatType
PhaseFixture
;
...
...
@@ -895,6 +742,41 @@ OCL_PERF_TEST_P(BitwiseNotFixture, Bitwise_not,
OCL_PERF_ELSE
}
///////////// SetIdentity ////////////////////////
typedef
Size_MatType
SetIdentityFixture
;
OCL_PERF_TEST_P
(
SetIdentityFixture
,
SetIdentity
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
Scalar
s
=
Scalar
::
all
(
17
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
src
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
setIdentity
(
oclSrc
,
s
);
oclSrc
.
download
(
src
);
SANITY_CHECK
(
src
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
cv
::
setIdentity
(
src
,
s
);
SANITY_CHECK
(
src
);
}
else
OCL_PERF_ELSE
}
///////////// compare////////////////////////
CV_ENUM
(
CmpCode
,
CMP_LT
,
CMP_LE
,
CMP_EQ
,
CMP_NE
,
CMP_GE
,
CMP_GT
)
...
...
modules/ocl/perf/perf_brute_force_matcher.cpp
View file @
767b28f2
...
...
@@ -46,17 +46,22 @@
#include "perf_precomp.hpp"
using
namespace
perf
;
using
std
::
tr1
::
get
;
//////////////////// BruteForceMatch /////////////////
typedef
TestBaseWithParam
<
Size
>
BruteForceMatcherFixture
;
typedef
Size_MatType
BruteForceMatcherFixture
;
OCL_PERF_TEST_P
(
BruteForceMatcherFixture
,
Match
,
OCL_PERF_ENUM
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
))
OCL_PERF_TEST_P
(
BruteForceMatcherFixture
,
Match
,
::
testing
::
Combine
(
OCL_PERF_ENUM
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
),
OCL_PERF_ENUM
(
MatType
(
CV_32FC1
))))
{
const
Size
srcSize
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
vector
<
DMatch
>
matches
;
Mat
query
(
srcSize
,
CV_32FC1
),
train
(
srcSize
,
CV_32FC1
);
Mat
query
(
srcSize
,
type
),
train
(
srcSize
,
type
);
declare
.
in
(
query
,
train
);
randu
(
query
,
0.0
f
,
1.0
f
);
randu
(
train
,
0.0
f
,
1.0
f
);
...
...
@@ -82,12 +87,16 @@ OCL_PERF_TEST_P(BruteForceMatcherFixture, Match, OCL_PERF_ENUM(OCL_SIZE_1, OCL_S
OCL_PERF_ELSE
}
OCL_PERF_TEST_P
(
BruteForceMatcherFixture
,
KnnMatch
,
OCL_PERF_ENUM
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
))
OCL_PERF_TEST_P
(
BruteForceMatcherFixture
,
KnnMatch
,
::
testing
::
Combine
(
OCL_PERF_ENUM
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
),
OCL_PERF_ENUM
(
MatType
(
CV_32FC1
))))
{
const
Size
srcSize
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
vector
<
vector
<
DMatch
>
>
matches
(
2
);
Mat
query
(
srcSize
,
CV_32F
),
train
(
srcSize
,
CV_32F
);
Mat
query
(
srcSize
,
type
),
train
(
srcSize
,
type
);
randu
(
query
,
0.0
f
,
1.0
f
);
randu
(
train
,
0.0
f
,
1.0
f
);
...
...
@@ -121,13 +130,17 @@ OCL_PERF_TEST_P(BruteForceMatcherFixture, KnnMatch, OCL_PERF_ENUM(OCL_SIZE_1, OC
OCL_PERF_ELSE
}
OCL_PERF_TEST_P
(
BruteForceMatcherFixture
,
RadiusMatch
,
OCL_PERF_ENUM
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
))
OCL_PERF_TEST_P
(
BruteForceMatcherFixture
,
RadiusMatch
,
::
testing
::
Combine
(
OCL_PERF_ENUM
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
),
OCL_PERF_ENUM
(
MatType
(
CV_32FC1
))))
{
const
Size
srcSize
=
GetParam
();
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
const
float
max_distance
=
2.0
f
;
vector
<
vector
<
DMatch
>
>
matches
(
2
);
Mat
query
(
srcSize
,
CV_32FC1
),
train
(
srcSize
,
CV_32FC1
);
Mat
query
(
srcSize
,
type
),
train
(
srcSize
,
type
);
declare
.
in
(
query
,
train
);
randu
(
query
,
0.0
f
,
1.0
f
);
...
...
modules/ocl/perf/perf_fft.cpp
View file @
767b28f2
...
...
@@ -71,9 +71,6 @@ OCL_PERF_TEST_P(DftFixture, Dft, ::testing::Combine(testing::Values(OCL_SIZE_1,
randu
(
src
,
0.0
f
,
1.0
f
);
declare
.
in
(
src
);
if
(
srcSize
==
OCL_SIZE_4000
)
declare
.
time
(
7.4
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
),
oclDst
;
...
...
modules/ocl/perf/perf_gemm.cpp
View file @
767b28f2
...
...
@@ -47,28 +47,32 @@
using
namespace
perf
;
using
std
::
tr1
::
get
;
using
std
::
tr1
::
tuple
;
///////////// gemm ////////////////////////
typedef
Size_MatType
GemmFixture
;
#ifdef HAVE_CLAMDBLAS
typedef
tuple
<
Size
,
int
>
GemmParams
;
typedef
TestBaseWithParam
<
GemmParams
>
GemmFixture
;
OCL_PERF_TEST_P
(
GemmFixture
,
Gemm
,
::
testing
::
Combine
(
::
testing
::
Values
(
Size
(
1000
,
1000
),
Size
(
1500
,
1500
)),
::
testing
::
Values
((
int
)
cv
::
GEMM_1_T
,
(
int
)
cv
::
GEMM_1_T
|
(
int
)
cv
::
GEMM_2_T
)))
{
const
Size_MatType_t
params
=
GetParam
();
const
GemmParams
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src1
(
srcSize
,
CV_32FC1
),
src2
(
srcSize
,
CV_32FC1
),
src3
(
srcSize
,
CV_32FC1
),
dst
(
srcSize
,
CV_32FC1
);
declare
.
in
(
src1
,
src2
,
src3
).
out
(
dst
).
time
(
srcSize
==
OCL_SIZE_2000
?
65
:
8
);
randu
(
src1
,
-
10.0
f
,
10.0
f
);
randu
(
src2
,
-
10.0
f
,
10.0
f
);
randu
(
src3
,
-
10.0
f
,
10.0
f
);
declare
.
in
(
src1
,
src2
,
src3
).
out
(
dst
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc1
(
src1
),
oclSrc2
(
src2
),
...
...
modules/ocl/perf/perf_hog.cpp
View file @
767b28f2
...
...
@@ -74,7 +74,7 @@ OCL_PERF_TEST(HOGFixture, HOG)
ASSERT_TRUE
(
!
src
.
empty
())
<<
"can't open input image road.png"
;
vector
<
cv
::
Rect
>
found_locations
;
declare
.
in
(
src
)
.
time
(
5
)
;
declare
.
in
(
src
);
if
(
RUN_PLAIN_IMPL
)
{
...
...
modules/ocl/perf/perf_imgproc.cpp
View file @
767b28f2
...
...
@@ -133,8 +133,7 @@ OCL_PERF_TEST_P(CornerMinEigenValFixture, CornerMinEigenVal,
const
int
blockSize
=
7
,
apertureSize
=
1
+
2
*
3
;
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
CV_32FC1
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
)
.
time
(
srcSize
==
OCL_SIZE_4000
?
20
:
srcSize
==
OCL_SIZE_2000
?
5
:
3
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
const
int
depth
=
CV_MAT_DEPTH
(
type
);
const
ERROR_TYPE
errorType
=
depth
==
CV_8U
?
ERROR_ABSOLUTE
:
ERROR_RELATIVE
;
...
...
@@ -172,8 +171,7 @@ OCL_PERF_TEST_P(CornerHarrisFixture, CornerHarris,
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
CV_32FC1
);
randu
(
src
,
0
,
1
);
declare
.
in
(
src
).
out
(
dst
)
.
time
(
srcSize
==
OCL_SIZE_4000
?
20
:
srcSize
==
OCL_SIZE_2000
?
5
:
3
);
declare
.
in
(
src
).
out
(
dst
);
if
(
RUN_OCL_IMPL
)
{
...
...
@@ -469,9 +467,7 @@ PERF_TEST_P(MeanShiftFilteringFixture, MeanShiftFiltering,
cv
::
TermCriteria
crit
(
cv
::
TermCriteria
::
COUNT
+
cv
::
TermCriteria
::
EPS
,
5
,
1
);
Mat
src
(
srcSize
,
CV_8UC4
),
dst
(
srcSize
,
CV_8UC4
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
)
.
time
(
srcSize
==
OCL_SIZE_4000
?
56
:
srcSize
==
OCL_SIZE_2000
?
15
:
3.8
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
if
(
RUN_PLAIN_IMPL
)
{
...
...
@@ -562,9 +558,7 @@ PERF_TEST_P(MeanShiftProcFixture, MeanShiftProc,
Mat
src
(
srcSize
,
CV_8UC4
),
dst1
(
srcSize
,
CV_8UC4
),
dst2
(
srcSize
,
CV_16SC2
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst1
,
dst2
)
.
time
(
srcSize
==
OCL_SIZE_4000
?
56
:
srcSize
==
OCL_SIZE_2000
?
15
:
3.8
);;
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst1
,
dst2
);
if
(
RUN_PLAIN_IMPL
)
{
...
...
@@ -603,9 +597,6 @@ OCL_PERF_TEST_P(CLAHEFixture, CLAHE, OCL_TEST_SIZES)
const
double
clipLimit
=
40.0
;
declare
.
in
(
src
,
WARMUP_RNG
);
if
(
srcSize
==
OCL_SIZE_4000
)
declare
.
time
(
11
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
),
oclDst
;
...
...
@@ -649,9 +640,6 @@ PERF_TEST_P(ColumnSumFixture, ColumnSum, OCL_TYPICAL_MAT_SIZES)
Mat
src
(
srcSize
,
CV_32FC1
),
dst
(
srcSize
,
CV_32FC1
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
if
(
srcSize
==
OCL_SIZE_4000
)
declare
.
time
(
5
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
),
oclDst
(
srcSize
,
CV_32FC1
);
...
...
modules/ocl/perf/perf_imgwarp.cpp
View file @
767b28f2
...
...
@@ -235,9 +235,6 @@ OCL_PERF_TEST_P(RemapFixture, Remap,
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
if
(
srcSize
==
OCL_SIZE_4000
&&
interpolation
==
INTER_LINEAR
)
declare
.
time
(
9
);
Mat
xmap
,
ymap
;
xmap
.
create
(
srcSize
,
CV_32FC1
);
ymap
.
create
(
srcSize
,
CV_32FC1
);
...
...
modules/ocl/perf/perf_kalman.cpp
View file @
767b28f2
...
...
@@ -46,7 +46,7 @@
#include "perf_precomp.hpp"
#ifdef HAVE_CLAMDBLAS
//
#ifdef HAVE_CLAMDBLAS
using
namespace
perf
;
using
namespace
std
;
...
...
@@ -100,4 +100,4 @@ PERF_TEST_P(KalmanFilterFixture, KalmanFilter,
SANITY_CHECK
(
statePre_
);
}
#endif // HAVE_CLAMDBLAS
//
#endif // HAVE_CLAMDBLAS
modules/ocl/perf/perf_match_template.cpp
View file @
767b28f2
...
...
@@ -99,8 +99,7 @@ OCL_PERF_TEST_P(CV_TM_CCORR_NORMEDFixture, matchTemplate,
Mat
src
(
srcSize
,
CV_8UC1
),
templ
(
templSize
,
CV_8UC1
),
dst
;
const
Size
dstSize
(
src
.
cols
-
templ
.
cols
+
1
,
src
.
rows
-
templ
.
rows
+
1
);
dst
.
create
(
dstSize
,
CV_8UC1
);
declare
.
in
(
src
,
templ
,
WARMUP_RNG
).
out
(
dst
)
.
time
(
srcSize
==
OCL_SIZE_2000
?
10
:
srcSize
==
OCL_SIZE_4000
?
23
:
2
);
declare
.
in
(
src
,
templ
,
WARMUP_RNG
).
out
(
dst
);
if
(
RUN_OCL_IMPL
)
{
...
...
modules/ocl/perf/perf_ml.cpp
View file @
767b28f2
...
...
@@ -55,7 +55,7 @@ static void genData(Mat& trainData, Size size, Mat& trainLabel = Mat().setTo(Sca
trainData
.
create
(
size
,
CV_32FC1
);
randu
(
trainData
,
1.0
,
100.0
);
if
(
nClasses
!=
0
)
if
(
nClasses
!=
0
)
{
trainLabel
.
create
(
size
.
height
,
1
,
CV_8UC1
);
randu
(
trainLabel
,
0
,
nClasses
-
1
);
...
...
@@ -82,7 +82,7 @@ PERF_TEST_P(KNNFixture, KNN,
genData
(
testData
,
size
);
Mat
best_label
;
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
{
...
...
@@ -90,7 +90,8 @@ PERF_TEST_P(KNNFixture, KNN,
knn_cpu
.
train
(
trainData
,
trainLabels
);
knn_cpu
.
find_nearest
(
testData
,
k
,
&
best_label
);
}
}
else
if
(
RUN_OCL_IMPL
)
}
else
if
(
RUN_OCL_IMPL
)
{
cv
::
ocl
::
oclMat
best_label_ocl
;
cv
::
ocl
::
oclMat
testdata
;
...
...
@@ -103,7 +104,8 @@ PERF_TEST_P(KNNFixture, KNN,
knn_ocl
.
find_nearest
(
testdata
,
k
,
best_label_ocl
);
}
best_label_ocl
.
download
(
best_label
);
}
else
}
else
OCL_PERF_ELSE
SANITY_CHECK
(
best_label
);
}
...
...
@@ -188,7 +190,7 @@ PERF_TEST_P(SVMFixture, DISABLED_SVM,
CvMat
samples_
=
samples
;
CvMat
results_
=
results
;
if
(
RUN_PLAIN_IMPL
)
if
(
RUN_PLAIN_IMPL
)
{
CvSVM
svm
;
svm
.
train
(
trainData
,
labels
,
Mat
(),
Mat
(),
params
);
...
...
@@ -197,7 +199,7 @@ PERF_TEST_P(SVMFixture, DISABLED_SVM,
svm
.
predict
(
&
samples_
,
&
results_
);
}
}
else
if
(
RUN_OCL_IMPL
)
else
if
(
RUN_OCL_IMPL
)
{
CvSVM_OCL
svm
;
svm
.
train
(
trainData
,
labels
,
Mat
(),
Mat
(),
params
);
...
...
modules/ocl/perf/perf_opticalflow.cpp
View file @
767b28f2
...
...
@@ -52,13 +52,12 @@ using std::tr1::get;
using
std
::
tr1
::
tuple
;
using
std
::
tr1
::
make_tuple
;
typedef
tuple
<
int
>
PyrLKOpticalFlowParamType
;
typedef
TestBaseWithParam
<
int
>
PyrLKOpticalFlowFixture
;
typedef
TestBaseWithParam
<
tuple
<
int
>
>
PyrLKOpticalFlowFixture
;
OCL_PERF_TEST_P
(
PyrLKOpticalFlowFixture
,
PyrLKOpticalFlow
,
::
testing
::
Values
(
1000
,
2000
,
4000
))
{
const
int
pointsCount
=
GetParam
(
);
const
int
pointsCount
=
get
<
0
>
(
GetParam
()
);
const
string
fileName0
=
"gpu/opticalflow/rubberwhale1.png"
,
fileName1
=
"gpu/opticalflow/rubberwhale2.png"
;
...
...
@@ -109,7 +108,7 @@ PERF_TEST(tvl1flowFixture, tvl1flow)
const
Size
srcSize
=
frame0
.
size
();
const
double
eps
=
1.2
;
Mat
flow
(
srcSize
,
CV_32FC2
),
flow1
(
srcSize
,
CV_32FC1
),
flow2
(
srcSize
,
CV_32FC1
);
declare
.
in
(
frame0
,
frame1
).
out
(
flow1
,
flow2
)
.
time
(
159
)
;
declare
.
in
(
frame0
,
frame1
).
out
(
flow1
,
flow2
);
if
(
RUN_PLAIN_IMPL
)
{
...
...
modules/ocl/perf/perf_
norm
.cpp
→
modules/ocl/perf/perf_
stat
.cpp
View file @
767b28f2
...
...
@@ -49,6 +49,193 @@ using namespace perf;
using
std
::
tr1
::
tuple
;
using
std
::
tr1
::
get
;
///////////// MinMax ////////////////////////
typedef
Size_MatType
MinMaxFixture
;
PERF_TEST_P
(
MinMaxFixture
,
MinMax
,
::
testing
::
Combine
(
OCL_TYPICAL_MAT_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
);
double
min_val
=
std
::
numeric_limits
<
double
>::
max
(),
max_val
=
std
::
numeric_limits
<
double
>::
min
();
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
minMax
(
oclSrc
,
&
min_val
,
&
max_val
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
Point
min_loc
,
max_loc
;
TEST_CYCLE
()
cv
::
minMaxLoc
(
src
,
&
min_val
,
&
max_val
,
&
min_loc
,
&
max_loc
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
OCL_PERF_ELSE
}
///////////// MinMaxLoc ////////////////////////
typedef
Size_MatType
MinMaxLocFixture
;
OCL_PERF_TEST_P
(
MinMaxLocFixture
,
MinMaxLoc
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
randu
(
src
,
0
,
1
);
declare
.
in
(
src
);
double
min_val
=
0.0
,
max_val
=
0.0
;
Point
min_loc
,
max_loc
;
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
minMaxLoc
(
oclSrc
,
&
min_val
,
&
max_val
,
&
min_loc
,
&
max_loc
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
cv
::
minMaxLoc
(
src
,
&
min_val
,
&
max_val
,
&
min_loc
,
&
max_loc
);
ASSERT_GE
(
max_val
,
min_val
);
SANITY_CHECK
(
min_val
);
SANITY_CHECK
(
max_val
);
}
else
OCL_PERF_ELSE
}
///////////// Sum ////////////////////////
typedef
Size_MatType
SumFixture
;
OCL_PERF_TEST_P
(
SumFixture
,
Sum
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
Scalar
result
;
randu
(
src
,
0
,
60
);
declare
.
in
(
src
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
result
=
cv
::
ocl
::
sum
(
oclSrc
);
SANITY_CHECK
(
result
,
1e-6
,
ERROR_RELATIVE
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
result
=
cv
::
sum
(
src
);
SANITY_CHECK
(
result
,
1e-6
,
ERROR_RELATIVE
);
}
else
OCL_PERF_ELSE
}
///////////// countNonZero ////////////////////////
typedef
Size_MatType
CountNonZeroFixture
;
OCL_PERF_TEST_P
(
CountNonZeroFixture
,
CountNonZero
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_PERF_ENUM
(
CV_8UC1
,
CV_32FC1
)))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
int
result
=
0
;
randu
(
src
,
0
,
256
);
declare
.
in
(
src
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
result
=
cv
::
ocl
::
countNonZero
(
oclSrc
);
SANITY_CHECK
(
result
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
result
=
cv
::
countNonZero
(
src
);
SANITY_CHECK
(
result
);
}
else
OCL_PERF_ELSE
}
///////////// meanStdDev ////////////////////////
typedef
Size_MatType
MeanStdDevFixture
;
OCL_PERF_TEST_P
(
MeanStdDevFixture
,
MeanStdDev
,
::
testing
::
Combine
(
OCL_TEST_SIZES
,
OCL_TEST_TYPES
))
{
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Mat
src
(
srcSize
,
type
);
Scalar
mean
,
stddev
;
randu
(
src
,
0
,
256
);
declare
.
in
(
src
);
if
(
RUN_OCL_IMPL
)
{
ocl
::
oclMat
oclSrc
(
src
);
OCL_TEST_CYCLE
()
cv
::
ocl
::
meanStdDev
(
oclSrc
,
mean
,
stddev
);
}
else
if
(
RUN_PLAIN_IMPL
)
{
TEST_CYCLE
()
cv
::
meanStdDev
(
src
,
mean
,
stddev
);
}
else
OCL_PERF_ELSE
SANITY_CHECK_NOTHING
();
// SANITY_CHECK(mean, 1e-6, ERROR_RELATIVE);
// SANITY_CHECK(stddev, 1e-6, ERROR_RELATIVE);
}
///////////// norm////////////////////////
CV_ENUM
(
NormType
,
NORM_INF
,
NORM_L1
,
NORM_L2
)
...
...
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