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
6bf8fe81
Commit
6bf8fe81
authored
Sep 15, 2017
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9384 from dkurt:torch_split
parents
a391871c
0ce7c33b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
19 deletions
+9
-19
split_layer.cpp
modules/dnn/src/layers/split_layer.cpp
+2
-3
torch_importer.cpp
modules/dnn/src/torch/torch_importer.cpp
+7
-16
No files found.
modules/dnn/src/layers/split_layer.cpp
View file @
6bf8fe81
...
...
@@ -75,7 +75,7 @@ public:
Layer
::
getMemoryShapes
(
inputs
,
max
(
1
,
outputsCount
>=
0
?
outputsCount
:
requiredOutputs
),
outputs
,
internals
);
return
tru
e
;
return
fals
e
;
}
void
forward
(
std
::
vector
<
Mat
*>
&
inputs
,
std
::
vector
<
Mat
>
&
outputs
,
std
::
vector
<
Mat
>
&
internals
)
...
...
@@ -86,8 +86,7 @@ public:
for
(
size_t
i
=
0
;
i
<
outputs
.
size
();
i
++
)
{
CV_Assert
(
inputs
[
0
]
->
total
()
==
outputs
[
i
].
total
());
if
(
outputs
[
i
].
data
!=
inputs
[
0
]
->
data
)
inputs
[
0
]
->
copyTo
(
outputs
[
i
]);
inputs
[
0
]
->
copyTo
(
outputs
[
i
]);
}
}
};
...
...
modules/dnn/src/torch/torch_importer.cpp
View file @
6bf8fe81
...
...
@@ -934,20 +934,18 @@ struct TorchImporter : public ::cv::dnn::Importer
}
else
if
(
module
->
thName
==
"Concat"
)
{
int
newId
,
splitId
,
mergeId
;
LayerParams
mergeParams
,
splitParams
;
int
newId
,
mergeId
;
LayerParams
mergeParams
;
mergeParams
.
set
(
"axis"
,
module
->
params
.
get
<
int
>
(
"dimension"
)
-
1
);
splitId
=
net
.
addLayer
(
generateLayerName
(
"torchSplit"
),
"Split"
,
splitParams
);
net
.
connect
(
prevLayerId
,
prevOutNum
,
splitId
,
0
);
std
::
vector
<
int
>
branchIds
;
for
(
int
i
=
0
;
i
<
(
int
)
module
->
modules
.
size
();
i
++
)
{
newId
=
fill
(
module
->
modules
[
i
],
addedModules
,
splitId
,
i
);
newId
=
fill
(
module
->
modules
[
i
],
addedModules
,
prevLayerId
,
prevOutNum
);
branchIds
.
push_back
(
newId
);
}
moduleCounter
+=
1
;
// Skip split layer creation. See https://github.com/opencv/opencv/pull/9384.
mergeId
=
net
.
addLayer
(
generateLayerName
(
"torchMerge"
),
"Concat"
,
mergeParams
);
for
(
int
i
=
0
;
i
<
branchIds
.
size
();
i
++
)
...
...
@@ -1015,19 +1013,12 @@ struct TorchImporter : public ::cv::dnn::Importer
return
mergeId
;
}
else
if
(
module
->
thName
==
"ConcatTable"
)
{
int
newId
=
-
1
,
splitId
;
LayerParams
splitParams
;
splitId
=
net
.
addLayer
(
generateLayerName
(
"torchSplit"
),
"Split"
,
splitParams
);
net
.
connect
(
prevLayerId
,
prevOutNum
,
splitId
,
0
);
addedModules
.
push_back
(
std
::
make_pair
(
splitId
,
module
));
int
newId
=
-
1
;
moduleCounter
+=
1
;
// Skip split layer creation. See https://github.com/opencv/opencv/pull/9384.
for
(
int
i
=
0
;
i
<
(
int
)
module
->
modules
.
size
();
i
++
)
{
newId
=
fill
(
module
->
modules
[
i
],
addedModules
,
splitId
,
i
);
newId
=
fill
(
module
->
modules
[
i
],
addedModules
,
prevLayerId
,
prevOutNum
);
}
return
newId
;
}
else
if
(
module
->
thName
==
"JoinTable"
)
{
...
...
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