|
|
|
@ -4626,16 +4626,15 @@ void LayerFactory::registerLayer(const String &type, Constructor constructor) |
|
|
|
|
CV_TRACE_ARG_VALUE(type, "type", type.c_str()); |
|
|
|
|
|
|
|
|
|
cv::AutoLock lock(getLayerFactoryMutex()); |
|
|
|
|
String type_ = type.toLowerCase(); |
|
|
|
|
LayerFactory_Impl::iterator it = getLayerFactoryImpl().find(type_); |
|
|
|
|
LayerFactory_Impl::iterator it = getLayerFactoryImpl().find(type); |
|
|
|
|
|
|
|
|
|
if (it != getLayerFactoryImpl().end()) |
|
|
|
|
{ |
|
|
|
|
if (it->second.back() == constructor) |
|
|
|
|
CV_Error(cv::Error::StsBadArg, "Layer \"" + type_ + "\" already was registered"); |
|
|
|
|
CV_Error(cv::Error::StsBadArg, "Layer \"" + type + "\" already was registered"); |
|
|
|
|
it->second.push_back(constructor); |
|
|
|
|
} |
|
|
|
|
getLayerFactoryImpl().insert(std::make_pair(type_, std::vector<Constructor>(1, constructor))); |
|
|
|
|
getLayerFactoryImpl().insert(std::make_pair(type, std::vector<Constructor>(1, constructor))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void LayerFactory::unregisterLayer(const String &type) |
|
|
|
@ -4644,9 +4643,8 @@ void LayerFactory::unregisterLayer(const String &type) |
|
|
|
|
CV_TRACE_ARG_VALUE(type, "type", type.c_str()); |
|
|
|
|
|
|
|
|
|
cv::AutoLock lock(getLayerFactoryMutex()); |
|
|
|
|
String type_ = type.toLowerCase(); |
|
|
|
|
|
|
|
|
|
LayerFactory_Impl::iterator it = getLayerFactoryImpl().find(type_); |
|
|
|
|
LayerFactory_Impl::iterator it = getLayerFactoryImpl().find(type); |
|
|
|
|
if (it != getLayerFactoryImpl().end()) |
|
|
|
|
{ |
|
|
|
|
if (it->second.size() > 1) |
|
|
|
@ -4662,8 +4660,7 @@ Ptr<Layer> LayerFactory::createLayerInstance(const String &type, LayerParams& pa |
|
|
|
|
CV_TRACE_ARG_VALUE(type, "type", type.c_str()); |
|
|
|
|
|
|
|
|
|
cv::AutoLock lock(getLayerFactoryMutex()); |
|
|
|
|
String type_ = type.toLowerCase(); |
|
|
|
|
LayerFactory_Impl::const_iterator it = getLayerFactoryImpl().find(type_); |
|
|
|
|
LayerFactory_Impl::const_iterator it = getLayerFactoryImpl().find(type); |
|
|
|
|
|
|
|
|
|
if (it != getLayerFactoryImpl().end()) |
|
|
|
|
{ |
|
|
|
|