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
693a7663
Commit
693a7663
authored
7 years ago
by
Dmitry Kurtaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import ClipByValue from Keras
parent
8f24db04
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
tf_importer.cpp
modules/dnn/src/tensorflow/tf_importer.cpp
+21
-0
test_tf_importer.cpp
modules/dnn/test/test_tf_importer.cpp
+1
-0
No files found.
modules/dnn/src/tensorflow/tf_importer.cpp
View file @
693a7663
...
@@ -1641,6 +1641,27 @@ void TFImporter::populateNet(Net dstNet)
...
@@ -1641,6 +1641,27 @@ void TFImporter::populateNet(Net dstNet)
connect
(
layer_id
,
dstNet
,
Pin
(
name
),
flattenId
,
0
);
connect
(
layer_id
,
dstNet
,
Pin
(
name
),
flattenId
,
0
);
}
}
}
}
else
if
(
type
==
"ClipByValue"
)
{
// op: "ClipByValue"
// input: "input"
// input: "mix"
// input: "max"
CV_Assert
(
layer
.
input_size
()
==
3
);
Mat
minValue
=
getTensorContent
(
getConstBlob
(
layer
,
value_id
,
1
));
Mat
maxValue
=
getTensorContent
(
getConstBlob
(
layer
,
value_id
,
2
));
CV_Assert
(
minValue
.
total
()
==
1
,
minValue
.
type
()
==
CV_32F
,
maxValue
.
total
()
==
1
,
maxValue
.
type
()
==
CV_32F
);
layerParams
.
set
(
"min_value"
,
minValue
.
at
<
float
>
(
0
));
layerParams
.
set
(
"max_value"
,
maxValue
.
at
<
float
>
(
0
));
int
id
=
dstNet
.
addLayer
(
name
,
"ReLU6"
,
layerParams
);
layer_id
[
name
]
=
id
;
connect
(
layer_id
,
dstNet
,
parsePin
(
layer
.
input
(
0
)),
id
,
0
);
}
else
if
(
type
==
"Abs"
||
type
==
"Tanh"
||
type
==
"Sigmoid"
||
else
if
(
type
==
"Abs"
||
type
==
"Tanh"
||
type
==
"Sigmoid"
||
type
==
"Relu"
||
type
==
"Elu"
||
type
==
"Relu"
||
type
==
"Elu"
||
type
==
"Identity"
||
type
==
"Relu6"
)
type
==
"Identity"
||
type
==
"Relu6"
)
...
...
This diff is collapsed.
Click to expand it.
modules/dnn/test/test_tf_importer.cpp
View file @
693a7663
...
@@ -415,6 +415,7 @@ TEST(Test_TensorFlow, softmax)
...
@@ -415,6 +415,7 @@ TEST(Test_TensorFlow, softmax)
TEST
(
Test_TensorFlow
,
relu6
)
TEST
(
Test_TensorFlow
,
relu6
)
{
{
runTensorFlowNet
(
"keras_relu6"
);
runTensorFlowNet
(
"keras_relu6"
);
runTensorFlowNet
(
"keras_relu6"
,
DNN_TARGET_CPU
,
/*hasText*/
true
);
}
}
TEST
(
Test_TensorFlow
,
keras_mobilenet_head
)
TEST
(
Test_TensorFlow
,
keras_mobilenet_head
)
...
...
This diff is collapsed.
Click to expand it.
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