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
d381948c
Commit
d381948c
authored
May 04, 2018
by
Dmitry Kurtaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update script to generate MobileNet-SSD V2 text graph
parent
684cf433
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
tf_text_graph_ssd.py
samples/dnn/tf_text_graph_ssd.py
+7
-1
No files found.
samples/dnn/tf_text_graph_ssd.py
View file @
d381948c
...
...
@@ -13,6 +13,7 @@ import tensorflow as tf
import
argparse
from
math
import
sqrt
from
tensorflow.core.framework.node_def_pb2
import
NodeDef
from
tensorflow.tools.graph_transforms
import
TransformGraph
from
google.protobuf
import
text_format
parser
=
argparse
.
ArgumentParser
(
description
=
'Run this script to get a text graph of '
...
...
@@ -32,7 +33,7 @@ args = parser.parse_args()
# Nodes that should be kept.
keepOps
=
[
'Conv2D'
,
'BiasAdd'
,
'Add'
,
'Relu6'
,
'Placeholder'
,
'FusedBatchNorm'
,
'DepthwiseConv2dNative'
,
'ConcatV2'
,
'Mul'
,
'MaxPool'
,
'AvgPool'
]
'DepthwiseConv2dNative'
,
'ConcatV2'
,
'Mul'
,
'MaxPool'
,
'AvgPool'
,
'Identity'
]
# Nodes attributes that could be removed because they are not used during import.
unusedAttrs
=
[
'T'
,
'data_format'
,
'Tshape'
,
'N'
,
'Tidx'
,
'Tdim'
,
'use_cudnn_on_gpu'
,
...
...
@@ -46,6 +47,10 @@ with tf.gfile.FastGFile(args.input, 'rb') as f:
graph_def
=
tf
.
GraphDef
()
graph_def
.
ParseFromString
(
f
.
read
())
inpNames
=
[
'image_tensor'
]
outNames
=
[
'num_detections'
,
'detection_scores'
,
'detection_boxes'
,
'detection_classes'
]
graph_def
=
TransformGraph
(
graph_def
,
inpNames
,
outNames
,
[
'sort_by_execution_order'
])
def
getUnconnectedNodes
():
unconnected
=
[]
for
node
in
graph_def
.
node
:
...
...
@@ -98,6 +103,7 @@ def removeIdentity():
for
node
in
graph_def
.
node
:
if
node
.
op
==
'Identity'
:
identities
[
node
.
name
]
=
node
.
input
[
0
]
graph_def
.
node
.
remove
(
node
)
for
node
in
graph_def
.
node
:
for
i
in
range
(
len
(
node
.
input
)):
...
...
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