Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
cb329400
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cb329400
编写于
1月 30, 2013
作者:
M
marina.kolpakova
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix tests
上级
8d9c9c26
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
29 addition
and
114 deletion
+29
-114
modules/gpu/perf/perf_softcascade.cpp
modules/gpu/perf/perf_softcascade.cpp
+1
-50
modules/gpu/src/cuda/icf-sc.cu
modules/gpu/src/cuda/icf-sc.cu
+1
-1
modules/gpu/src/softcascade.cpp
modules/gpu/src/softcascade.cpp
+2
-14
modules/gpu/test/test_softcascade.cpp
modules/gpu/test/test_softcascade.cpp
+25
-39
modules/objdetect/include/opencv2/objdetect/objdetect.hpp
modules/objdetect/include/opencv2/objdetect/objdetect.hpp
+0
-10
未找到文件。
modules/gpu/perf/perf_softcascade.cpp
浏览文件 @
cb329400
...
...
@@ -194,52 +194,6 @@ RUN_GPU(SCascadeTestRoi, detectEachRoi)
NO_CPU
(
SCascadeTestRoi
,
detectEachRoi
)
SC_PERF_TEST_P
(
SCascadeTest
,
detectOnIntegral
,
testing
::
Combine
(
testing
::
Values
(
std
::
string
(
"cv/cascadeandhog/cascades/inria_caltech-17.01.2013.xml"
),
std
::
string
(
"cv/cascadeandhog/cascades/sc_cvpr_2012_to_opencv_new_format.xml"
)),
testing
::
Values
(
std
::
string
(
"cv/cascadeandhog/integrals.xml"
))))
static
std
::
string
itoa
(
long
i
)
{
static
char
s
[
65
];
sprintf
(
s
,
"%ld"
,
i
);
return
std
::
string
(
s
);
}
RUN_GPU
(
SCascadeTest
,
detectOnIntegral
)
{
cv
::
Mat
cpu
=
readImage
(
"cv/cascadeandhog/images/image_00000000_0.png"
);
ASSERT_FALSE
(
cpu
.
empty
());
cv
::
ICFPreprocessor
preprocessor
;
cv
::
Mat
test_res
(
cpu
.
rows
/
4
*
10
+
1
,
cpu
.
cols
/
4
+
1
,
CV_8UC1
);
preprocessor
.
apply
(
cpu
,
test_res
);
cv
::
gpu
::
SCascade
cascade
;
cv
::
FileStorage
fs
(
perf
::
TestBase
::
getDataPath
(
GET_PARAM
(
0
)),
cv
::
FileStorage
::
READ
);
ASSERT_TRUE
(
fs
.
isOpened
());
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
cv
::
gpu
::
GpuMat
objectBoxes
(
1
,
10000
*
sizeof
(
cv
::
gpu
::
SCascade
::
Detection
),
CV_8UC1
),
rois
(
cv
::
Size
(
640
,
480
),
CV_8UC1
);
rois
.
setTo
(
1
);
cv
::
gpu
::
GpuMat
hogluv
(
test_res
);
cascade
.
detect
(
hogluv
,
rois
,
objectBoxes
);
TEST_CYCLE
()
{
cascade
.
detect
(
hogluv
,
rois
,
objectBoxes
);
}
SANITY_CHECK
(
sortDetections
(
objectBoxes
));
}
NO_CPU
(
SCascadeTest
,
detectOnIntegral
)
SC_PERF_TEST_P
(
SCascadeTest
,
detectStream
,
testing
::
Combine
(
testing
::
Values
(
std
::
string
(
"cv/cascadeandhog/cascades/inria_caltech-17.01.2013.xml"
),
...
...
@@ -271,10 +225,7 @@ RUN_GPU(SCascadeTest, detectStream)
cascade
.
detect
(
colored
,
rois
,
objectBoxes
,
s
);
}
#ifdef HAVE_CUDA
cudaDeviceSynchronize
();
#endif
s
.
waitForCompletion
();
SANITY_CHECK
(
sortDetections
(
objectBoxes
));
}
...
...
modules/gpu/src/cuda/icf-sc.cu
浏览文件 @
cb329400
...
...
@@ -547,7 +547,7 @@ void CascadeInvoker<Policy>::operator()(const PtrStepSzb& roi, const PtrStepSzi&
soft_cascade
<
Policy
,
false
><<<
grid
,
Policy
::
block
(),
0
,
stream
>>>
(
inv
,
det
,
max_det
,
ctr
,
0
);
cudaSafeCall
(
cudaGetLastError
());
grid
=
dim3
(
fw
,
fh
/
Policy
::
STA_Y
,
38
-
downscales
);
grid
=
dim3
(
fw
,
fh
/
Policy
::
STA_Y
,
min
(
38
,
scales
)
-
downscales
);
soft_cascade
<
Policy
,
true
><<<
grid
,
Policy
::
block
(),
0
,
stream
>>>
(
inv
,
det
,
max_det
,
ctr
,
downscales
);
if
(
!
stream
)
...
...
modules/gpu/src/softcascade.cpp
浏览文件 @
cb329400
...
...
@@ -133,10 +133,6 @@ struct cv::gpu::SCascade::Fields
std
::
string
fformat
=
(
string
)
root
[
SC_FEATURE_FORMAT
];
bool
useBoxes
=
(
fformat
==
"BOX"
);
if
(
useBoxes
)
std
::
cout
<<
"use boxes!!!"
;
ushort
shrinkage
=
cv
::
saturate_cast
<
ushort
>
((
int
)
root
[
SC_SHRINKAGE
]);
FileNode
fn
=
root
[
SC_OCTAVES
];
...
...
@@ -154,13 +150,8 @@ struct cv::gpu::SCascade::Fields
{
FileNode
fns
=
*
it
;
float
scale
=
powf
(
2.
f
,
saturate_cast
<
float
>
((
int
)
fns
[
SC_OCT_SCALE
]));
std
::
cout
<<
"octave scale "
<<
scale
<<
std
::
endl
;
bool
isUPOctave
=
scale
>=
1
;
if
(
isUPOctave
)
std
::
cout
<<
"isUPOctave"
<<
std
::
endl
;
ushort
nweaks
=
saturate_cast
<
ushort
>
((
int
)
fns
[
SC_OCT_WEAKS
]);
ushort2
size
;
...
...
@@ -225,11 +216,9 @@ struct cv::gpu::SCascade::Fields
{
inIt
+=
2
;
int
featureIdx
=
(
int
)(
*
(
inIt
++
));
// std::cout << " featureIdx " << featureIdx << " " << feature_rects[featureIdx] << std::endl;
float
orig_threshold
=
(
float
)(
*
(
inIt
++
));
unsigned
int
th
=
saturate_cast
<
unsigned
int
>
((
int
)
orig_threshold
);
// std::cout << "orig_threshold " << orig_threshold << " converted " << th << std::endl;
cv
::
Rect
&
r
=
feature_rects
[
featureIdx
];
uchar4
rect
;
rect
.
x
=
saturate_cast
<
uchar
>
(
r
.
x
);
...
...
@@ -248,7 +237,6 @@ struct cv::gpu::SCascade::Fields
vleaves
.
push_back
((
float
)(
*
inIt
));
}
}
std
::
cout
<<
std
::
endl
;
}
cv
::
Mat
hoctaves
(
1
,
(
int
)
(
voctaves
.
size
()
*
sizeof
(
Octave
)),
CV_8UC1
,
(
uchar
*
)
&
(
voctaves
[
0
]));
...
...
@@ -424,7 +412,7 @@ public:
// 160x120x10
GpuMat
shrunk
;
// tempor
ial mat for integral
l
// tempor
al mat for integra
l
GpuMat
integralBuffer
;
// 161x121x10
...
...
@@ -591,7 +579,7 @@ private:
cv
::
gpu
::
cartToPolar
(
dfdx
,
dfdy
,
mag
,
ang
,
true
,
s
);
// norm
o
lize magnitude to uchar interval and angles to 6 bins
// norm
a
lize magnitude to uchar interval and angles to 6 bins
GpuMat
nmag
(
fplane
,
cv
::
Rect
(
0
,
4
*
fh
,
fw
,
fh
));
GpuMat
nang
(
fplane
,
cv
::
Rect
(
0
,
5
*
fh
,
fw
,
fh
));
...
...
modules/gpu/test/test_softcascade.cpp
浏览文件 @
cb329400
...
...
@@ -219,15 +219,30 @@ INSTANTIATE_TEST_CASE_P(GPU_SoftCascade, SCascadeTestRoi, testing::Combine(
testing
::
Range
(
0
,
5
)));
////////////////////////////////////////
PARAM_TEST_CASE
(
SCascadeTestAll
,
cv
::
gpu
::
DeviceInfo
,
std
::
string
)
namespace
{
struct
Fixture
{
std
::
string
path
;
int
expected
;
Fixture
(){}
Fixture
(
std
::
string
p
,
int
e
)
:
path
(
p
),
expected
(
e
)
{}
};
}
PARAM_TEST_CASE
(
SCascadeTestAll
,
cv
::
gpu
::
DeviceInfo
,
Fixture
)
{
std
::
string
xml
;
int
expected
;
virtual
void
SetUp
()
{
cv
::
gpu
::
setDevice
(
GET_PARAM
(
0
).
deviceID
());
xml
=
path
(
GET_PARAM
(
1
));
xml
=
path
(
GET_PARAM
(
1
).
path
);
expected
=
GET_PARAM
(
1
).
expected
;
}
};
...
...
@@ -265,34 +280,7 @@ GPU_TEST_P(SCascadeTestAll, detect)
}
SHOW
(
coloredCpu
);
// ASSERT_EQ(count, 2448);
}
GPU_TEST_P
(
SCascadeTestAll
,
detectOnIntegral
)
{
cv
::
gpu
::
SCascade
cascade
;
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
ASSERT_TRUE
(
fs
.
isOpened
());
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
cv
::
Mat
coloredCpu
=
cv
::
imread
(
path
(
"images/image_00000000_0.png"
));
cv
::
ICFPreprocessor
preprocessor
;
cv
::
Mat
integrals
(
coloredCpu
.
rows
/
4
*
10
+
1
,
coloredCpu
.
cols
/
4
+
1
,
CV_8UC1
);
preprocessor
.
apply
(
coloredCpu
,
integrals
);
GpuMat
hogluv
(
integrals
);
GpuMat
objectBoxes
(
1
,
100000
,
CV_8UC1
),
rois
(
cv
::
Size
(
640
,
480
),
CV_8UC1
);
rois
.
setTo
(
1
);
objectBoxes
.
setTo
(
0
);
cascade
.
detect
(
hogluv
,
rois
,
objectBoxes
);
// typedef cv::gpu::SCascade::Detection Detection;
// cv::Mat detections(objectBoxes);
// int a = *(detections.ptr<int>(0));
// ASSERT_EQ(a, 1024);
ASSERT_EQ
(
*
count
,
expected
);
}
GPU_TEST_P
(
SCascadeTestAll
,
detectStream
)
...
...
@@ -308,9 +296,7 @@ GPU_TEST_P(SCascadeTestAll, detectStream)
ASSERT_FALSE
(
coloredCpu
.
empty
());
GpuMat
colored
(
coloredCpu
),
objectBoxes
(
1
,
100000
,
CV_8UC1
),
rois
(
colored
.
size
(),
CV_8UC1
);
rois
.
setTo
(
0
);
GpuMat
sub
(
rois
,
cv
::
Rect
(
rois
.
cols
/
4
,
rois
.
rows
/
4
,
rois
.
cols
/
2
,
rois
.
rows
/
2
));
sub
.
setTo
(
cv
::
Scalar
::
all
(
1
));
rois
.
setTo
(
cv
::
Scalar
::
all
(
1
));
cv
::
gpu
::
Stream
s
;
...
...
@@ -318,14 +304,14 @@ GPU_TEST_P(SCascadeTestAll, detectStream)
cascade
.
detect
(
colored
,
rois
,
objectBoxes
,
s
);
s
.
waitForCompletion
();
//
typedef cv::gpu::SCascade::Detection Detection;
//
cv::Mat detections(objectBoxes);
//
int a = *(detections.ptr<int>(0));
// ASSERT_EQ(a, 2448
);
typedef
cv
::
gpu
::
SCascade
::
Detection
Detection
;
cv
::
Mat
detections
(
objectBoxes
);
int
a
=
*
(
detections
.
ptr
<
int
>
(
0
));
ASSERT_EQ
(
a
,
expected
);
}
INSTANTIATE_TEST_CASE_P
(
GPU_SoftCascade
,
SCascadeTestAll
,
testing
::
Combine
(
ALL_DEVICES
,
testing
::
Values
(
std
::
string
(
"cascades/inria_caltech-17.01.2013.xml"
),
std
::
string
(
"cascades/sc_cvpr_2012_to_opencv_new_format.xml"
))));
testing
::
Values
(
Fixture
(
"cascades/inria_caltech-17.01.2013.xml"
,
7
),
Fixture
(
"cascades/sc_cvpr_2012_to_opencv_new_format.xml"
,
1291
))));
#endif
modules/objdetect/include/opencv2/objdetect/objdetect.hpp
浏览文件 @
cb329400
...
...
@@ -488,16 +488,6 @@ protected:
Ptr
<
MaskGenerator
>
maskGenerator
;
};
class
CV_EXPORTS_W
ICFPreprocessor
{
public:
CV_WRAP
ICFPreprocessor
();
CV_WRAP
void
apply
(
cv
::
InputArray
_frame
,
cv
::
OutputArray
_integrals
)
const
;
protected:
enum
{
BINS
=
10
};
};
// Implementation of soft (stageless) cascaded detector.
class
CV_EXPORTS_W
SCascade
:
public
Algorithm
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录