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
993b9af7
Commit
993b9af7
authored
Jan 11, 2020
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16270 from dkurt:dnn_sort_tf_text_graphs
parents
e180cc05
f954f083
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
tf_graph_simplifier.cpp
modules/dnn/src/tensorflow/tf_graph_simplifier.cpp
+9
-5
tf_importer.cpp
modules/dnn/src/tensorflow/tf_importer.cpp
+4
-0
No files found.
modules/dnn/src/tensorflow/tf_graph_simplifier.cpp
View file @
993b9af7
...
...
@@ -950,6 +950,7 @@ void sortByExecutionOrder(tensorflow::GraphDef& net)
for
(
int
i
=
0
;
i
<
net
.
node_size
();
++
i
)
{
const
tensorflow
::
NodeDef
&
node
=
net
.
node
(
i
);
int
numInputsInGraph
=
0
;
for
(
int
j
=
0
;
j
<
node
.
input_size
();
++
j
)
{
std
::
string
inpName
=
node
.
input
(
j
);
...
...
@@ -957,22 +958,25 @@ void sortByExecutionOrder(tensorflow::GraphDef& net)
inpName
=
inpName
.
substr
(
inpName
.
find
(
'^'
)
+
1
);
nodesMapIt
=
nodesMap
.
find
(
inpName
);
CV_Assert
(
nodesMapIt
!=
nodesMap
.
end
());
edges
[
nodesMapIt
->
second
].
push_back
(
i
);
if
(
nodesMapIt
!=
nodesMap
.
end
())
{
edges
[
nodesMapIt
->
second
].
push_back
(
i
);
numInputsInGraph
+=
1
;
}
}
if
(
n
ode
.
input_size
()
==
0
)
if
(
n
umInputsInGraph
==
0
)
nodesToAdd
.
push_back
(
i
);
else
{
if
(
node
.
op
()
==
"Merge"
||
node
.
op
()
==
"RefMerge"
)
{
int
numControlEdges
=
0
;
for
(
int
j
=
0
;
j
<
n
ode
.
input_size
()
;
++
j
)
for
(
int
j
=
0
;
j
<
n
umInputsInGraph
;
++
j
)
numControlEdges
+=
node
.
input
(
j
)[
0
]
==
'^'
;
numRefsToAdd
[
i
]
=
numControlEdges
+
1
;
}
else
numRefsToAdd
[
i
]
=
n
ode
.
input_size
()
;
numRefsToAdd
[
i
]
=
n
umInputsInGraph
;
}
}
...
...
modules/dnn/src/tensorflow/tf_importer.cpp
View file @
993b9af7
...
...
@@ -715,6 +715,10 @@ void TFImporter::populateNet(Net dstNet)
simplifySubgraphs
(
netBin
);
sortByExecutionOrder
(
netBin
);
}
else
{
sortByExecutionOrder
(
netTxt
);
}
std
::
set
<
String
>
layers_to_ignore
;
...
...
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