Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
60c0e41b
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
60c0e41b
编写于
11月 26, 2012
作者:
M
marina.kolpakova
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
integrate NMS (Dollar's criteria)
上级
d2e88e1d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
15 deletion
+33
-15
modules/gpu/src/cuda/icf-sc.cu
modules/gpu/src/cuda/icf-sc.cu
+19
-10
modules/gpu/src/softcascade.cpp
modules/gpu/src/softcascade.cpp
+14
-5
未找到文件。
modules/gpu/src/cuda/icf-sc.cu
浏览文件 @
60c0e41b
...
...
@@ -88,19 +88,23 @@ namespace icf {
return
(
w
<
0
||
h
<
0
)
?
0.
f
:
(
float
)(
w
*
h
);
}
__global__
void
overlap
(
const
uint
*
n
,
const
Detection
*
detections
,
uchar
*
overlaps
)
texture
<
uint4
,
cudaTextureType2D
,
cudaReadModeElementType
>
tdetections
;
__global__
void
overlap
(
const
uint
*
n
,
uchar
*
overlaps
)
{
const
int
idx
=
threadIdx
.
x
;
const
int
total
=
*
n
;
for
(
int
i
=
idx
;
i
<
total
;
i
+=
192
)
for
(
int
i
=
idx
+
1
;
i
<
total
;
i
+=
192
)
{
const
Detection
&
a
=
detections
[
i
];
const
uint4
_a
=
tex2D
(
tdetections
,
i
,
0
);
const
Detection
&
a
=
*
((
Detection
*
)(
&
_a
));
bool
excluded
=
false
;
for
(
int
j
=
i
+
1
;
j
<
total
;
++
j
)
{
const
Detection
&
b
=
detections
[
j
];
const
uint4
_b
=
tex2D
(
tdetections
,
j
,
0
);
const
Detection
&
b
=
*
((
Detection
*
)(
&
_b
));
float
ovl
=
overlapArea
(
a
,
b
)
/
::
min
(
a
.
w
*
a
.
h
,
b
.
w
*
b
.
h
);
if
(
ovl
>
0.65
f
)
...
...
@@ -115,7 +119,7 @@ namespace icf {
}
}
__global__
void
collect
(
const
uint
*
n
,
const
Detection
*
detections
,
uchar
*
overlaps
)
__global__
void
collect
(
const
uint
*
n
,
uchar
*
overlaps
,
uint
*
ctr
,
uint4
*
suppressed
)
{
const
int
idx
=
threadIdx
.
x
;
const
int
total
=
*
n
;
...
...
@@ -124,19 +128,24 @@ namespace icf {
{
if
(
!
overlaps
[
i
])
{
const
Detection
&
det
=
detections
[
i
]
;
// printf("%d: %d %d %d %d %f\n", i, det.x, det.y, det.w, det.h, det.confidence
);
int
oidx
=
atomicInc
(
ctr
,
50
)
;
suppressed
[
oidx
]
=
tex2D
(
tdetections
,
i
+
1
,
0
);
}
}
}
void
suppress
(
const
PtrStepSzb
&
objects
,
PtrStepSzb
overlaps
,
PtrStepSzi
ndetections
)
void
suppress
(
const
PtrStepSzb
&
objects
,
PtrStepSzb
overlaps
,
PtrStepSzi
ndetections
,
PtrStepSzb
suppressed
)
{
int
block
=
192
;
int
grid
=
1
;
overlap
<<<
grid
,
block
>>>
((
uint
*
)
ndetections
.
ptr
(
0
),
(
Detection
*
)
objects
.
ptr
(
0
),
(
uchar
*
)
overlaps
.
ptr
(
0
));
collect
<<<
grid
,
block
>>>
((
uint
*
)
ndetections
.
ptr
(
0
),
(
Detection
*
)
objects
.
ptr
(
0
),
(
uchar
*
)
overlaps
.
ptr
(
0
));
cudaChannelFormatDesc
desc
=
cudaCreateChannelDesc
<
uint4
>
();
size_t
offset
;
cudaSafeCall
(
cudaBindTexture2D
(
&
offset
,
tdetections
,
objects
.
data
,
desc
,
objects
.
cols
/
sizeof
(
uint4
),
objects
.
rows
,
objects
.
step
));
overlap
<<<
grid
,
block
>>>
((
uint
*
)
ndetections
.
ptr
(
0
),
(
uchar
*
)
overlaps
.
ptr
(
0
));
collect
<<<
grid
,
block
>>>
((
uint
*
)
ndetections
.
ptr
(
0
),
(
uchar
*
)
overlaps
.
ptr
(
0
),
(
uint
*
)
suppressed
.
ptr
(
0
),
((
uint4
*
)
suppressed
.
ptr
(
0
))
+
1
);
// if (!stream)
{
cudaSafeCall
(
cudaGetLastError
());
...
...
modules/gpu/src/softcascade.cpp
浏览文件 @
60c0e41b
...
...
@@ -86,7 +86,7 @@ namespace icf {
void
fillBins
(
cv
::
gpu
::
PtrStepSzb
hogluv
,
const
cv
::
gpu
::
PtrStepSzf
&
nangle
,
const
int
fw
,
const
int
fh
,
const
int
bins
,
cudaStream_t
stream
);
void
suppress
(
const
PtrStepSzb
&
objects
,
PtrStepSzb
overlaps
,
PtrStepSzi
ndetections
);
void
suppress
(
const
PtrStepSzb
&
objects
,
PtrStepSzb
overlaps
,
PtrStepSzi
ndetections
,
PtrStepSzb
suppressed
);
}
namespace
imgproc
{
...
...
@@ -312,6 +312,7 @@ struct cv::gpu::SCascade::Fields
hogluv
.
setTo
(
cv
::
Scalar
::
all
(
0
));
overlaps
.
create
(
1
,
5000
,
CV_8UC1
);
suppressed
.
create
(
1
,
sizeof
(
Detection
)
*
51
,
CV_8UC1
);
return
true
;
}
...
...
@@ -447,7 +448,9 @@ public:
{
ensureSizeIsEnough
(
objects
.
rows
,
objects
.
cols
,
CV_8UC1
,
overlaps
);
overlaps
.
setTo
(
0
);
device
::
icf
::
suppress
(
objects
,
overlaps
,
ndetections
);
suppressed
.
setTo
(
0
);
device
::
icf
::
suppress
(
objects
,
overlaps
,
ndetections
,
suppressed
);
// std::cout << cv::Mat(overlaps) << std::endl;
}
...
...
@@ -484,6 +487,9 @@ public:
// used for area overlap computing during
GpuMat
overlaps
;
// used for suppression
GpuMat
suppressed
;
// Cascade from xml
GpuMat
octaves
;
GpuMat
stages
;
...
...
@@ -525,7 +531,6 @@ bool cv::gpu::SCascade::load(const FileNode& fn)
void
cv
::
gpu
::
SCascade
::
detect
(
InputArray
image
,
InputArray
_rois
,
OutputArray
_objects
,
Stream
&
s
)
const
{
CV_Assert
(
fields
);
const
GpuMat
colored
=
image
.
getGpuMat
();
// only color images are supperted
...
...
@@ -545,6 +550,7 @@ void cv::gpu::SCascade::detect(InputArray image, InputArray _rois, OutputArray _
colored
.
copyTo
(
flds
.
hogluv
);
}
GpuMat
spr
(
objects
,
cv
::
Rect
(
0
,
0
,
flds
.
suppressed
.
cols
,
flds
.
suppressed
.
rows
));
GpuMat
tmp
=
GpuMat
(
objects
,
cv
::
Rect
(
0
,
0
,
sizeof
(
Detection
),
1
));
objects
=
GpuMat
(
objects
,
cv
::
Rect
(
sizeof
(
Detection
),
0
,
objects
.
cols
-
sizeof
(
Detection
),
1
));
...
...
@@ -552,8 +558,11 @@ void cv::gpu::SCascade::detect(InputArray image, InputArray _rois, OutputArray _
flds
.
detect
(
rois
,
tmp
,
objects
,
stream
);
// if (rejCriteria != NO_REJECT)
flds
.
suppress
(
tmp
,
objects
);
if
(
rejCriteria
!=
NO_REJECT
)
{
flds
.
suppress
(
tmp
,
objects
);
flds
.
suppressed
.
copyTo
(
spr
);
}
}
void
cv
::
gpu
::
SCascade
::
genRoi
(
InputArray
_roi
,
OutputArray
_mask
,
Stream
&
stream
)
const
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录