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
f8a27d26
Commit
f8a27d26
authored
Oct 15, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12775 from radomsak:radomsak_dnn_fix_caffe_importer_reused_layers
parents
f185640e
70177143
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
caffe_importer.cpp
modules/dnn/src/caffe/caffe_importer.cpp
+4
-2
test_caffe_importer.cpp
modules/dnn/test/test_caffe_importer.cpp
+22
-0
No files found.
modules/dnn/src/caffe/caffe_importer.cpp
View file @
f8a27d26
...
...
@@ -278,11 +278,13 @@ public:
int
li
;
for
(
li
=
0
;
li
!=
netBinary
.
layer_size
();
li
++
)
{
if
(
netBinary
.
layer
(
li
).
name
()
==
name
)
const
caffe
::
LayerParameter
&
binLayer
=
netBinary
.
layer
(
li
);
// Break if the layer name is the same and the blobs are not cleared
if
(
binLayer
.
name
()
==
name
&&
binLayer
.
blobs_size
()
!=
0
)
break
;
}
if
(
li
==
netBinary
.
layer_size
()
||
netBinary
.
layer
(
li
).
blobs_size
()
==
0
)
if
(
li
==
netBinary
.
layer_size
())
return
;
caffe
::
LayerParameter
*
binLayer
=
netBinary
.
mutable_layer
(
li
);
...
...
modules/dnn/test/test_caffe_importer.cpp
View file @
f8a27d26
...
...
@@ -454,6 +454,28 @@ TEST(Test_Caffe, multiple_inputs)
normAssert
(
out
,
first_image
+
second_image
);
}
TEST
(
Test_Caffe
,
shared_weights
)
{
const
string
proto
=
findDataFile
(
"dnn/layers/shared_weights.prototxt"
,
false
);
const
string
model
=
findDataFile
(
"dnn/layers/shared_weights.caffemodel"
,
false
);
Net
net
=
readNetFromCaffe
(
proto
,
model
);
Mat
input_1
=
(
Mat_
<
float
>
(
2
,
2
)
<<
0.
,
2.
,
4.
,
6.
);
Mat
input_2
=
(
Mat_
<
float
>
(
2
,
2
)
<<
1.
,
3.
,
5.
,
7.
);
Mat
blob_1
=
blobFromImage
(
input_1
);
Mat
blob_2
=
blobFromImage
(
input_2
);
net
.
setInput
(
blob_1
,
"input_1"
);
net
.
setInput
(
blob_2
,
"input_2"
);
Mat
sum
=
net
.
forward
();
EXPECT_EQ
(
sum
.
at
<
float
>
(
0
,
0
),
12.
);
EXPECT_EQ
(
sum
.
at
<
float
>
(
0
,
1
),
16.
);
}
typedef
testing
::
TestWithParam
<
tuple
<
std
::
string
,
Target
>
>
opencv_face_detector
;
TEST_P
(
opencv_face_detector
,
Accuracy
)
{
...
...
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