rknn-toolkit2-v2.1.0-2024-08-08
/
rknpu2
/examples
/3rdparty
/opencv
/opencv-linux-aarch64
/include
/opencv2
/dnn
/layer.details.hpp
// This file is part of OpenCV project. | |
// It is subject to the license terms in the LICENSE file found in the top-level directory | |
// of this distribution and at http://opencv.org/license.html. | |
// | |
namespace cv { | |
namespace dnn { | |
CV__DNN_EXPERIMENTAL_NS_BEGIN | |
/** @brief Registers layer constructor in runtime. | |
* @param type string, containing type name of the layer. | |
* @param constructorFunc pointer to the function of type LayerRegister::Constructor, which creates the layer. | |
* @details This macros must be placed inside the function code. | |
*/ | |
/** @brief Registers layer class in runtime. | |
* @param type string, containing type name of the layer. | |
* @param class C++ class, derived from Layer. | |
* @details This macros must be placed inside the function code. | |
*/ | |
/** @brief Registers layer constructor on module load time. | |
* @param type string, containing type name of the layer. | |
* @param constructorFunc pointer to the function of type LayerRegister::Constructor, which creates the layer. | |
* @details This macros must be placed outside the function code. | |
*/ | |
/** @brief Registers layer class on module load time. | |
* @param type string, containing type name of the layer. | |
* @param class C++ class, derived from Layer. | |
* @details This macros must be placed outside the function code. | |
*/ | |
namespace details { | |
template<typename LayerClass> | |
Ptr<Layer> _layerDynamicRegisterer(LayerParams ¶ms) | |
{ | |
return Ptr<Layer>(LayerClass::create(params)); | |
} | |
//allows automatically register created layer on module load time | |
class _LayerStaticRegisterer | |
{ | |
String type; | |
public: | |
_LayerStaticRegisterer(const String &layerType, LayerFactory::Constructor layerConstructor) | |
{ | |
this->type = layerType; | |
LayerFactory::registerLayer(layerType, layerConstructor); | |
} | |
~_LayerStaticRegisterer() | |
{ | |
LayerFactory::unregisterLayer(type); | |
} | |
}; | |
} // namespace | |
CV__DNN_EXPERIMENTAL_NS_END | |
}} // namespace | |