OpenCV  3.0.0-dev
Open Source Computer Vision
Public Member Functions | Public Attributes | List of all members
cv::dnn::Layer Struct Referenceabstract

This interface class allows to build new Layers - are building blocks of networks. More...

#include "dnn.hpp"

Public Member Functions

 Layer ()
 
 Layer (const LayerParams &params)
 Initialize only name, type and blobs fields. More...
 
virtual ~Layer ()
 
virtual void allocate (const std::vector< Blob * > &input, std::vector< Blob > &output)=0
 Allocates internal buffers and output blobs with respect to the shape of inputs. More...
 
virtual void forward (std::vector< Blob * > &input, std::vector< Blob > &output)=0
 Given the input blobs, computes the output blobs. More...
 
virtual int inputNameToIndex (String inputName)
 Returns index of input blob into the input array. More...
 
virtual int outputNameToIndex (String outputName)
 Returns index of output blob in output array. More...
 

Public Attributes

std::vector< Blobblobs
 List of learned parameters must be stored here to allow read them by using Net::getParam(). More...
 
String name
 Name of the layer instance, can be used for logging or other internal purposes. More...
 
String type
 Type name which was used for creating layer by layer factory. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

cv::dnn::Layer::Layer ( )
cv::dnn::Layer::Layer ( const LayerParams params)
explicit

Initialize only name, type and blobs fields.

virtual cv::dnn::Layer::~Layer ( )
virtual

Member Function Documentation

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]inputvector of already allocated input blobs
[out]outputvector 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.

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]inputthe input blobs.
[out]outputallocated output blobs, which will store results of the computation.
virtual int cv::dnn::Layer::inputNameToIndex ( String  inputName)
virtual

Returns index of input blob into the input array.

Parameters
inputNamelabel 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.

virtual int cv::dnn::Layer::outputNameToIndex ( String  outputName)
virtual

Returns index of output blob in output array.

See also
inputNameToIndex()

Member Data Documentation

std::vector<Blob> cv::dnn::Layer::blobs

List of learned parameters must be stored here to allow read them by using Net::getParam().

String cv::dnn::Layer::name

Name of the layer instance, can be used for logging or other internal purposes.

String cv::dnn::Layer::type

Type name which was used for creating layer by layer factory.


The documentation for this struct was generated from the following file: