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
fa55d51b
Commit
fa55d51b
authored
Oct 15, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sanity check to performance tests for soft cascade
parent
ca81628a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
4 deletions
+51
-4
perf_softcascade.cpp
modules/gpu/perf/perf_softcascade.cpp
+51
-4
No files found.
modules/gpu/perf/perf_softcascade.cpp
View file @
fa55d51b
...
@@ -22,6 +22,44 @@
...
@@ -22,6 +22,44 @@
#define FAIL_NO_CPU(fixture, name)\
#define FAIL_NO_CPU(fixture, name)\
void fixture##_##name::__cpu() { FAIL() << "No such CPU implementation analogy";}
void fixture##_##name::__cpu() { FAIL() << "No such CPU implementation analogy";}
namespace
{
struct
DetectionLess
{
bool
operator
()(
const
cv
::
gpu
::
SoftCascade
::
Detection
&
a
,
const
cv
::
gpu
::
SoftCascade
::
Detection
&
b
)
const
{
if
(
a
.
x
!=
b
.
x
)
return
a
.
x
<
b
.
x
;
else
if
(
a
.
y
!=
b
.
y
)
return
a
.
y
<
b
.
y
;
else
if
(
a
.
w
!=
b
.
w
)
return
a
.
w
<
b
.
w
;
else
return
a
.
h
<
b
.
h
;
}
bool
operator
()(
const
cv
::
SoftCascade
::
Detection
&
a
,
const
cv
::
SoftCascade
::
Detection
&
b
)
const
{
const
cv
::
Rect
&
ra
=
a
.
rect
;
const
cv
::
Rect
&
rb
=
b
.
rect
;
if
(
ra
.
x
!=
rb
.
x
)
return
ra
.
x
<
rb
.
x
;
else
if
(
ra
.
y
!=
rb
.
y
)
return
ra
.
y
<
rb
.
y
;
else
if
(
ra
.
width
!=
rb
.
width
)
return
ra
.
width
<
rb
.
width
;
else
return
ra
.
height
<
rb
.
height
;
}
};
cv
::
Mat
sortDetections
(
cv
::
gpu
::
GpuMat
&
objects
)
{
cv
::
Mat
detections
(
objects
);
typedef
cv
::
gpu
::
SoftCascade
::
Detection
Detection
;
Detection
*
begin
=
(
Detection
*
)(
detections
.
ptr
<
char
>
(
0
));
Detection
*
end
=
(
Detection
*
)(
detections
.
ptr
<
char
>
(
0
)
+
detections
.
cols
);
std
::
sort
(
begin
,
end
,
DetectionLess
());
return
detections
;
}
}
typedef
std
::
tr1
::
tuple
<
std
::
string
,
std
::
string
>
fixture_t
;
typedef
std
::
tr1
::
tuple
<
std
::
string
,
std
::
string
>
fixture_t
;
typedef
perf
::
TestBaseWithParam
<
fixture_t
>
SoftCascadeTest
;
typedef
perf
::
TestBaseWithParam
<
fixture_t
>
SoftCascadeTest
;
...
@@ -41,7 +79,7 @@ RUN_GPU(SoftCascadeTest, detect)
...
@@ -41,7 +79,7 @@ RUN_GPU(SoftCascadeTest, detect)
cv
::
gpu
::
SoftCascade
cascade
;
cv
::
gpu
::
SoftCascade
cascade
;
ASSERT_TRUE
(
cascade
.
load
(
perf
::
TestBase
::
getDataPath
(
GET_PARAM
(
0
))));
ASSERT_TRUE
(
cascade
.
load
(
perf
::
TestBase
::
getDataPath
(
GET_PARAM
(
0
))));
cv
::
gpu
::
GpuMat
objectBoxes
(
1
,
1
6384
,
CV_8UC1
),
rois
(
cascade
.
getRoiSize
(),
CV_8UC1
),
trois
;
cv
::
gpu
::
GpuMat
objectBoxes
(
1
,
1
0000
*
sizeof
(
cv
::
gpu
::
SoftCascade
::
Detection
)
,
CV_8UC1
),
rois
(
cascade
.
getRoiSize
(),
CV_8UC1
),
trois
;
rois
.
setTo
(
1
);
rois
.
setTo
(
1
);
cv
::
gpu
::
transpose
(
rois
,
trois
);
cv
::
gpu
::
transpose
(
rois
,
trois
);
...
@@ -53,6 +91,8 @@ RUN_GPU(SoftCascadeTest, detect)
...
@@ -53,6 +91,8 @@ RUN_GPU(SoftCascadeTest, detect)
curr
=
objectBoxes
;
curr
=
objectBoxes
;
cascade
.
detectMultiScale
(
colored
,
trois
,
curr
);
cascade
.
detectMultiScale
(
colored
,
trois
,
curr
);
}
}
SANITY_CHECK
(
sortDetections
(
curr
));
}
}
RUN_CPU
(
SoftCascadeTest
,
detect
)
RUN_CPU
(
SoftCascadeTest
,
detect
)
...
@@ -66,13 +106,16 @@ RUN_CPU(SoftCascadeTest, detect)
...
@@ -66,13 +106,16 @@ RUN_CPU(SoftCascadeTest, detect)
std
::
vector
<
cv
::
Rect
>
rois
;
std
::
vector
<
cv
::
Rect
>
rois
;
typedef
cv
::
SoftCascade
::
Detection
Detection
;
typedef
cv
::
SoftCascade
::
Detection
Detection
;
std
::
vector
<
Detection
>
object
Boxe
s
;
std
::
vector
<
Detection
>
objects
;
cascade
.
detectMultiScale
(
colored
,
rois
,
object
Boxe
s
);
cascade
.
detectMultiScale
(
colored
,
rois
,
objects
);
TEST_CYCLE
()
TEST_CYCLE
()
{
{
cascade
.
detectMultiScale
(
colored
,
rois
,
object
Boxe
s
);
cascade
.
detectMultiScale
(
colored
,
rois
,
objects
);
}
}
std
::
sort
(
objects
.
begin
(),
objects
.
end
(),
DetectionLess
());
SANITY_CHECK
(
objects
);
}
}
static
cv
::
Rect
getFromTable
(
int
idx
)
static
cv
::
Rect
getFromTable
(
int
idx
)
...
@@ -137,6 +180,8 @@ RUN_GPU(SoftCascadeTestRoi, detectInRoi)
...
@@ -137,6 +180,8 @@ RUN_GPU(SoftCascadeTestRoi, detectInRoi)
curr
=
objectBoxes
;
curr
=
objectBoxes
;
cascade
.
detectMultiScale
(
colored
,
trois
,
curr
);
cascade
.
detectMultiScale
(
colored
,
trois
,
curr
);
}
}
SANITY_CHECK
(
sortDetections
(
curr
));
}
}
FAIL_NO_CPU
(
SoftCascadeTestRoi
,
detectInRoi
)
FAIL_NO_CPU
(
SoftCascadeTestRoi
,
detectInRoi
)
...
@@ -177,6 +222,8 @@ RUN_GPU(SoftCascadeTestRoi, detectEachRoi)
...
@@ -177,6 +222,8 @@ RUN_GPU(SoftCascadeTestRoi, detectEachRoi)
curr
=
objectBoxes
;
curr
=
objectBoxes
;
cascade
.
detectMultiScale
(
colored
,
trois
,
curr
);
cascade
.
detectMultiScale
(
colored
,
trois
,
curr
);
}
}
SANITY_CHECK
(
sortDetections
(
curr
));
}
}
FAIL_NO_CPU
(
SoftCascadeTestRoi
,
detectEachRoi
)
FAIL_NO_CPU
(
SoftCascadeTestRoi
,
detectEachRoi
)
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