[Other] Improve some PPOCR API comments. (#875)

* Fix links in readme

* Fix links in readme

* Update PPOCRv2/v3 examples

* Update auto compression configs

* Add neww quantization  support for paddleclas model

* Update quantized Yolov6s model download link

* Improve PPOCR comments
This commit is contained in:
yunyaoXYY
2022-12-14 10:08:31 +08:00
committed by GitHub
parent cab0e5f9cb
commit f601d076e4
7 changed files with 30 additions and 12 deletions

View File

@@ -43,11 +43,21 @@ class FASTDEPLOY_DECL Classifier : public FastDeployModel {
const ModelFormat& model_format = ModelFormat::PADDLE); const ModelFormat& model_format = ModelFormat::PADDLE);
/// Get model's name /// Get model's name
std::string ModelName() const { return "ppocr/ocr_cls"; } 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. /** \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] 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. * \return true if the prediction is successed, otherwise false.
*/ */
virtual bool BatchPredict(const std::vector<cv::Mat>& images, virtual bool BatchPredict(const std::vector<cv::Mat>& images,

View File

@@ -28,8 +28,8 @@ class FASTDEPLOY_DECL ClassifierPostprocessor {
/** \brief Process the result of runtime and fill to ClassifyResult structure /** \brief Process the result of runtime and fill to ClassifyResult structure
* *
* \param[in] tensors The inference result from runtime * \param[in] tensors The inference result from runtime
* \param[in] cls_labels The output result of classification * \param[in] cls_labels The output label results of classification model
* \param[in] cls_scores The output result of classification * \param[in] cls_scores The output score results of classification model
* \return true if the postprocess successed, otherwise false * \return true if the postprocess successed, otherwise false
*/ */
bool Run(const std::vector<FDTensor>& tensors, bool Run(const std::vector<FDTensor>& tensors,

View File

@@ -26,8 +26,8 @@ class FASTDEPLOY_DECL ClassifierPreprocessor {
public: public:
/** \brief Process the input image and prepare input tensors for runtime /** \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] outputs The output tensors which will be fed into runtime
* \return true if the preprocess successed, otherwise false * \return true if the preprocess successed, otherwise false
*/ */
bool Run(std::vector<FDMat>* images, std::vector<FDTensor>* outputs); bool Run(std::vector<FDMat>* images, std::vector<FDTensor>* outputs);

View File

@@ -26,7 +26,7 @@ class FASTDEPLOY_DECL DBDetectorPreprocessor {
public: public:
/** \brief Process the input image and prepare input tensors for runtime /** \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] outputs The output tensors which will feed in runtime
* \param[in] batch_det_img_info_ptr The output of preprocess * \param[in] batch_det_img_info_ptr The output of preprocess
* \return true if the preprocess successed, otherwise false * \return true if the preprocess successed, otherwise false

View File

@@ -35,8 +35,8 @@ class FASTDEPLOY_DECL RecognizerPostprocessor {
/** \brief Process the result of runtime and fill to RecognizerResult /** \brief Process the result of runtime and fill to RecognizerResult
* *
* \param[in] tensors The inference result from runtime * \param[in] tensors The inference result from runtime
* \param[in] texts The output result of recognizer * \param[in] texts The output text results of recognizer
* \param[in] rec_scores The output result of recognizer * \param[in] rec_scores The output score results of recognizer
* \return true if the postprocess successed, otherwise false * \return true if the postprocess successed, otherwise false
*/ */
bool Run(const std::vector<FDTensor>& tensors, bool Run(const std::vector<FDTensor>& tensors,

View File

@@ -26,8 +26,8 @@ class FASTDEPLOY_DECL RecognizerPreprocessor {
public: public:
/** \brief Process the input image and prepare input tensors for runtime /** \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] outputs The output tensors which will be fed into runtime
* \return true if the preprocess successed, otherwise false * \return true if the preprocess successed, otherwise false
*/ */
bool Run(std::vector<FDMat>* images, std::vector<FDTensor>* outputs); bool Run(std::vector<FDMat>* images, std::vector<FDTensor>* outputs);

View File

@@ -45,11 +45,19 @@ class FASTDEPLOY_DECL Recognizer : public FastDeployModel {
const ModelFormat& model_format = ModelFormat::PADDLE); const ModelFormat& model_format = ModelFormat::PADDLE);
/// Get model's name /// Get model's name
std::string ModelName() const { return "ppocr/ocr_rec"; } 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); virtual bool Predict(const cv::Mat& img, std::string* text, float* rec_score);
/** \brief BatchPredict the input image and get OCR recognition model result. /** \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] 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. * \return true if the prediction is successed, otherwise false.
*/ */
virtual bool BatchPredict(const std::vector<cv::Mat>& images, virtual bool BatchPredict(const std::vector<cv::Mat>& images,