此类代表用于目标检测网络的高级 API。 更多...
#include <opencv2/dnn/dnn.hpp>
|
| | DetectionModel () |
| |
| | DetectionModel (const Net &network) |
| | 从深度学习网络创建模型。
|
| |
| | DetectionModel (CV_WRAP_FILE_PATH const String &model, CV_WRAP_FILE_PATH const String &config="") |
| | 从以支持格式之一表示的网络创建检测模型。 model 和 config 参数的顺序无关紧要。
|
| |
| void | detect (InputArray frame, std::vector< int > &classIds, std::vector< float > &confidences, std::vector< Rect > &boxes, float confThreshold=0.5f, float nmsThreshold=0.0f) |
| | 给定 input 帧,创建输入 blob,运行网络并返回结果检测。
|
| |
| bool | getNmsAcrossClasses () |
| | getNmsAcrossClasses 的获取器。 此变量默认为 false,因此在 detect() 函数中使用非最大抑制时,它将仅针对每个类进行。
|
| |
| DetectionModel & | setNmsAcrossClasses (bool value) |
| | nmsAcrossClasses 默认为 false,因此在 detect() 函数中使用非最大抑制时,它将仅针对每个类进行。 此函数允许您切换此行为。
|
| |
| | 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) |
| | 设置帧的缩放因子值。
|
| |
| 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。
DetectionModel 允许设置用于预处理输入图像的参数。 DetectionModel 从带有训练权重和配置的文件中创建网络,设置预处理输入,运行前向传递并返回结果检测。 对于 DetectionModel,支持 SSD、Faster R-CNN、YOLO 拓扑结构。
◆ DetectionModel() [1/3]
| Python |
|---|
| cv.dnn.DetectionModel( | model[, config] | ) -> | <dnn_DetectionModel 对象> |
| cv.dnn.DetectionModel( | network | ) -> | <dnn_DetectionModel 对象> |
从以支持格式之一表示的网络创建检测模型。 model 和 config 参数的顺序无关紧要。
- 参数
-
| [in] | model | 二进制文件包含训练权重。 |
| [in] | config | 文本文件包含网络配置。 |
◆ DetectionModel() [2/3]
| cv::dnn::DetectionModel::DetectionModel |
( |
const Net & |
network | ) |
|
| Python |
|---|
| cv.dnn.DetectionModel( | model[, config] | ) -> | <dnn_DetectionModel 对象> |
| cv.dnn.DetectionModel( | network | ) -> | <dnn_DetectionModel 对象> |
◆ DetectionModel() [3/3]
| cv::dnn::DetectionModel::DetectionModel |
( |
| ) |
|
| Python |
|---|
| cv.dnn.DetectionModel( | model[, config] | ) -> | <dnn_DetectionModel 对象> |
| cv.dnn.DetectionModel( | network | ) -> | <dnn_DetectionModel 对象> |
◆ detect()
| void cv::dnn::DetectionModel::detect |
( |
InputArray |
frame, |
|
|
std::vector< int > & |
classIds, |
|
|
std::vector< float > & |
confidences, |
|
|
std::vector< Rect > & |
boxes, |
|
|
float |
confThreshold = 0.5f, |
|
|
float |
nmsThreshold = 0.0f |
|
) |
| |
| Python |
|---|
| cv.dnn.DetectionModel.detect( | frame[, confThreshold[, nmsThreshold]] | ) -> | classIds, confidences, boxes |
给定 input 帧,创建输入 blob,运行网络并返回结果检测。
- 参数
-
| [in] | frame | 输入图像。 |
| [out] | classIds | 结果检测中的类索引。 |
| [out] | confidences | 一组相应的置信度。 |
| [out] | boxes | 一组边界框。 |
| [in] | confThreshold | 用于根据置信度过滤框的阈值。 |
| [in] | nmsThreshold | 在非最大抑制中使用的阈值。 |
◆ getNmsAcrossClasses()
| bool cv::dnn::DetectionModel::getNmsAcrossClasses |
( |
| ) |
|
| Python |
|---|
| cv.dnn.DetectionModel.getNmsAcrossClasses( | | ) -> | retval |
getNmsAcrossClasses 的获取器。 此变量默认为 false,因此在 detect() 函数中使用非最大抑制时,它将仅针对每个类进行。
◆ setNmsAcrossClasses()
| DetectionModel & cv::dnn::DetectionModel::setNmsAcrossClasses |
( |
bool |
value | ) |
|
| Python |
|---|
| cv.dnn.DetectionModel.setNmsAcrossClasses( | value | ) -> | retval |
nmsAcrossClasses 默认为 false,因此在 detect() 函数中使用非最大抑制时,它将仅针对每个类进行。 此函数允许您切换此行为。
- 参数
-
| [in] | value | nmsAcrossClasses 的新值 |
此类的文档是根据以下文件生成的