Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
3e33820e
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,发现更多精彩内容 >>
提交
3e33820e
编写于
11月 17, 2017
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10104 from wzw-intel:fusion_debug
上级
73d4f12c
394101d6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
61 addition
and
1 deletion
+61
-1
modules/dnn/src/ocl4dnn/include/ocl4dnn.hpp
modules/dnn/src/ocl4dnn/include/ocl4dnn.hpp
+1
-1
modules/dnn/test/test_darknet_importer.cpp
modules/dnn/test/test_darknet_importer.cpp
+60
-0
未找到文件。
modules/dnn/src/ocl4dnn/include/ocl4dnn.hpp
浏览文件 @
3e33820e
...
...
@@ -302,7 +302,7 @@ class OCL4DNNConvSpatial
std
::
stringstream
options_
;
cv
::
ocl
::
ProgramSource
src_
;
int32_t
prev_kernel_type_
;
bool
negative_slope_
;
float
negative_slope_
;
UMat
negative_slope_umat_
;
ocl4dnnFusedActiv_t
fused_activ_
;
};
...
...
modules/dnn/test/test_darknet_importer.cpp
浏览文件 @
3e33820e
...
...
@@ -44,6 +44,8 @@
#include "test_precomp.hpp"
#include <opencv2/dnn/shape_utils.hpp>
#include <algorithm>
#include <opencv2/core/ocl.hpp>
#include <opencv2/ts/ocl_test.hpp>
namespace
cvtest
{
...
...
@@ -69,6 +71,64 @@ TEST(Test_Darknet, read_yolo_voc)
ASSERT_FALSE
(
net
.
empty
());
}
OCL_TEST
(
Reproducibility_TinyYoloVoc
,
Accuracy
)
{
Net
net
;
{
const
string
cfg
=
findDataFile
(
"dnn/tiny-yolo-voc.cfg"
,
false
);
const
string
model
=
findDataFile
(
"dnn/tiny-yolo-voc.weights"
,
false
);
net
=
readNetFromDarknet
(
cfg
,
model
);
ASSERT_FALSE
(
net
.
empty
());
}
net
.
setPreferableBackend
(
DNN_BACKEND_DEFAULT
);
net
.
setPreferableTarget
(
DNN_TARGET_OPENCL
);
// dog416.png is dog.jpg that resized to 416x416 in the lossless PNG format
Mat
sample
=
imread
(
_tf
(
"dog416.png"
));
ASSERT_TRUE
(
!
sample
.
empty
());
Size
inputSize
(
416
,
416
);
if
(
sample
.
size
()
!=
inputSize
)
resize
(
sample
,
sample
,
inputSize
);
net
.
setInput
(
blobFromImage
(
sample
,
1
/
255.
F
),
"data"
);
Mat
out
=
net
.
forward
(
"detection_out"
);
Mat
detection
;
const
float
confidenceThreshold
=
0.24
;
for
(
int
i
=
0
;
i
<
out
.
rows
;
i
++
)
{
const
int
probability_index
=
5
;
const
int
probability_size
=
out
.
cols
-
probability_index
;
float
*
prob_array_ptr
=
&
out
.
at
<
float
>
(
i
,
probability_index
);
size_t
objectClass
=
std
::
max_element
(
prob_array_ptr
,
prob_array_ptr
+
probability_size
)
-
prob_array_ptr
;
float
confidence
=
out
.
at
<
float
>
(
i
,
(
int
)
objectClass
+
probability_index
);
if
(
confidence
>
confidenceThreshold
)
detection
.
push_back
(
out
.
row
(
i
));
}
// obtained by: ./darknet detector test ./cfg/voc.data ./cfg/tiny-yolo-voc.cfg ./tiny-yolo-voc.weights -thresh 0.24 ./dog416.png
// There are 2 objects (6-car, 11-dog) with 25 values for each:
// { relative_center_x, relative_center_y, relative_width, relative_height, unused_t0, probability_for_each_class[20] }
float
ref_array
[]
=
{
0.736762
F
,
0.239551
F
,
0.315440
F
,
0.160779
F
,
0.761977
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.761967
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.287486
F
,
0.653731
F
,
0.315579
F
,
0.534527
F
,
0.782737
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.780595
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
,
0.000000
F
};
const
int
number_of_objects
=
2
;
Mat
ref
(
number_of_objects
,
sizeof
(
ref_array
)
/
(
number_of_objects
*
sizeof
(
float
)),
CV_32FC1
,
&
ref_array
);
normAssert
(
ref
,
detection
);
}
TEST
(
Reproducibility_TinyYoloVoc
,
Accuracy
)
{
Net
net
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录