This interface class allows to build new Layers - are building blocks of networks.
More...
#include "dnn.hpp"
This interface class allows to build new Layers - are building blocks of networks.
Each class, derived from Layer, must implement allocate() methods to declare own outputs and forward() to compute outputs. Also before using the new layer into networks you must register your layer by using one of LayerFactory macros.
§ Layer() [1/2]
cv::dnn::Layer::Layer |
( |
| ) |
|
§ Layer() [2/2]
§ ~Layer()
virtual cv::dnn::Layer::~Layer |
( |
| ) |
|
|
virtual |
§ allocate() [1/3]
virtual void cv::dnn::Layer::allocate |
( |
const std::vector< Blob *> & |
input, |
|
|
std::vector< Blob > & |
output |
|
) |
| |
|
pure virtual |
Allocates internal buffers and output blobs with respect to the shape of inputs.
- Parameters
-
[in] | input | vector of already allocated input blobs |
[out] | output | vector of output blobs, which must be allocated |
This method must create each produced blob according to shape of input
blobs and internal layer params. If this method is called first time then output
vector consists from empty blobs and its size determined by number of output connections. This method can be called multiple times if size of any input
blob was changed.
§ allocate() [2/3]
void cv::dnn::Layer::allocate |
( |
const std::vector< Blob > & |
inputs, |
|
|
std::vector< Blob > & |
outputs |
|
) |
| |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
§ allocate() [3/3]
std::vector<Blob> cv::dnn::Layer::allocate |
( |
const std::vector< Blob > & |
inputs | ) |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
§ forward() [1/2]
virtual void cv::dnn::Layer::forward |
( |
std::vector< Blob *> & |
input, |
|
|
std::vector< Blob > & |
output |
|
) |
| |
|
pure virtual |
Given the input
blobs, computes the output blobs
.
- Parameters
-
[in] | input | the input blobs. |
[out] | output | allocated output blobs, which will store results of the computation. |
Implemented in cv::dnn::RNNLayer, and cv::dnn::LSTMLayer.
§ forward() [2/2]
void cv::dnn::Layer::forward |
( |
const std::vector< Blob > & |
inputs, |
|
|
std::vector< Blob > & |
outputs |
|
) |
| |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
§ inputNameToIndex()
virtual int cv::dnn::Layer::inputNameToIndex |
( |
String |
inputName | ) |
|
|
virtual |
Returns index of input blob into the input array.
- Parameters
-
inputName | label of input blob |
Each layer input and output can be labeled to easily identify them using "%<layer_name%>[.output_name]" notation. This method maps label of input blob to its index into input vector.
Reimplemented in cv::dnn::LSTMLayer.
§ outputNameToIndex()
virtual int cv::dnn::Layer::outputNameToIndex |
( |
String |
outputName | ) |
|
|
virtual |
§ run()
void cv::dnn::Layer::run |
( |
const std::vector< Blob > & |
inputs, |
|
|
std::vector< Blob > & |
outputs |
|
) |
| |
Allocates layer and computes output.
§ setParamsFrom()
void cv::dnn::Layer::setParamsFrom |
( |
const LayerParams & |
params | ) |
|
§ blobs
std::vector<Blob> cv::dnn::Layer::blobs |
List of learned parameters must be stored here to allow read them by using Net::getParam().
§ name
Name of the layer instance, can be used for logging or other internal purposes.
§ type
Type name which was used for creating layer by layer factory.
The documentation for this class was generated from the following file:
- /build/master-contrib_docs-lin64/opencv_contrib/modules/dnn/include/opencv2/dnn/dnn.hpp