diff --git a/fastdeploy/vision/ocr/ppocr/classifier.h b/fastdeploy/vision/ocr/ppocr/classifier.h index 5a4ed02a0..cd035e269 100755 --- a/fastdeploy/vision/ocr/ppocr/classifier.h +++ b/fastdeploy/vision/ocr/ppocr/classifier.h @@ -43,11 +43,21 @@ class FASTDEPLOY_DECL Classifier : public FastDeployModel { const ModelFormat& model_format = ModelFormat::PADDLE); /// Get model's name std::string ModelName() const { return "ppocr/ocr_cls"; } - virtual bool Predict(const cv::Mat& img, int32_t* cls_label, float* cls_score); + + /** \brief Predict the input image and get OCR classification model cls_result. + * + * \param[in] img The input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. + * \param[in] cls_label The label result of cls model will be written in to this param. + * \param[in] cls_score The score result of cls model will be written in to this param. + * \return true if the prediction is successed, otherwise false. + */ + virtual bool Predict(const cv::Mat& img, + int32_t* cls_label, float* cls_score); /** \brief BatchPredict the input image and get OCR classification model cls_result. * * \param[in] images The list of input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. - * \param[in] cls_results The output of OCR classification model cls_result will be writen to this structure. + * \param[in] cls_labels The label results of cls model will be written in to this vector. + * \param[in] cls_scores The score results of cls model will be written in to this vector. * \return true if the prediction is successed, otherwise false. */ virtual bool BatchPredict(const std::vector& images, diff --git a/fastdeploy/vision/ocr/ppocr/cls_postprocessor.h b/fastdeploy/vision/ocr/ppocr/cls_postprocessor.h index a755e1294..d9702e1a1 100644 --- a/fastdeploy/vision/ocr/ppocr/cls_postprocessor.h +++ b/fastdeploy/vision/ocr/ppocr/cls_postprocessor.h @@ -28,8 +28,8 @@ class FASTDEPLOY_DECL ClassifierPostprocessor { /** \brief Process the result of runtime and fill to ClassifyResult structure * * \param[in] tensors The inference result from runtime - * \param[in] cls_labels The output result of classification - * \param[in] cls_scores The output result of classification + * \param[in] cls_labels The output label results of classification model + * \param[in] cls_scores The output score results of classification model * \return true if the postprocess successed, otherwise false */ bool Run(const std::vector& tensors, diff --git a/fastdeploy/vision/ocr/ppocr/cls_preprocessor.h b/fastdeploy/vision/ocr/ppocr/cls_preprocessor.h index ed75d55b2..8c1c81611 100644 --- a/fastdeploy/vision/ocr/ppocr/cls_preprocessor.h +++ b/fastdeploy/vision/ocr/ppocr/cls_preprocessor.h @@ -26,8 +26,8 @@ class FASTDEPLOY_DECL ClassifierPreprocessor { public: /** \brief Process the input image and prepare input tensors for runtime * - * \param[in] images The input image data list, all the elements are returned by cv::imread() - * \param[in] outputs The output tensors which will feed in runtime + * \param[in] images The input data list, all the elements are FDMat + * \param[in] outputs The output tensors which will be fed into runtime * \return true if the preprocess successed, otherwise false */ bool Run(std::vector* images, std::vector* outputs); diff --git a/fastdeploy/vision/ocr/ppocr/det_preprocessor.h b/fastdeploy/vision/ocr/ppocr/det_preprocessor.h index d66e785d3..705f19c7b 100644 --- a/fastdeploy/vision/ocr/ppocr/det_preprocessor.h +++ b/fastdeploy/vision/ocr/ppocr/det_preprocessor.h @@ -26,7 +26,7 @@ class FASTDEPLOY_DECL DBDetectorPreprocessor { public: /** \brief Process the input image and prepare input tensors for runtime * - * \param[in] images The input image data list, all the elements are returned by cv::imread() + * \param[in] images The input data list, all the elements are FDMat * \param[in] outputs The output tensors which will feed in runtime * \param[in] batch_det_img_info_ptr The output of preprocess * \return true if the preprocess successed, otherwise false diff --git a/fastdeploy/vision/ocr/ppocr/rec_postprocessor.h b/fastdeploy/vision/ocr/ppocr/rec_postprocessor.h index 711ae3a01..5f9aa70f2 100644 --- a/fastdeploy/vision/ocr/ppocr/rec_postprocessor.h +++ b/fastdeploy/vision/ocr/ppocr/rec_postprocessor.h @@ -35,8 +35,8 @@ class FASTDEPLOY_DECL RecognizerPostprocessor { /** \brief Process the result of runtime and fill to RecognizerResult * * \param[in] tensors The inference result from runtime - * \param[in] texts The output result of recognizer - * \param[in] rec_scores The output result of recognizer + * \param[in] texts The output text results of recognizer + * \param[in] rec_scores The output score results of recognizer * \return true if the postprocess successed, otherwise false */ bool Run(const std::vector& tensors, diff --git a/fastdeploy/vision/ocr/ppocr/rec_preprocessor.h b/fastdeploy/vision/ocr/ppocr/rec_preprocessor.h index 1dad75870..c6c942468 100644 --- a/fastdeploy/vision/ocr/ppocr/rec_preprocessor.h +++ b/fastdeploy/vision/ocr/ppocr/rec_preprocessor.h @@ -26,8 +26,8 @@ class FASTDEPLOY_DECL RecognizerPreprocessor { public: /** \brief Process the input image and prepare input tensors for runtime * - * \param[in] images The input image data list, all the elements are returned by cv::imread() - * \param[in] outputs The output tensors which will feed in runtime + * \param[in] images The input data list, all the elements are FDMat + * \param[in] outputs The output tensors which will be fed into runtime * \return true if the preprocess successed, otherwise false */ bool Run(std::vector* images, std::vector* outputs); diff --git a/fastdeploy/vision/ocr/ppocr/recognizer.h b/fastdeploy/vision/ocr/ppocr/recognizer.h index 8a5f5bc70..bba8a4447 100755 --- a/fastdeploy/vision/ocr/ppocr/recognizer.h +++ b/fastdeploy/vision/ocr/ppocr/recognizer.h @@ -45,11 +45,19 @@ class FASTDEPLOY_DECL Recognizer : public FastDeployModel { const ModelFormat& model_format = ModelFormat::PADDLE); /// Get model's name std::string ModelName() const { return "ppocr/ocr_rec"; } + /** \brief Predict the input image and get OCR recognition model result. + * + * \param[in] img The input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. + * \param[in] text The text result of rec model will be written into this parameter. + * \param[in] rec_score The sccore result of rec model will be written into this parameter. + * \return true if the prediction is successed, otherwise false. + */ virtual bool Predict(const cv::Mat& img, std::string* text, float* rec_score); /** \brief BatchPredict the input image and get OCR recognition model result. * * \param[in] images The list of input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. - * \param[in] rec_results The output of OCR recognition model result will be writen to this structure. + * \param[in] texts The list of text results of rec model will be written into this vector. + * \param[in] rec_scores The list of sccore result of rec model will be written into this vector. * \return true if the prediction is successed, otherwise false. */ virtual bool BatchPredict(const std::vector& images,