OpenCV  4.2.0
Open Source Computer Vision
Public Member Functions | List of all members
cv::dnn::KeypointsModel Class Reference

This class represents high-level API for keypoints models. More...

#include <opencv2/dnn/dnn.hpp>

Inheritance diagram for cv::dnn::KeypointsModel:
cv::dnn::Model cv::dnn::Net

Public Member Functions

 KeypointsModel (const String &model, const String &config="")
 Create keypoints model from network represented in one of the supported formats. An order of model and config arguments does not matter. More...
 
 KeypointsModel (const Net &network)
 Create model from deep learning network. More...
 
std::vector< Point2festimate (InputArray frame, float thresh=0.5)
 Given the input frame, create input blob, run net. More...
 
- Public Member Functions inherited from cv::dnn::Model
 Model ()
 Default constructor. More...
 
 Model (const String &model, const String &config="")
 Create model from deep learning network represented in one of the supported formats. An order of model and config arguments does not matter. More...
 
 Model (const Net &network)
 Create model from deep learning network. More...
 
void predict (InputArray frame, OutputArrayOfArrays outs)
 Given the input frame, create input blob, run net and return the output blobs. More...
 
ModelsetInputCrop (bool crop)
 Set flag crop for frame. More...
 
ModelsetInputMean (const Scalar &mean)
 Set mean value for frame. More...
 
void setInputParams (double scale=1.0, const Size &size=Size(), const Scalar &mean=Scalar(), bool swapRB=false, bool crop=false)
 Set preprocessing parameters for frame. More...
 
ModelsetInputScale (double scale)
 Set scalefactor value for frame. More...
 
ModelsetInputSize (const Size &size)
 Set input size for frame. More...
 
ModelsetInputSize (int width, int height)
 Set input size for frame. More...
 
ModelsetInputSwapRB (bool swapRB)
 Set flag swapRB for frame. More...
 
- Public Member Functions inherited from cv::dnn::Net
 Net ()
 Default constructor. More...
 
 ~Net ()
 Destructor frees the net only if there aren't references to the net anymore. More...
 
int addLayer (const String &name, const String &type, LayerParams &params)
 Adds new layer to the net. More...
 
int addLayerToPrev (const String &name, const String &type, LayerParams &params)
 Adds new layer and connects its first input to the first output of previously added layer. More...
 
void connect (String outPin, String inpPin)
 Connects output of the first layer to input of the second layer. More...
 
void connect (int outLayerId, int outNum, int inpLayerId, int inpNum)
 Connects #outNum output of the first layer to #inNum input of the second layer. More...
 
String dump ()
 Dump net to String. More...
 
void dumpToFile (const String &path)
 Dump net structure, hyperparameters, backend, target and fusion to dot file. More...
 
bool empty () const
 
void enableFusion (bool fusion)
 Enables or disables layer fusion in the network. More...
 
Mat forward (const String &outputName=String())
 Runs forward pass to compute output of layer with name outputName. More...
 
void forward (OutputArrayOfArrays outputBlobs, const String &outputName=String())
 Runs forward pass to compute output of layer with name outputName. More...
 
void forward (OutputArrayOfArrays outputBlobs, const std::vector< String > &outBlobNames)
 Runs forward pass to compute outputs of layers listed in outBlobNames. More...
 
void forward (std::vector< std::vector< Mat > > &outputBlobs, const std::vector< String > &outBlobNames)
 Runs forward pass to compute outputs of layers listed in outBlobNames. More...
 
AsyncArray forwardAsync (const String &outputName=String())
 Runs forward pass to compute output of layer with name outputName. More...
 
int64 getFLOPS (const std::vector< MatShape > &netInputShapes) const
 Computes FLOP for whole loaded model with specified input shapes. More...
 
int64 getFLOPS (const MatShape &netInputShape) const
 
int64 getFLOPS (const int layerId, const std::vector< MatShape > &netInputShapes) const
 
int64 getFLOPS (const int layerId, const MatShape &netInputShape) const
 
Ptr< LayergetLayer (LayerId layerId)
 Returns pointer to layer with specified id or name which the network use. More...
 
int getLayerId (const String &layer)
 Converts string name of the layer to the integer identifier. More...
 
std::vector< Ptr< Layer > > getLayerInputs (LayerId layerId)
 Returns pointers to input layers of specific layer. More...
 
std::vector< StringgetLayerNames () const
 
int getLayersCount (const String &layerType) const
 Returns count of layers of specified type. More...
 
void getLayerShapes (const MatShape &netInputShape, const int layerId, std::vector< MatShape > &inLayerShapes, std::vector< MatShape > &outLayerShapes) const
 Returns input and output shapes for layer with specified id in loaded model; preliminary inferencing isn't necessary. More...
 
void getLayerShapes (const std::vector< MatShape > &netInputShapes, const int layerId, std::vector< MatShape > &inLayerShapes, std::vector< MatShape > &outLayerShapes) const
 
void getLayersShapes (const std::vector< MatShape > &netInputShapes, std::vector< int > &layersIds, std::vector< std::vector< MatShape > > &inLayersShapes, std::vector< std::vector< MatShape > > &outLayersShapes) const
 Returns input and output shapes for all layers in loaded model; preliminary inferencing isn't necessary. More...
 
void getLayersShapes (const MatShape &netInputShape, std::vector< int > &layersIds, std::vector< std::vector< MatShape > > &inLayersShapes, std::vector< std::vector< MatShape > > &outLayersShapes) const
 
void getLayerTypes (std::vector< String > &layersTypes) const
 Returns list of types for layer used in model. More...
 
void getMemoryConsumption (const std::vector< MatShape > &netInputShapes, size_t &weights, size_t &blobs) const
 Computes bytes number which are required to store all weights and intermediate blobs for model. More...
 
void getMemoryConsumption (const MatShape &netInputShape, size_t &weights, size_t &blobs) const
 
void getMemoryConsumption (const int layerId, const std::vector< MatShape > &netInputShapes, size_t &weights, size_t &blobs) const
 
void getMemoryConsumption (const int layerId, const MatShape &netInputShape, size_t &weights, size_t &blobs) const
 
void getMemoryConsumption (const std::vector< MatShape > &netInputShapes, std::vector< int > &layerIds, std::vector< size_t > &weights, std::vector< size_t > &blobs) const
 Computes bytes number which are required to store all weights and intermediate blobs for each layer. More...
 
void getMemoryConsumption (const MatShape &netInputShape, std::vector< int > &layerIds, std::vector< size_t > &weights, std::vector< size_t > &blobs) const
 
Mat getParam (LayerId layer, int numParam=0)
 Returns parameter blob of the layer. More...
 
int64 getPerfProfile (std::vector< double > &timings)
 Returns overall time for inference and timings (in ticks) for layers. Indexes in returned vector correspond to layers ids. Some layers can be fused with others, in this case zero ticks count will be return for that skipped layers. More...
 
std::vector< int > getUnconnectedOutLayers () const
 Returns indexes of layers with unconnected outputs. More...
 
std::vector< StringgetUnconnectedOutLayersNames () const
 Returns names of layers with unconnected outputs. More...
 
void setHalideScheduler (const String &scheduler)
 Compile Halide layers. More...
 
void setInput (InputArray blob, const String &name="", double scalefactor=1.0, const Scalar &mean=Scalar())
 Sets the new input value for the network. More...
 
void setInputsNames (const std::vector< String > &inputBlobNames)
 Sets outputs names of the network input pseudo layer. More...
 
void setParam (LayerId layer, int numParam, const Mat &blob)
 Sets the new value for the learned param of the layer. More...
 
void setPreferableBackend (int backendId)
 Ask network to use specific computation backend where it supported. More...
 
void setPreferableTarget (int targetId)
 Ask network to make computations on specific target device. More...
 

Additional Inherited Members

- Public Types inherited from cv::dnn::Net
typedef DictValue LayerId
 Container for strings and integers. More...
 
- Static Public Member Functions inherited from cv::dnn::Net
static Net readFromModelOptimizer (const String &xml, const String &bin)
 Create a network from Intel's Model Optimizer intermediate representation (IR). More...
 
static Net readFromModelOptimizer (const std::vector< uchar > &bufferModelConfig, const std::vector< uchar > &bufferWeights)
 Create a network from Intel's Model Optimizer in-memory buffers with intermediate representation (IR). More...
 
static Net readFromModelOptimizer (const uchar *bufferModelConfigPtr, size_t bufferModelConfigSize, const uchar *bufferWeightsPtr, size_t bufferWeightsSize)
 Create a network from Intel's Model Optimizer in-memory buffers with intermediate representation (IR). More...
 
- Protected Attributes inherited from cv::dnn::Model
Ptr< Impl > impl
 

Detailed Description

This class represents high-level API for keypoints models.

KeypointsModel allows to set params for preprocessing input image. KeypointsModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and returns the x and y coordinates of each detected keypoint

Constructor & Destructor Documentation

◆ KeypointsModel() [1/2]

cv::dnn::KeypointsModel::KeypointsModel ( const String model,
const String config = "" 
)
Python:
<dnn_KeypointsModel object>=cv.dnn_KeypointsModel(model[, config])
<dnn_KeypointsModel object>=cv.dnn_KeypointsModel(network)

Create keypoints model from network represented in one of the supported formats. An order of model and config arguments does not matter.

Parameters
[in]modelBinary file contains trained weights.
[in]configText file contains network configuration.

◆ KeypointsModel() [2/2]

cv::dnn::KeypointsModel::KeypointsModel ( const Net network)
Python:
<dnn_KeypointsModel object>=cv.dnn_KeypointsModel(model[, config])
<dnn_KeypointsModel object>=cv.dnn_KeypointsModel(network)

Create model from deep learning network.

Parameters
[in]networkNet object.

Member Function Documentation

◆ estimate()

std::vector<Point2f> cv::dnn::KeypointsModel::estimate ( InputArray  frame,
float  thresh = 0.5 
)
Python:
retval=cv.dnn_KeypointsModel.estimate(frame[, thresh])

Given the input frame, create input blob, run net.

Parameters
[in]frameThe input image.
threshminimum confidence threshold to select a keypoint
Returns
a vector holding the x and y coordinates of each detected keypoint

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