此类表示用于文本识别网络的的 API。 更多...
#include <opencv2/dnn/dnn.hpp>
|
| | TextRecognitionModel () |
| |
| | TextRecognitionModel (const Net &network) |
| | 从深度学习网络创建文本识别模型。调用构造函数后的 setDecodeType() 和 setVocabulary() 来初始化解码方法。
|
| |
| | TextRecognitionModel (CV_WRAP_FILE_PATH const std::string &model, CV_WRAP_FILE_PATH const std::string &config="") |
| | 从支持格式的网络创建文本识别模型。调用构造函数后的 setDecodeType() 和 setVocabulary() 来初始化解码方法。
|
| |
| const std::string & | getDecodeType () const |
| | 获取解码方法。
|
| |
| const std::vector< std::string > & | getVocabulary () const |
| | 获取识别的词汇表。
|
| |
| std::string | recognize (InputArray frame) const |
| | 给定 `input` 帧,创建输入 blob,运行网络并返回识别结果。
|
| |
| void | recognize (InputArray frame, InputArrayOfArrays roiRects, std::vector< std::string > &results) const |
| | 给定 `input` 帧,创建输入 blob,运行网络并返回识别结果。
|
| |
| TextRecognitionModel & | setDecodeOptsCTCPrefixBeamSearch (int beamSize, int vocPruneSize=0) |
| | 为 `"CTC-prefix-beam-search"` 解码使用设置解码方法选项。
|
| |
| TextRecognitionModel & | setDecodeType (const std::string &decodeType) |
| | 设置将网络输出转换为字符串的解码方法。
|
| |
| TextRecognitionModel & | setVocabulary (const std::vector< std::string > &vocabulary) |
| | 设置识别的词汇表。
|
| |
| | 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) |
| | 为帧设置 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) |
| |
此类代表文本识别网络的 Odoo API。
TextRecognitionModel 允许设置输入图像预处理的参数。 TextRecognitionModel 从训练权重和配置文件的文件中创建网络,设置输入预处理,运行前向传播并返回识别结果。对于 TextRecognitionModel,支持 CRNN-CTC。
- 示例
- samples/dnn/text_detection.cpp.
◆ TextRecognitionModel() [1/3]
| cv::dnn::TextRecognitionModel::TextRecognitionModel |
( |
| ) |
|
| Python |
|---|
| cv.dnn.TextRecognitionModel( | network | ) -> | <dnn_TextRecognitionModel 对象> |
| cv.dnn.TextRecognitionModel( | model[, config] | ) -> | <dnn_TextRecognitionModel 对象> |
◆ TextRecognitionModel() [2/3]
| cv::dnn::TextRecognitionModel::TextRecognitionModel |
( |
const Net & | network | ) |
|
| Python |
|---|
| cv.dnn.TextRecognitionModel( | network | ) -> | <dnn_TextRecognitionModel 对象> |
| cv.dnn.TextRecognitionModel( | model[, config] | ) -> | <dnn_TextRecognitionModel 对象> |
◆ TextRecognitionModel() [3/3]
| Python |
|---|
| cv.dnn.TextRecognitionModel( | network | ) -> | <dnn_TextRecognitionModel 对象> |
| cv.dnn.TextRecognitionModel( | model[, config] | ) -> | <dnn_TextRecognitionModel 对象> |
◆ getDecodeType()
| const std::string & cv::dnn::TextRecognitionModel::getDecodeType |
( |
| ) |
const |
| Python |
|---|
| cv.dnn.TextRecognitionModel.getDecodeType( | | ) -> | retval |
◆ getVocabulary()
| const std::vector< std::string > & cv::dnn::TextRecognitionModel::getVocabulary |
( |
| ) |
const |
| Python |
|---|
| cv.dnn.TextRecognitionModel.getVocabulary( | | ) -> | retval |
◆ recognize() [1/2]
| std::string cv::dnn::TextRecognitionModel::recognize |
( |
InputArray | frame | ) |
const |
| Python |
|---|
| cv.dnn.TextRecognitionModel.recognize( | frame | ) -> | retval |
| cv.dnn.TextRecognitionModel.recognize( | frame, roiRects | ) -> | results |
给定 `input` 帧,创建输入 blob,运行网络并返回识别结果。
- 参数
-
- 返回
- 文本识别结果
◆ recognize() [2/2]
| Python |
|---|
| cv.dnn.TextRecognitionModel.recognize( | frame | ) -> | retval |
| cv.dnn.TextRecognitionModel.recognize( | frame, roiRects | ) -> | results |
给定 `input` 帧,创建输入 blob,运行网络并返回识别结果。
- 参数
-
| [in] | frame | 输入图像 |
| [in] | roiRects | 感兴趣的文本检测区域列表(cv::Rect, CV_32SC4)。ROI 将被裁剪作为网络输入 |
| [out] | results | 一组文本识别结果。 |
◆ setDecodeOptsCTCPrefixBeamSearch()
| TextRecognitionModel & cv::dnn::TextRecognitionModel::setDecodeOptsCTCPrefixBeamSearch |
( |
int | beamSize, |
|
|
int | vocPruneSize=0 ) |
| Python |
|---|
| cv.dnn.TextRecognitionModel.setDecodeOptsCTCPrefixBeamSearch( | beamSize[, vocPruneSize] | ) -> | retval |
为 `"CTC-prefix-beam-search"` 解码使用设置解码方法选项。
- 参数
-
| [in] | beamSize | 搜索的 Beam 大小 |
| [in] | vocPruneSize | 用于优化大型词汇表搜索的参数,每个搜索步骤只取前 `vocPruneSize` 个 token,`vocPruneSize` <= 0 表示禁用此剪枝。 |
◆ setDecodeType()
| TextRecognitionModel & cv::dnn::TextRecognitionModel::setDecodeType |
( |
const std::string & | decodeType | ) |
|
| Python |
|---|
| cv.dnn.TextRecognitionModel.setDecodeType( | decodeType | ) -> | retval |
设置将网络输出转换为字符串的解码方法。
- 参数
-
| [in] | decodeType | 将网络输出转换为字符串的解码方法,当前支持的类型
"CTC-greedy" CTC-based 方法输出的贪婪解码
"CTC-prefix-beam-search" CTC-based 方法输出的前缀 Beam 搜索解码
|
◆ setVocabulary()
| TextRecognitionModel & cv::dnn::TextRecognitionModel::setVocabulary |
( |
const std::vector< std::string > & | vocabulary | ) |
|
| Python |
|---|
| cv.dnn.TextRecognitionModel.setVocabulary( | vocabulary | ) -> | retval |
该类的文档由以下文件生成: