Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
083727b0
O
Opencv
项目概览
Greenplum
/
Opencv
10 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
083727b0
编写于
10月 09, 2020
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18551 from alalek:issue_17964
上级
6c218c7b
718dd9f1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
18 deletion
+18
-18
modules/dnn/src/dnn.cpp
modules/dnn/src/dnn.cpp
+3
-1
modules/dnn/src/layers/convolution_layer.cpp
modules/dnn/src/layers/convolution_layer.cpp
+10
-0
modules/dnn/test/test_common.impl.hpp
modules/dnn/test/test_common.impl.hpp
+2
-2
modules/dnn/test/test_layers.cpp
modules/dnn/test/test_layers.cpp
+3
-15
未找到文件。
modules/dnn/src/dnn.cpp
浏览文件 @
083727b0
...
...
@@ -2460,10 +2460,12 @@ struct Net::Impl : public detail::NetImplBase
if
(
nextData
)
nextActivLayer
=
nextData
->
layerInstance
.
dynamicCast
<
ActivationLayer
>
();
Ptr
<
PowerLayer
>
activ_power
;
if
(
!
nextActivLayer
.
empty
()
&&
(
!
nextData
->
type
.
compare
(
"ReLU"
)
||
!
nextData
->
type
.
compare
(
"ChannelsPReLU"
)
||
!
nextData
->
type
.
compare
(
"Power"
))
&&
(
!
nextData
->
type
.
compare
(
"Power"
)
&&
(
activ_power
=
nextActivLayer
.
dynamicCast
<
PowerLayer
>
())
&&
activ_power
->
scale
==
1.0
f
)
)
&&
currLayer
->
setActivation
(
nextActivLayer
)
)
{
CV_Assert_N
(
biasLayerData
->
outputBlobsWrappers
.
size
()
==
1
,
ld
.
inputBlobsWrappers
.
size
()
==
1
);
...
...
modules/dnn/src/layers/convolution_layer.cpp
浏览文件 @
083727b0
...
...
@@ -46,6 +46,8 @@
#include "../op_inf_engine.hpp"
#include "../ie_ngraph.hpp"
#include <opencv2/core/utils/logger.hpp>
#include "opencv2/core/hal/hal.hpp"
#include "opencv2/core/hal/intrin.hpp"
#include <iostream>
...
...
@@ -371,6 +373,14 @@ public:
Ptr
<
PowerLayer
>
activ_power
=
activ
.
dynamicCast
<
PowerLayer
>
();
if
(
!
activ_power
.
empty
())
{
if
(
activ_power
->
scale
!=
1.0
f
)
// not supported well by implementation, #17964
{
// FIXIT no way to check number of blobs (like, eltwise input)
CV_LOG_INFO
(
NULL
,
"DNN/OpenCL: can't configure Power activation (scale != 1.0f)"
);
activ
.
release
();
newActiv
=
false
;
return
false
;
}
if
(
activ_power
->
scale
!=
1.
f
||
activ_power
->
shift
!=
0.
f
)
{
const
int
outCh
=
blobs
[
0
].
size
[
0
];
...
...
modules/dnn/test/test_common.impl.hpp
浏览文件 @
083727b0
...
...
@@ -63,10 +63,10 @@ void normAssert(
double
l1
/*= 0.00001*/
,
double
lInf
/*= 0.0001*/
)
{
double
normL1
=
cvtest
::
norm
(
ref
,
test
,
cv
::
NORM_L1
)
/
ref
.
getMat
().
total
();
EXPECT_LE
(
normL1
,
l1
)
<<
comment
;
EXPECT_LE
(
normL1
,
l1
)
<<
comment
<<
" |ref| = "
<<
cvtest
::
norm
(
ref
,
cv
::
NORM_INF
)
;
double
normInf
=
cvtest
::
norm
(
ref
,
test
,
cv
::
NORM_INF
);
EXPECT_LE
(
normInf
,
lInf
)
<<
comment
;
EXPECT_LE
(
normInf
,
lInf
)
<<
comment
<<
" |ref| = "
<<
cvtest
::
norm
(
ref
,
cv
::
NORM_INF
)
;
}
std
::
vector
<
cv
::
Rect2d
>
matToBoxes
(
const
cv
::
Mat
&
m
)
...
...
modules/dnn/test/test_layers.cpp
浏览文件 @
083727b0
...
...
@@ -2219,10 +2219,6 @@ TEST_P(ConvolutionActivationFusion, Accuracy)
Backend
backendId
=
get
<
0
>
(
get
<
2
>
(
GetParam
()));
Target
targetId
=
get
<
1
>
(
get
<
2
>
(
GetParam
()));
// bug: https://github.com/opencv/opencv/issues/17964
if
(
actType
==
"Power"
&&
backendId
==
DNN_BACKEND_OPENCV
&&
(
targetId
==
DNN_TARGET_OPENCL
||
targetId
==
DNN_TARGET_OPENCL_FP16
))
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_OPENCL
);
Net
net
;
int
convId
=
net
.
addLayer
(
convParams
.
name
,
convParams
.
type
,
convParams
);
int
activId
=
net
.
addLayerToPrev
(
activationParams
.
name
,
activationParams
.
type
,
activationParams
);
...
...
@@ -2235,7 +2231,7 @@ TEST_P(ConvolutionActivationFusion, Accuracy)
expectedFusedLayers
.
push_back
(
activId
);
// all activations are fused
else
if
(
targetId
==
DNN_TARGET_OPENCL
||
targetId
==
DNN_TARGET_OPENCL_FP16
)
{
if
(
actType
==
"ReLU"
||
actType
==
"ChannelsPReLU"
||
actType
==
"ReLU6"
||
actType
==
"TanH"
||
actType
==
"Power"
)
if
(
actType
==
"ReLU"
||
actType
==
"ChannelsPReLU"
||
actType
==
"ReLU6"
||
actType
==
"TanH"
/*|| actType == "Power"*/
)
expectedFusedLayers
.
push_back
(
activId
);
}
}
...
...
@@ -2349,10 +2345,6 @@ TEST_P(ConvolutionEltwiseActivationFusion, Accuracy)
if
((
eltwiseOp
!=
"sum"
||
weightedEltwise
)
&&
backendId
==
DNN_BACKEND_OPENCV
&&
(
targetId
==
DNN_TARGET_OPENCL
||
targetId
==
DNN_TARGET_OPENCL_FP16
))
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_OPENCL
);
// bug: https://github.com/opencv/opencv/issues/17964
if
(
actType
==
"Power"
&&
backendId
==
DNN_BACKEND_OPENCV
&&
(
targetId
==
DNN_TARGET_OPENCL
||
targetId
==
DNN_TARGET_OPENCL_FP16
))
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_OPENCL
);
Net
net
;
int
convId
=
net
.
addLayer
(
convParams
.
name
,
convParams
.
type
,
convParams
);
int
eltwiseId
=
net
.
addLayer
(
eltwiseParams
.
name
,
eltwiseParams
.
type
,
eltwiseParams
);
...
...
@@ -2369,7 +2361,7 @@ TEST_P(ConvolutionEltwiseActivationFusion, Accuracy)
expectedFusedLayers
.
push_back
(
activId
);
// activation is fused with eltwise layer
else
if
(
targetId
==
DNN_TARGET_OPENCL
||
targetId
==
DNN_TARGET_OPENCL_FP16
)
{
if
(
actType
==
"ReLU"
||
actType
==
"ChannelsPReLU"
||
actType
==
"Power"
)
if
(
actType
==
"ReLU"
||
actType
==
"ChannelsPReLU"
/*|| actType == "Power"*/
)
{
expectedFusedLayers
.
push_back
(
eltwiseId
);
expectedFusedLayers
.
push_back
(
activId
);
...
...
@@ -2431,10 +2423,6 @@ TEST_P(ConvolutionActivationEltwiseFusion, Accuracy)
Backend
backendId
=
get
<
0
>
(
get
<
4
>
(
GetParam
()));
Target
targetId
=
get
<
1
>
(
get
<
4
>
(
GetParam
()));
// bug: https://github.com/opencv/opencv/issues/17964
if
(
actType
==
"Power"
&&
backendId
==
DNN_BACKEND_OPENCV
&&
(
targetId
==
DNN_TARGET_OPENCL
||
targetId
==
DNN_TARGET_OPENCL_FP16
))
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_OPENCL
);
Net
net
;
int
convId
=
net
.
addLayer
(
convParams
.
name
,
convParams
.
type
,
convParams
);
int
activId
=
net
.
addLayer
(
activationParams
.
name
,
activationParams
.
type
,
activationParams
);
...
...
@@ -2451,7 +2439,7 @@ TEST_P(ConvolutionActivationEltwiseFusion, Accuracy)
expectedFusedLayers
.
push_back
(
activId
);
// activation fused with convolution
else
if
(
targetId
==
DNN_TARGET_OPENCL
||
targetId
==
DNN_TARGET_OPENCL_FP16
)
{
if
(
actType
==
"ReLU"
||
actType
==
"ChannelsPReLU"
||
actType
==
"ReLU6"
||
actType
==
"TanH"
||
actType
==
"Power"
)
if
(
actType
==
"ReLU"
||
actType
==
"ChannelsPReLU"
||
actType
==
"ReLU6"
||
actType
==
"TanH"
/*|| actType == "Power"*/
)
expectedFusedLayers
.
push_back
(
activId
);
// activation fused with convolution
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录