OpenCV453
公開メンバ関数 | 限定公開変数類 | 全メンバ一覧
cv::dnn::Model クラス

This class is presented high-level API for neural networks. [詳解]

#include <dnn.hpp>

cv::dnn::ClassificationModel, cv::dnn::DetectionModel, cv::dnn::KeypointsModel, cv::dnn::SegmentationModel, cv::dnn::TextDetectionModel, cv::dnn::TextRecognitionModelに継承されています。

公開メンバ関数

 Model (const Model &)=default
 
 Model (Model &&)=default
 
Modeloperator= (const Model &)=default
 
Modeloperator= (Model &&)=default
 
CV_WRAP 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. [詳解]
 
CV_WRAP Model (const Net &network)
 Create model from deep learning network. [詳解]
 
CV_WRAP ModelsetInputSize (const Size &size)
 Set input size for frame. [詳解]
 
CV_WRAP ModelsetInputSize (int width, int height)
 
CV_WRAP ModelsetInputMean (const Scalar &mean)
 Set mean value for frame. [詳解]
 
CV_WRAP ModelsetInputScale (double scale)
 Set scalefactor value for frame. [詳解]
 
CV_WRAP ModelsetInputCrop (bool crop)
 Set flag crop for frame. [詳解]
 
CV_WRAP ModelsetInputSwapRB (bool swapRB)
 Set flag swapRB for frame. [詳解]
 
CV_WRAP 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. [詳解]
 
CV_WRAP void predict (InputArray frame, OutputArrayOfArrays outs) const
 Given the input frame, create input blob, run net and return the output blobs. [詳解]
 
CV_WRAP ModelsetPreferableBackend (dnn::Backend backendId)
 
CV_WRAP ModelsetPreferableTarget (dnn::Target targetId)
 
CV_DEPRECATED_EXTERNAL operator Net & () const
 
NetgetNetwork_ () const
 
NetgetNetwork_ ()
 
Impl * getImpl () const
 
Impl & getImplRef () const
 

限定公開変数類

Ptr< Impl > impl
 

詳解

This class is presented high-level API for neural networks.

Model allows to set params for preprocessing input image. Model creates net from file with trained weights and config, sets preprocessing input and runs forward pass.

構築子と解体子

◆ Model() [1/2]

CV_WRAP cv::dnn::Model::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.

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

◆ Model() [2/2]

CV_WRAP cv::dnn::Model::Model ( const Net network)

Create model from deep learning network.

引数
[in]networkNet object.

関数詳解

◆ predict()

CV_WRAP void cv::dnn::Model::predict ( InputArray  frame,
OutputArrayOfArrays  outs 
) const

Given the input frame, create input blob, run net and return the output blobs.

引数
[in]frameThe input image.
[out]outsAllocated output blobs, which will store results of the computation.

◆ setInputCrop()

CV_WRAP Model & cv::dnn::Model::setInputCrop ( bool  crop)

Set flag crop for frame.

引数
[in]cropFlag which indicates whether image will be cropped after resize or not.

◆ setInputMean()

CV_WRAP Model & cv::dnn::Model::setInputMean ( const Scalar mean)

Set mean value for frame.

引数
[in]meanScalar with mean values which are subtracted from channels.

◆ setInputParams()

CV_WRAP void cv::dnn::Model::setInputParams ( double  scale = 1.0,
const Size size = Size(),
const Scalar mean = Scalar(),
bool  swapRB = false,
bool  crop = false 
)

Set preprocessing parameters for frame.

引数
[in]sizeNew input size.
[in]meanScalar with mean values which are subtracted from channels.
[in]scaleMultiplier for frame values.
[in]swapRBFlag which indicates that swap first and last channels.
[in]cropFlag which indicates whether image will be cropped after resize or not. blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )

◆ setInputScale()

CV_WRAP Model & cv::dnn::Model::setInputScale ( double  scale)

Set scalefactor value for frame.

引数
[in]scaleMultiplier for frame values.

◆ setInputSize() [1/2]

CV_WRAP Model & cv::dnn::Model::setInputSize ( const Size size)

Set input size for frame.

引数
[in]sizeNew input size.
覚え書き
If shape of the new blob less than 0, then frame size not change.

◆ setInputSize() [2/2]

CV_WRAP Model & cv::dnn::Model::setInputSize ( int  width,
int  height 
)
inline

これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。

引数
[in]widthNew input width.
[in]heightNew input height.

◆ setInputSwapRB()

CV_WRAP Model & cv::dnn::Model::setInputSwapRB ( bool  swapRB)

Set flag swapRB for frame.

引数
[in]swapRBFlag which indicates that swap first and last channels.

◆ setPreferableBackend()

CV_WRAP Model & cv::dnn::Model::setPreferableBackend ( dnn::Backend  backendId)

◆ setPreferableTarget()

CV_WRAP Model & cv::dnn::Model::setPreferableTarget ( dnn::Target  targetId)

このクラス詳解は次のファイルから抽出されました: