Class cv::dnn::Model#
This class is presented high-level API for neural networks. View details
#include <opencv2/dnn/dnn.hpp>Collaboration diagram for cv::dnn::Model:
Detailed Description#
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.
Constructor & Destructor Documentation#
Model()#
cv::dnn::Model::Model()
Python:
cv.dnn.Model(network) -> <dnn_Model object>
Model()#
cv::dnn::Model::Model(const Model &)
Python:
cv.dnn.Model(network) -> <dnn_Model object>
Model()#
cv::dnn::Model::Model(const Net & network)
Python:
cv.dnn.Model(network) -> <dnn_Model object>
Create model from deep learning network.
Parameters
network— Net object.
Model()#
cv::dnn::Model::Model(
CV_WRAP_FILE_PATH const String & model,
CV_WRAP_FILE_PATH const String & config = “” )
Python:
cv.dnn.Model(network) -> <dnn_Model object>
Create model from deep learning network represented in one of the supported formats. An order of model and config arguments does not matter.
Parameters
model— Binary file contains trained weights.config— Text file contains network configuration.
Model()#
cv::dnn::Model::Model(Model &&)
Python:
cv.dnn.Model(network) -> <dnn_Model object>
Member Function Documentation#
enableWinograd()#
Model & cv::dnn::Model::enableWinograd(bool useWinograd)
Python:
cv.dnn.Model.enableWinograd(useWinograd) -> retval
See also
getImpl()#
Impl * cv::dnn::Model::getImpl()
getImplRef()#
Impl & cv::dnn::Model::getImplRef()
getNetwork_()#
Net & cv::dnn::Model::getNetwork_()
Here is the call graph for this function:
getNetwork_()#
Net & cv::dnn::Model::getNetwork_()
operator Net &()#
cv::dnn::Model::operator Net &()
operator=()#
operator=()#
predict()#
void cv::dnn::Model::predict(
InputArray frame,
OutputArrayOfArrays outs )
Python:
cv.dnn.Model.predict(frame[, outs]) -> outs
Given the input frame, create input blob, run net and return the output blobs.
Parameters
frame— The input image.outs— Allocated output blobs, which will store results of the computation.
setInputCrop()#
Model & cv::dnn::Model::setInputCrop(bool crop)
Python:
cv.dnn.Model.setInputCrop(crop) -> retval
Set flag crop for frame.
Parameters
crop— Flag which indicates whether image will be cropped after resize or not.
setInputMean()#
Model & cv::dnn::Model::setInputMean(const Scalar & mean)
Python:
cv.dnn.Model.setInputMean(mean) -> retval
Set mean value for frame.
Parameters
mean— Scalar with mean values which are subtracted from channels.
setInputParams()#
void cv::dnn::Model::setInputParams(
double scale = 1.0,
const Size & size = Size(),
const Scalar & mean = Scalar(),
bool swapRB = false,
bool crop = false )
Python:
cv.dnn.Model.setInputParams([, scale[, size[, mean[, swapRB[, crop]]]]])
Set preprocessing parameters for frame.
Parameters
size— New input size.mean— Scalar with mean values which are subtracted from channels.scale— Multiplier for frame values.swapRB— Flag which indicates that swap first and last channels.crop— Flag 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()#
Model & cv::dnn::Model::setInputScale(const Scalar & scale)
Python:
cv.dnn.Model.setInputScale(scale) -> retval
Set scalefactor value for frame.
Parameters
scale— Multiplier for frame values.
setInputSize()#
Model & cv::dnn::Model::setInputSize(const Size & size)
Python:
cv.dnn.Model.setInputSize(size) -> retval
cv.dnn.Model.setInputSize(width, height) -> retval
Set input size for frame.
Note
If shape of the new blob less than 0, then frame size not change.
Parameters
size— New input size.
setInputSize()#
Model & cv::dnn::Model::setInputSize(
int width,
int height )
Python:
cv.dnn.Model.setInputSize(size) -> retval
cv.dnn.Model.setInputSize(width, height) -> retval
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Parameters
width— New input width.height— New input height.
Here is the call graph for this function:
setInputSwapRB()#
Model & cv::dnn::Model::setInputSwapRB(bool swapRB)
Python:
cv.dnn.Model.setInputSwapRB(swapRB) -> retval
Set flag swapRB for frame.
Parameters
swapRB— Flag which indicates that swap first and last channels.
setOutputNames()#
Model & cv::dnn::Model::setOutputNames(const std::vector< String > & outNames)
Python:
cv.dnn.Model.setOutputNames(outNames) -> retval
Set output names for frame.
Parameters
outNames— Names for output layers.
setPreferableBackend()#
Model & cv::dnn::Model::setPreferableBackend(dnn::Backend backendId)
Python:
cv.dnn.Model.setPreferableBackend(backendId) -> retval
See also
setPreferableTarget()#
Model & cv::dnn::Model::setPreferableTarget(dnn::Target targetId)
Python:
cv.dnn.Model.setPreferableTarget(targetId) -> retval
See also
Member Data Documentation#
impl#
Source file#
The documentation for this class was generated from the following file:
opencv2/dnn/dnn.hpp