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
feff0224
Commit
feff0224
authored
Jan 26, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added BFM perf. test
parent
ba32b447
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
2 deletions
+77
-2
performance.cpp
samples/gpu/performance/performance.cpp
+2
-2
tests.cpp
samples/gpu/performance/tests.cpp
+75
-0
No files found.
samples/gpu/performance/performance.cpp
View file @
feff0224
...
...
@@ -56,7 +56,7 @@ void TestSystem::flushSubtestData()
int
cpu_time
=
static_cast
<
int
>
(
cpu_elapsed_
/
getTickFrequency
()
*
1000.0
);
int
gpu_time
=
static_cast
<
int
>
(
gpu_elapsed_
/
getTickFrequency
()
*
1000.0
);
double
speedup
=
static_cast
<
double
>
(
cpu_elapsed_
)
/
gpu_elapsed_
;
double
speedup
=
static_cast
<
double
>
(
cpu_elapsed_
)
/
std
::
max
((
int64
)
1
,
gpu_elapsed_
)
;
speedup_total_
+=
speedup
;
printItem
(
cpu_time
,
gpu_time
,
speedup
);
...
...
@@ -80,7 +80,7 @@ void TestSystem::printSummary()
{
cout
<<
setiosflags
(
ios_base
::
fixed
);
cout
<<
"
\n
average GPU speedup: x"
<<
setprecision
(
3
)
<<
speedup_total_
/
num_subtests_called_
<<
setprecision
(
3
)
<<
speedup_total_
/
std
::
max
(
1
,
num_subtests_called_
)
<<
endl
;
cout
<<
resetiosflags
(
ios_base
::
fixed
);
}
...
...
samples/gpu/performance/tests.cpp
View file @
feff0224
...
...
@@ -273,4 +273,78 @@ TEST(SURF)
d_surf
(
d_src1
,
gpu
::
GpuMat
(),
d_keypoints1
);
d_surf
(
d_src2
,
gpu
::
GpuMat
(),
d_keypoints2
);
GPU_OFF
;
}
TEST
(
BruteForceMatcher
)
{
RNG
rng
(
0
);
// Init CPU matcher
int
desc_len
=
128
;
int
num_trains
=
rng
.
uniform
(
1
,
5
);
BruteForceMatcher
<
L2
<
float
>
>
matcher
;
Mat
query
;
gen
(
query
,
rng
.
uniform
(
100
,
300
),
desc_len
,
CV_32F
,
0
,
10
);
vector
<
Mat
>
trains
(
num_trains
);
for
(
int
i
=
0
;
i
<
num_trains
;
++
i
)
{
Mat
train
;
gen
(
train
,
rng
.
uniform
(
100
,
300
),
desc_len
,
CV_32F
,
0
,
10
);
trains
[
i
]
=
train
;
}
matcher
.
add
(
trains
);
// Init GPU matcher
gpu
::
BruteForceMatcher_GPU
<
L2
<
float
>
>
d_matcher
;
gpu
::
GpuMat
d_query
(
query
);
vector
<
gpu
::
GpuMat
>
d_trains
(
num_trains
);
for
(
int
i
=
0
;
i
<
num_trains
;
++
i
)
{
d_trains
[
i
]
=
trains
[
i
];
}
d_matcher
.
add
(
d_trains
);
// Output
vector
<
vector
<
DMatch
>
>
matches
(
1
);
vector
<
vector
<
DMatch
>
>
d_matches
(
1
);
SUBTEST
<<
"match"
;
CPU_ON
;
matcher
.
match
(
query
,
matches
[
0
]);
CPU_OFF
;
GPU_ON
;
d_matcher
.
match
(
d_query
,
d_matches
[
0
]);
GPU_OFF
;
SUBTEST
<<
"knnMatch"
;
int
knn
=
rng
.
uniform
(
3
,
10
);
CPU_ON
;
matcher
.
knnMatch
(
query
,
matches
,
knn
);
CPU_OFF
;
GPU_ON
;
d_matcher
.
knnMatch
(
d_query
,
d_matches
,
knn
);
GPU_OFF
;
SUBTEST
<<
"radiusMatch"
;
float
max_distance
=
rng
.
uniform
(
25.0
f
,
65.0
f
);
CPU_ON
;
matcher
.
radiusMatch
(
query
,
matches
,
max_distance
);
CPU_OFF
;
GPU_ON
;
d_matcher
.
radiusMatch
(
d_query
,
d_matches
,
max_distance
);
GPU_OFF
;
}
\ 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