Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
51d54ad4
Commit
51d54ad4
authored
Dec 06, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16076 from l-bat:prior_ngraph
parents
fb5db234
660a7098
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
elementwise_layers.cpp
modules/dnn/src/layers/elementwise_layers.cpp
+11
-4
prior_box_layer.cpp
modules/dnn/src/layers/prior_box_layer.cpp
+4
-2
slice_layer.cpp
modules/dnn/src/layers/slice_layer.cpp
+3
-2
No files found.
modules/dnn/src/layers/elementwise_layers.cpp
View file @
51d54ad4
...
...
@@ -579,7 +579,7 @@ struct SwishFunctor
bool
supportBackend
(
int
backendId
,
int
)
{
return
backendId
==
DNN_BACKEND_OPENCV
||
backendId
==
DNN_BACKEND_HALIDE
;
backendId
==
DNN_BACKEND_HALIDE
||
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
;
;
}
void
apply
(
const
float
*
srcptr
,
float
*
dstptr
,
int
len
,
size_t
planeSize
,
int
cn0
,
int
cn1
)
const
...
...
@@ -640,7 +640,8 @@ struct SwishFunctor
#ifdef HAVE_DNN_NGRAPH
std
::
shared_ptr
<
ngraph
::
Node
>
initNgraphAPI
(
const
std
::
shared_ptr
<
ngraph
::
Node
>&
node
)
{
CV_Error
(
Error
::
StsNotImplemented
,
""
);
auto
sigmoid
=
std
::
make_shared
<
ngraph
::
op
::
Sigmoid
>
(
node
);
return
std
::
make_shared
<
ngraph
::
op
::
v1
::
Multiply
>
(
node
,
sigmoid
);
}
#endif // HAVE_DNN_NGRAPH
...
...
@@ -659,7 +660,7 @@ struct MishFunctor
bool
supportBackend
(
int
backendId
,
int
)
{
return
backendId
==
DNN_BACKEND_OPENCV
||
backendId
==
DNN_BACKEND_HALIDE
;
backendId
==
DNN_BACKEND_HALIDE
||
backendId
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
;
}
void
apply
(
const
float
*
srcptr
,
float
*
dstptr
,
int
len
,
size_t
planeSize
,
int
cn0
,
int
cn1
)
const
...
...
@@ -720,7 +721,13 @@ struct MishFunctor
#ifdef HAVE_DNN_NGRAPH
std
::
shared_ptr
<
ngraph
::
Node
>
initNgraphAPI
(
const
std
::
shared_ptr
<
ngraph
::
Node
>&
node
)
{
CV_Error
(
Error
::
StsNotImplemented
,
""
);
float
one
=
1.0
f
;
auto
constant
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
ngraph
::
element
::
f32
,
ngraph
::
Shape
{
1
},
&
one
);
auto
exp_node
=
std
::
make_shared
<
ngraph
::
op
::
v0
::
Exp
>
(
node
);
auto
sum
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
Add
>
(
constant
,
exp_node
,
ngraph
::
op
::
AutoBroadcastType
::
NUMPY
);
auto
log_node
=
std
::
make_shared
<
ngraph
::
op
::
v0
::
Log
>
(
sum
);
auto
tanh_node
=
std
::
make_shared
<
ngraph
::
op
::
Tanh
>
(
log_node
);
return
std
::
make_shared
<
ngraph
::
op
::
v1
::
Multiply
>
(
node
,
tanh_node
);
}
#endif // HAVE_DNN_NGRAPH
...
...
modules/dnn/src/layers/prior_box_layer.cpp
View file @
51d54ad4
...
...
@@ -569,8 +569,10 @@ public:
auto
upper_bounds
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
ngraph
::
element
::
i64
,
ngraph
::
Shape
{
1
},
std
::
vector
<
int64_t
>
{
4
});
auto
strides
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
ngraph
::
element
::
i64
,
ngraph
::
Shape
{
1
},
std
::
vector
<
int64_t
>
{
1
});
auto
slice_layer
=
std
::
make_shared
<
ngraph
::
op
::
DynSlice
>
(
layer_shape
,
lower_bounds
,
upper_bounds
,
strides
);
auto
slice_image
=
std
::
make_shared
<
ngraph
::
op
::
DynSlice
>
(
image_shape
,
lower_bounds
,
upper_bounds
,
strides
);
auto
slice_layer
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
StridedSlice
>
(
layer_shape
,
lower_bounds
,
upper_bounds
,
strides
,
std
::
vector
<
int64_t
>
{},
std
::
vector
<
int64_t
>
{});
auto
slice_image
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
StridedSlice
>
(
image_shape
,
lower_bounds
,
upper_bounds
,
strides
,
std
::
vector
<
int64_t
>
{},
std
::
vector
<
int64_t
>
{});
if
(
_explicitSizes
)
{
...
...
modules/dnn/src/layers/slice_layer.cpp
View file @
51d54ad4
...
...
@@ -341,8 +341,9 @@ public:
auto
strides
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
ngraph
::
element
::
i64
,
ngraph
::
Shape
{
dims
.
size
()},
std
::
vector
<
int64_t
>
((
int64_t
)
dims
.
size
(),
1
));
auto
slice
=
std
::
make_shared
<
ngraph
::
op
::
DynSlice
>
(
ieInpNode
,
lower_bounds
,
upper_bounds
,
strides
,
ngraph
::
AxisSet
{},
ngraph
::
AxisSet
{});
auto
slice
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
StridedSlice
>
(
ieInpNode
,
lower_bounds
,
upper_bounds
,
strides
,
std
::
vector
<
int64_t
>
{},
std
::
vector
<
int64_t
>
{});
return
Ptr
<
BackendNode
>
(
new
InfEngineNgraphNode
(
slice
));
}
#endif // HAVE_DNN_NGRAPH
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment