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
d68466bb
Commit
d68466bb
authored
Mar 14, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10940 from dkurt:dnn_tf_graph_optim
parents
ab110c0a
ab20d2a3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
3 deletions
+54
-3
batch_norm_layer.cpp
modules/dnn/src/layers/batch_norm_layer.cpp
+3
-3
tf_graph_simplifier.cpp
modules/dnn/src/tensorflow/tf_graph_simplifier.cpp
+0
-0
tf_graph_simplifier.hpp
modules/dnn/src/tensorflow/tf_graph_simplifier.hpp
+30
-0
tf_importer.cpp
modules/dnn/src/tensorflow/tf_importer.cpp
+0
-0
test_tf_importer.cpp
modules/dnn/test/test_tf_importer.cpp
+21
-0
No files found.
modules/dnn/src/layers/batch_norm_layer.cpp
View file @
d68466bb
...
...
@@ -32,7 +32,7 @@ public:
BatchNormLayerImpl
(
const
LayerParams
&
params
)
{
setParamsFrom
(
params
);
CV_Assert
(
blobs
.
size
()
>=
3
);
CV_Assert
(
blobs
.
size
()
>=
2
);
hasWeights
=
params
.
get
<
bool
>
(
"has_weight"
,
false
);
hasBias
=
params
.
get
<
bool
>
(
"has_bias"
,
false
);
...
...
@@ -46,8 +46,8 @@ public:
blobs
[
0
].
type
()
==
CV_32F
&&
blobs
[
1
].
type
()
==
CV_32F
);
float
varMeanScale
=
1.
f
;
if
(
!
hasWeights
&&
!
hasBias
)
{
CV_Assert
(
blobs
[
2
].
type
()
==
CV_32F
);
if
(
!
hasWeights
&&
!
hasBias
&&
blobs
.
size
()
>
2
)
{
CV_Assert
(
blobs
.
size
()
==
3
,
blobs
[
2
].
type
()
==
CV_32F
);
varMeanScale
=
blobs
[
2
].
at
<
float
>
(
0
);
if
(
varMeanScale
!=
0
)
varMeanScale
=
1
/
varMeanScale
;
...
...
modules/dnn/src/tensorflow/tf_graph_simplifier.cpp
0 → 100644
View file @
d68466bb
This diff is collapsed.
Click to expand it.
modules/dnn/src/tensorflow/tf_graph_simplifier.hpp
0 → 100644
View file @
d68466bb
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
// Copyright (C) 2018, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
#ifndef __OPENCV_DNN_TF_SIMPLIFIER_HPP__
#define __OPENCV_DNN_TF_SIMPLIFIER_HPP__
#include "../precomp.hpp"
#ifdef HAVE_PROTOBUF
#include "tf_io.hpp"
namespace
cv
{
namespace
dnn
{
CV__DNN_EXPERIMENTAL_NS_BEGIN
void
RemoveIdentityOps
(
tensorflow
::
GraphDef
&
net
);
void
simplifySubgraphs
(
tensorflow
::
GraphDef
&
net
);
Mat
getTensorContent
(
const
tensorflow
::
TensorProto
&
tensor
);
CV__DNN_EXPERIMENTAL_NS_END
}}
// namespace dnn, namespace cv
#endif // HAVE_PROTOBUF
#endif // __OPENCV_DNN_TF_SIMPLIFIER_HPP__
modules/dnn/src/tensorflow/tf_importer.cpp
View file @
d68466bb
This diff is collapsed.
Click to expand it.
modules/dnn/test/test_tf_importer.cpp
View file @
d68466bb
...
...
@@ -150,6 +150,9 @@ TEST_P(Test_TensorFlow_layers, batch_norm)
runTensorFlowNet
(
"batch_norm_text"
,
targetId
,
true
);
runTensorFlowNet
(
"mvn_batch_norm"
,
targetId
);
runTensorFlowNet
(
"mvn_batch_norm_1x1"
,
targetId
);
runTensorFlowNet
(
"unfused_batch_norm"
,
targetId
);
runTensorFlowNet
(
"fused_batch_norm_no_gamma"
,
targetId
);
runTensorFlowNet
(
"unfused_batch_norm_no_gamma"
,
targetId
);
}
TEST_P
(
Test_TensorFlow_layers
,
pooling
)
...
...
@@ -159,6 +162,7 @@ TEST_P(Test_TensorFlow_layers, pooling)
runTensorFlowNet
(
"max_pool_odd_valid"
,
targetId
);
runTensorFlowNet
(
"ave_pool_same"
,
targetId
);
runTensorFlowNet
(
"max_pool_odd_same"
,
targetId
);
runTensorFlowNet
(
"reduce_mean"
,
targetId
);
// an average pooling over all spatial dimensions.
}
TEST_P
(
Test_TensorFlow_layers
,
deconvolution
)
...
...
@@ -185,6 +189,8 @@ TEST_P(Test_TensorFlow_layers, reshape)
runTensorFlowNet
(
"shift_reshape_no_reorder"
,
targetId
);
runTensorFlowNet
(
"reshape_reduce"
,
targetId
);
runTensorFlowNet
(
"flatten"
,
targetId
,
true
);
runTensorFlowNet
(
"unfused_flatten"
,
targetId
);
runTensorFlowNet
(
"unfused_flatten_unknown_batch"
,
targetId
);
}
INSTANTIATE_TEST_CASE_P
(
/**/
,
Test_TensorFlow_layers
,
availableDnnTargets
());
...
...
@@ -332,6 +338,21 @@ TEST(Test_TensorFlow, slice)
runTensorFlowNet
(
"slice_4d"
);
}
TEST
(
Test_TensorFlow
,
softmax
)
{
runTensorFlowNet
(
"keras_softmax"
);
}
TEST
(
Test_TensorFlow
,
relu6
)
{
runTensorFlowNet
(
"keras_relu6"
);
}
TEST
(
Test_TensorFlow
,
keras_mobilenet_head
)
{
runTensorFlowNet
(
"keras_mobilenet_head"
);
}
TEST
(
Test_TensorFlow
,
memory_read
)
{
double
l1
=
1e-5
;
...
...
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