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
9cfd219d
Commit
9cfd219d
authored
Mar 27, 2019
by
Dmitry Kurtaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Mobilenet v2 from TensorFlow slim
parent
9340fc0c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
tf_graph_simplifier.cpp
modules/dnn/src/tensorflow/tf_graph_simplifier.cpp
+16
-0
tf_importer.cpp
modules/dnn/src/tensorflow/tf_importer.cpp
+3
-0
test_tf_importer.cpp
modules/dnn/test/test_tf_importer.cpp
+1
-0
No files found.
modules/dnn/src/tensorflow/tf_graph_simplifier.cpp
View file @
9cfd219d
...
...
@@ -630,6 +630,21 @@ public:
}
};
class
SoftMaxSlimSubgraph
:
public
Subgraph
{
public
:
SoftMaxSlimSubgraph
()
{
int
input
=
addNodeToMatch
(
""
);
int
shape
=
addNodeToMatch
(
"Const"
);
int
shapeOp
=
addNodeToMatch
(
"Shape"
,
input
);
int
reshape
=
addNodeToMatch
(
"Reshape"
,
input
,
shape
);
int
softmax
=
addNodeToMatch
(
"Softmax"
,
reshape
);
addNodeToMatch
(
"Reshape"
,
softmax
,
shapeOp
);
setFusedNode
(
"Softmax"
,
input
);
}
};
void
simplifySubgraphs
(
tensorflow
::
GraphDef
&
net
)
{
std
::
vector
<
Ptr
<
Subgraph
>
>
subgraphs
;
...
...
@@ -646,6 +661,7 @@ void simplifySubgraphs(tensorflow::GraphDef& net)
subgraphs
.
push_back
(
Ptr
<
Subgraph
>
(
new
ResizeBilinearSubgraph
()));
subgraphs
.
push_back
(
Ptr
<
Subgraph
>
(
new
UpsamplingKerasSubgraph
()));
subgraphs
.
push_back
(
Ptr
<
Subgraph
>
(
new
ReshapeAsShapeSubgraph
()));
subgraphs
.
push_back
(
Ptr
<
Subgraph
>
(
new
SoftMaxSlimSubgraph
()));
int
numNodes
=
net
.
node_size
();
std
::
vector
<
int
>
matchedNodesIds
;
...
...
modules/dnn/src/tensorflow/tf_importer.cpp
View file @
9cfd219d
...
...
@@ -661,7 +661,10 @@ void TFImporter::populateNet(Net dstNet)
RemoveIdentityOps
(
netTxt
);
if
(
!
netTxt
.
ByteSize
())
{
simplifySubgraphs
(
netBin
);
sortByExecutionOrder
(
netBin
);
}
std
::
set
<
String
>
layers_to_ignore
;
...
...
modules/dnn/test/test_tf_importer.cpp
View file @
9cfd219d
...
...
@@ -549,6 +549,7 @@ TEST_P(Test_TensorFlow_layers, slice)
TEST_P
(
Test_TensorFlow_layers
,
softmax
)
{
runTensorFlowNet
(
"keras_softmax"
);
runTensorFlowNet
(
"slim_softmax"
);
}
TEST_P
(
Test_TensorFlow_layers
,
relu6
)
...
...
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