此类表示分类模型的高级 API。 更多...
#include <opencv2/dnn/dnn.hpp>
|
| | ClassificationModel (分类模型) () |
| |
| | ClassificationModel (const Net &network) |
| | 从深度学习网络创建模型。
|
| |
| | ClassificationModel (CV_WRAP_FILE_PATH const String &model, CV_WRAP_FILE_PATH const String &config="") |
| | 从以支持的格式之一表示的网络创建分类模型。 model 和 config 参数的顺序无关紧要。
|
| |
| std::pair< int, float > | classify (InputArray frame) |
| | 给定 input 帧,创建输入 blob,运行网络并返回 top-1 预测。
|
| |
| void | classify (InputArray frame, int &classId, float &conf) |
| |
| bool | getEnableSoftmaxPostProcessing () const |
| | 获取启用/禁用 softmax 后处理选项。
|
| |
| ClassificationModel & | setEnableSoftmaxPostProcessing (bool enable) |
| | 设置启用/禁用 softmax 后处理选项。
|
| |
| | Model (模型) () |
| |
| | Model (const Model &)=default |
| |
| | Model (const Net &network) |
| | 从深度学习网络创建模型。
|
| |
| | Model (CV_WRAP_FILE_PATH const String &model, CV_WRAP_FILE_PATH const String &config="") |
| | 从以支持的格式之一表示的深度学习网络创建模型。 model 和 config 参数的顺序无关紧要。
|
| |
| | Model (Model &&)=default |
| |
| Model & | enableWinograd (bool useWinograd) |
| |
| Impl * | getImpl () const |
| |
| Impl & | getImplRef () const |
| |
| Net & | getNetwork_ () |
| |
| Net & | getNetwork_ () const |
| |
| | operator Net & () const |
| |
| Model & | operator= (const Model &)=default |
| |
| Model & | operator= (Model &&)=default |
| |
| void | predict (InputArray frame, OutputArrayOfArrays outs) const |
| | 给定 input 帧,创建输入 blob,运行网络并返回输出 blobs。
|
| |
| Model & | setInputCrop (bool crop) |
| | 设置帧的 crop 标志。
|
| |
| Model & | setInputMean (const Scalar &mean) |
| | 设置帧的均值。
|
| |
| void | setInputParams (double scale=1.0, const Size &size=Size(), const Scalar &mean=Scalar(), bool swapRB=false, bool crop=false) |
| | 设置帧的预处理参数。
|
| |
| Model & | setInputScale (const Scalar &scale) |
| | 设置帧的 scalefactor 值。
|
| |
| Model & | setInputSize (const Size &size) |
| | 设置帧的输入大小。
|
| |
| Model & | setInputSize (int width, int height) |
| |
| Model & | setInputSwapRB (bool swapRB) |
| | 设置帧的 swapRB 标志。
|
| |
| Model & | setOutputNames (const std::vector< String > &outNames) |
| | 设置帧的输出名称。
|
| |
| Model & | setPreferableBackend (dnn::Backend backendId) |
| |
| Model & | setPreferableTarget (dnn::Target targetId) |
| |
此类表示分类模型的高级 API。
ClassificationModel 允许为预处理输入图像设置参数。 ClassificationModel 从包含训练权重和配置的文件创建网络,设置预处理输入,运行前向传递并返回 top-1 预测。
◆ ClassificationModel() [1/3]
| cv::dnn::ClassificationModel::ClassificationModel |
( |
| ) |
|
| Python |
|---|
| cv.dnn.ClassificationModel( | model[, config] | ) -> | <dnn_ClassificationModel 对象> |
| cv.dnn.ClassificationModel( | 网络 | ) -> | <dnn_ClassificationModel 对象> |
◆ ClassificationModel() [2/3]
| Python |
|---|
| cv.dnn.ClassificationModel( | model[, config] | ) -> | <dnn_ClassificationModel 对象> |
| cv.dnn.ClassificationModel( | 网络 | ) -> | <dnn_ClassificationModel 对象> |
从以支持的格式之一表示的网络创建分类模型。 model 和 config 参数的顺序无关紧要。
- 参数
-
| [输入] | model | 二进制文件包含训练权重。 |
| [输入] | config | 文本文件包含网络配置。 |
◆ ClassificationModel() [3/3]
| cv::dnn::ClassificationModel::ClassificationModel |
( |
const Net & | 网络 | ) |
|
| Python |
|---|
| cv.dnn.ClassificationModel( | model[, config] | ) -> | <dnn_ClassificationModel 对象> |
| cv.dnn.ClassificationModel( | 网络 | ) -> | <dnn_ClassificationModel 对象> |
◆ classify() [1/2]
| std::pair< int, float > cv::dnn::ClassificationModel::classify |
( |
InputArray | frame | ) |
|
| Python |
|---|
| cv.dnn.ClassificationModel.classify( | frame | ) -> | classId, conf |
给定 input 帧,创建输入 blob,运行网络并返回 top-1 预测。
- 参数
-
◆ classify() [2/2]
| void cv::dnn::ClassificationModel::classify |
( |
InputArray | frame, |
|
|
int & | classId, |
|
|
float & | conf ) |
| Python |
|---|
| cv.dnn.ClassificationModel.classify( | frame | ) -> | classId, conf |
这是一个重载的成员函数,为了方便而提供。 它与上面的函数仅在于它接受的参数。
◆ getEnableSoftmaxPostProcessing()
| bool cv::dnn::ClassificationModel::getEnableSoftmaxPostProcessing |
( |
| ) |
const |
| Python |
|---|
| cv.dnn.ClassificationModel.getEnableSoftmaxPostProcessing( | | ) -> | retval |
获取启用/禁用 softmax 后处理选项。
此选项默认为 false,softmax 后处理未在 classify() 函数中应用。
◆ setEnableSoftmaxPostProcessing()
| Python |
|---|
| cv.dnn.ClassificationModel.setEnableSoftmaxPostProcessing( | 启用 | ) -> | retval |
设置启用/禁用 softmax 后处理选项。
如果此选项为 true,则在 classify() 函数中的前向推理之后应用 softmax,以将置信度范围转换为 [0.0-1.0]。 此函数允许您切换此行为。 如果模型中不包含 softmax 层,请设置为 true。
- 参数
-
此类文档由以下文件生成