16 #include "fastdeploy/fastdeploy_model.h" 17 #include "fastdeploy/vision/common/processors/transform.h" 18 #include "fastdeploy/vision/common/result.h" 19 #include "fastdeploy/vision/ocr/ppocr/utils/ocr_postprocess_op.h" 20 #include "fastdeploy/vision/ocr/ppocr/rec_preprocessor.h" 21 #include "fastdeploy/vision/ocr/ppocr/rec_postprocessor.h" 22 #include "fastdeploy/utils/unique_ptr.h" 43 Recognizer(
const std::string& model_file,
const std::string& params_file =
"",
44 const std::string& label_path =
"",
49 std::string
ModelName()
const {
return "ppocr/ocr_rec"; }
55 virtual std::unique_ptr<Recognizer> Clone()
const;
64 virtual bool Predict(
const cv::Mat& img, std::string* text,
float* rec_score);
72 virtual bool Predict(
const cv::Mat& img, vision::OCRResult* ocr_result);
80 virtual bool BatchPredict(
const std::vector<cv::Mat>& images,
81 vision::OCRResult* ocr_result);
90 virtual bool BatchPredict(
const std::vector<cv::Mat>& images,
91 std::vector<std::string>* texts, std::vector<float>* rec_scores);
93 virtual bool BatchPredict(
const std::vector<cv::Mat>& images,
94 std::vector<std::string>* texts, std::vector<float>* rec_scores,
95 size_t start_index,
size_t end_index,
96 const std::vector<int>& indices);
100 return preprocessor_;
105 return postprocessor_;
Option object used when create a new Runtime object.
Definition: runtime_option.h:40
Base model object for all the vision models.
Definition: fastdeploy_model.h:21
ModelFormat
Definition: enum_variables.h:67
std::string ModelName() const
Get model's name.
Definition: recognizer.h:49
Preprocessor object for PaddleClas serials model.
Definition: rec_preprocessor.h:26
Recognizer object is used to load the recognition model provided by PaddleOCR.
Definition: recognizer.h:32
Model with paddlepaddle format.
Definition: enum_variables.h:69
virtual RecognizerPostprocessor & GetPostprocessor()
Get postprocessor reference of DBDetectorPostprocessor.
Definition: recognizer.h:104
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16
virtual RecognizerPreprocessor & GetPreprocessor()
Get preprocessor reference of DBDetectorPreprocessor.
Definition: recognizer.h:99
Postprocessor object for Recognizer serials model.
Definition: rec_postprocessor.h:26