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
c12e26ff
Commit
c12e26ff
authored
Jul 18, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15071 from l-bat:tf_split
parents
e4e0bb53
0d2bc7b5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
3 deletions
+14
-3
all_layers.hpp
modules/dnn/include/opencv2/dnn/all_layers.hpp
+1
-0
slice_layer.cpp
modules/dnn/src/layers/slice_layer.cpp
+5
-3
tf_importer.cpp
modules/dnn/src/tensorflow/tf_importer.cpp
+3
-0
test_tf_importer.cpp
modules/dnn/test/test_tf_importer.cpp
+5
-0
No files found.
modules/dnn/include/opencv2/dnn/all_layers.hpp
View file @
c12e26ff
...
...
@@ -366,6 +366,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
*/
std
::
vector
<
std
::
vector
<
Range
>
>
sliceRanges
;
int
axis
;
int
num_split
;
static
Ptr
<
SliceLayer
>
create
(
const
LayerParams
&
params
);
};
...
...
modules/dnn/src/layers/slice_layer.cpp
View file @
c12e26ff
...
...
@@ -61,6 +61,7 @@ public:
{
setParamsFrom
(
params
);
axis
=
params
.
get
<
int
>
(
"axis"
,
1
);
num_split
=
params
.
get
<
int
>
(
"num_split"
,
0
);
if
(
params
.
has
(
"slice_point"
))
{
CV_Assert
(
!
params
.
has
(
"begin"
)
&&
!
params
.
has
(
"size"
)
&&
!
params
.
has
(
"end"
));
...
...
@@ -141,9 +142,10 @@ public:
else
// Divide input blob on equal parts by axis.
{
CV_Assert
(
0
<=
axis
&&
axis
<
inpShape
.
size
());
CV_Assert
(
requiredOutputs
>
0
&&
inpShape
[
axis
]
%
requiredOutputs
==
0
);
inpShape
[
axis
]
/=
requiredOutputs
;
outputs
.
resize
(
requiredOutputs
,
inpShape
);
int
splits
=
num_split
?
num_split
:
requiredOutputs
;
CV_Assert
(
splits
>
0
&&
inpShape
[
axis
]
%
splits
==
0
);
inpShape
[
axis
]
/=
splits
;
outputs
.
resize
(
splits
,
inpShape
);
}
return
false
;
}
...
...
modules/dnn/src/tensorflow/tf_importer.cpp
View file @
c12e26ff
...
...
@@ -1410,6 +1410,9 @@ void TFImporter::populateNet(Net dstNet)
axis
=
toNCHW
(
axis
);
layerParams
.
set
(
"axis"
,
axis
);
if
(
hasLayerAttr
(
layer
,
"num_split"
))
layerParams
.
set
(
"num_split"
,
getLayerAttr
(
layer
,
"num_split"
).
i
());
int
id
=
dstNet
.
addLayer
(
name
,
"Slice"
,
layerParams
);
layer_id
[
name
]
=
id
;
...
...
modules/dnn/test/test_tf_importer.cpp
View file @
c12e26ff
...
...
@@ -350,6 +350,11 @@ TEST_P(Test_TensorFlow_layers, l2_normalize_3d)
runTensorFlowNet
(
"l2_normalize_3d"
);
}
TEST_P
(
Test_TensorFlow_layers
,
Split
)
{
runTensorFlowNet
(
"split"
);
}
class
Test_TensorFlow_nets
:
public
DNNTestLayer
{};
TEST_P
(
Test_TensorFlow_nets
,
MobileNet_SSD
)
...
...
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