Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
26ea4760
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,发现更多精彩内容 >>
提交
26ea4760
编写于
3月 25, 2021
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19774 from aarongreig:aaron/dnn/oclTestAccuracyThresholds
上级
a394c8b1
f59917be
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
46 addition
and
11 deletion
+46
-11
modules/dnn/test/test_halide_layers.cpp
modules/dnn/test/test_halide_layers.cpp
+20
-6
modules/dnn/test/test_layers.cpp
modules/dnn/test/test_layers.cpp
+11
-2
modules/dnn/test/test_torch_importer.cpp
modules/dnn/test/test_torch_importer.cpp
+15
-3
未找到文件。
modules/dnn/test/test_halide_layers.cpp
浏览文件 @
26ea4760
...
@@ -16,7 +16,7 @@ using namespace cv;
...
@@ -16,7 +16,7 @@ using namespace cv;
using
namespace
cv
::
dnn
;
using
namespace
cv
::
dnn
;
using
namespace
testing
;
using
namespace
testing
;
static
void
test
(
Mat
&
input
,
Net
&
net
,
Backend
backendId
,
Target
targetId
,
bool
skipCheck
=
false
,
bool
randInput
=
true
)
static
void
test
(
Mat
&
input
,
Net
&
net
,
Backend
backendId
,
Target
targetId
,
bool
skipCheck
=
false
,
bool
randInput
=
true
,
double
l1
=
0.0
,
double
lInf
=
0.0
)
{
{
DNNTestLayer
::
checkBackend
(
backendId
,
targetId
);
DNNTestLayer
::
checkBackend
(
backendId
,
targetId
);
if
(
randInput
)
if
(
randInput
)
...
@@ -33,8 +33,12 @@ static void test(Mat& input, Net& net, Backend backendId, Target targetId, bool
...
@@ -33,8 +33,12 @@ static void test(Mat& input, Net& net, Backend backendId, Target targetId, bool
if
(
skipCheck
)
if
(
skipCheck
)
return
;
return
;
double
l1
,
lInf
;
double
default_l1
,
default_lInf
;
DNNTestLayer
::
getDefaultThresholds
(
backendId
,
targetId
,
&
l1
,
&
lInf
);
DNNTestLayer
::
getDefaultThresholds
(
backendId
,
targetId
,
&
default_l1
,
&
default_lInf
);
if
(
l1
==
0.0
)
l1
=
default_l1
;
if
(
lInf
==
0.0
)
lInf
=
default_lInf
;
#if 0
#if 0
std::cout << "l1=" << l1 << " lInf=" << lInf << std::endl;
std::cout << "l1=" << l1 << " lInf=" << lInf << std::endl;
std::cout << outputDefault.reshape(1, outputDefault.total()).t() << std::endl;
std::cout << outputDefault.reshape(1, outputDefault.total()).t() << std::endl;
...
@@ -43,11 +47,11 @@ static void test(Mat& input, Net& net, Backend backendId, Target targetId, bool
...
@@ -43,11 +47,11 @@ static void test(Mat& input, Net& net, Backend backendId, Target targetId, bool
normAssert
(
outputDefault
,
outputHalide
,
""
,
l1
,
lInf
);
normAssert
(
outputDefault
,
outputHalide
,
""
,
l1
,
lInf
);
}
}
static
void
test
(
LayerParams
&
params
,
Mat
&
input
,
Backend
backendId
,
Target
targetId
,
bool
skipCheck
=
false
)
static
void
test
(
LayerParams
&
params
,
Mat
&
input
,
Backend
backendId
,
Target
targetId
,
bool
skipCheck
=
false
,
double
l1
=
0.0
,
double
lInf
=
0.0
)
{
{
Net
net
;
Net
net
;
net
.
addLayerToPrev
(
params
.
name
,
params
.
type
,
params
);
net
.
addLayerToPrev
(
params
.
name
,
params
.
type
,
params
);
test
(
input
,
net
,
backendId
,
targetId
,
skipCheck
);
test
(
input
,
net
,
backendId
,
targetId
,
skipCheck
,
true
,
l1
,
lInf
);
}
}
static
inline
testing
::
internal
::
ParamGenerator
<
tuple
<
Backend
,
Target
>
>
dnnBackendsAndTargetsWithHalide
()
static
inline
testing
::
internal
::
ParamGenerator
<
tuple
<
Backend
,
Target
>
>
dnnBackendsAndTargetsWithHalide
()
...
@@ -251,7 +255,17 @@ TEST_P(LRN, Accuracy)
...
@@ -251,7 +255,17 @@ TEST_P(LRN, Accuracy)
int
sz
[]
=
{
1
,
inChannels
,
inSize
.
height
,
inSize
.
width
};
int
sz
[]
=
{
1
,
inChannels
,
inSize
.
height
,
inSize
.
width
};
Mat
input
(
4
,
&
sz
[
0
],
CV_32F
);
Mat
input
(
4
,
&
sz
[
0
],
CV_32F
);
test
(
lp
,
input
,
backendId
,
targetId
);
double
l1
=
0.0
,
lInf
=
0.0
;
// The OpenCL kernels use the native_ math functions which have
// implementation defined accuracy, so we use relaxed thresholds. See
// https://github.com/opencv/opencv/issues/9821 for more details.
if
(
targetId
==
DNN_TARGET_OPENCL
)
{
l1
=
0.01
;
lInf
=
0.01
;
}
test
(
lp
,
input
,
backendId
,
targetId
,
false
,
l1
,
lInf
);
}
}
INSTANTIATE_TEST_CASE_P
(
Layer_Test_Halide
,
LRN
,
Combine
(
INSTANTIATE_TEST_CASE_P
(
Layer_Test_Halide
,
LRN
,
Combine
(
...
...
modules/dnn/test/test_layers.cpp
浏览文件 @
26ea4760
...
@@ -169,8 +169,17 @@ TEST_P(Test_Caffe_layers, Softmax)
...
@@ -169,8 +169,17 @@ TEST_P(Test_Caffe_layers, Softmax)
TEST_P
(
Test_Caffe_layers
,
LRN
)
TEST_P
(
Test_Caffe_layers
,
LRN
)
{
{
testLayerUsingCaffeModels
(
"layer_lrn_spatial"
);
double
l1
=
0.0
,
lInf
=
0.0
;
testLayerUsingCaffeModels
(
"layer_lrn_channels"
);
// The OpenCL kernels use the native_ math functions which have
// implementation defined accuracy, so we use relaxed thresholds. See
// https://github.com/opencv/opencv/issues/9821 for more details.
if
(
target
==
DNN_TARGET_OPENCL
)
{
l1
=
0.01
;
lInf
=
0.01
;
}
testLayerUsingCaffeModels
(
"layer_lrn_spatial"
,
false
,
true
,
l1
,
lInf
);
testLayerUsingCaffeModels
(
"layer_lrn_channels"
,
false
,
true
,
l1
,
lInf
);
}
}
TEST_P
(
Test_Caffe_layers
,
Convolution
)
TEST_P
(
Test_Caffe_layers
,
Convolution
)
...
...
modules/dnn/test/test_torch_importer.cpp
浏览文件 @
26ea4760
...
@@ -218,9 +218,21 @@ TEST_P(Test_Torch_layers, net_conv_gemm_lrn)
...
@@ -218,9 +218,21 @@ TEST_P(Test_Torch_layers, net_conv_gemm_lrn)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
&&
target
==
DNN_TARGET_MYRIAD
)
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
&&
target
==
DNN_TARGET_MYRIAD
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH
);
runTorchNet
(
"net_conv_gemm_lrn"
,
""
,
false
,
true
,
true
,
double
l1
=
0.0
,
lInf
=
0.0
;
target
==
DNN_TARGET_OPENCL_FP16
?
0.046
:
0.0
,
if
(
target
==
DNN_TARGET_OPENCL_FP16
)
target
==
DNN_TARGET_OPENCL_FP16
?
0.023
:
0.0
);
{
l1
=
0.046
;
lInf
=
0.023
;
}
// The OpenCL kernels use the native_ math functions which have
// implementation defined accuracy, so we use relaxed thresholds. See
// https://github.com/opencv/opencv/issues/9821 for more details.
else
if
(
target
==
DNN_TARGET_OPENCL
)
{
l1
=
0.02
;
lInf
=
0.02
;
}
runTorchNet
(
"net_conv_gemm_lrn"
,
""
,
false
,
true
,
true
,
l1
,
lInf
);
}
}
TEST_P
(
Test_Torch_layers
,
net_inception_block
)
TEST_P
(
Test_Torch_layers
,
net_inception_block
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录