Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
2d1fc7a6
Commit
2d1fc7a6
authored
Oct 26, 2015
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #391 from rokm:dnn_fix
parents
c5a273f5
fcedee0a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
layer.hpp
modules/dnn/include/opencv2/dnn/layer.hpp
+1
-1
dnn.cpp
modules/dnn/src/dnn.cpp
+12
-8
No files found.
modules/dnn/include/opencv2/dnn/layer.hpp
View file @
2d1fc7a6
...
@@ -77,7 +77,7 @@ private:
...
@@ -77,7 +77,7 @@ private:
LayerFactory
();
LayerFactory
();
struct
Impl
;
struct
Impl
;
static
Ptr
<
Impl
>
impl
;
static
Ptr
<
Impl
>
impl
()
;
};
};
/** @brief Registers layer constructor in runtime.
/** @brief Registers layer constructor in runtime.
...
...
modules/dnn/src/dnn.cpp
View file @
2d1fc7a6
...
@@ -561,34 +561,38 @@ struct LayerFactory::Impl : public std::map<String, LayerFactory::Constuctor>
...
@@ -561,34 +561,38 @@ struct LayerFactory::Impl : public std::map<String, LayerFactory::Constuctor>
{
{
};
};
//allocates on load and cleans on exit
Ptr
<
LayerFactory
::
Impl
>
LayerFactory
::
impl
()
Ptr
<
LayerFactory
::
Impl
>
LayerFactory
::
impl
(
new
LayerFactory
::
Impl
());
{
// allocate on first use
static
Ptr
<
LayerFactory
::
Impl
>
impl_
(
new
LayerFactory
::
Impl
());
return
impl_
;
}
void
LayerFactory
::
registerLayer
(
const
String
&
_type
,
Constuctor
constructor
)
void
LayerFactory
::
registerLayer
(
const
String
&
_type
,
Constuctor
constructor
)
{
{
String
type
=
_type
.
toLowerCase
();
String
type
=
_type
.
toLowerCase
();
Impl
::
iterator
it
=
impl
->
find
(
type
);
Impl
::
iterator
it
=
impl
()
->
find
(
type
);
if
(
it
!=
impl
->
end
()
&&
it
->
second
!=
constructor
)
if
(
it
!=
impl
()
->
end
()
&&
it
->
second
!=
constructor
)
{
{
CV_Error
(
cv
::
Error
::
StsBadArg
,
"Layer
\"
"
+
type
+
"
\"
already was registered"
);
CV_Error
(
cv
::
Error
::
StsBadArg
,
"Layer
\"
"
+
type
+
"
\"
already was registered"
);
}
}
impl
->
insert
(
std
::
make_pair
(
type
,
constructor
));
impl
()
->
insert
(
std
::
make_pair
(
type
,
constructor
));
}
}
void
LayerFactory
::
unregisterLayer
(
const
String
&
_type
)
void
LayerFactory
::
unregisterLayer
(
const
String
&
_type
)
{
{
String
type
=
_type
.
toLowerCase
();
String
type
=
_type
.
toLowerCase
();
impl
->
erase
(
type
);
impl
()
->
erase
(
type
);
}
}
Ptr
<
Layer
>
LayerFactory
::
createLayerInstance
(
const
String
&
_type
,
LayerParams
&
params
)
Ptr
<
Layer
>
LayerFactory
::
createLayerInstance
(
const
String
&
_type
,
LayerParams
&
params
)
{
{
String
type
=
_type
.
toLowerCase
();
String
type
=
_type
.
toLowerCase
();
Impl
::
const_iterator
it
=
LayerFactory
::
impl
->
find
(
type
);
Impl
::
const_iterator
it
=
LayerFactory
::
impl
()
->
find
(
type
);
if
(
it
!=
impl
->
end
())
if
(
it
!=
impl
()
->
end
())
{
{
return
it
->
second
(
params
);
return
it
->
second
(
params
);
}
}
...
...
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