FastDeploy
latest
Fast & Easy to Deploy!
|
#include "fastdeploy_capi/core/fd_common.h"
#include "fastdeploy_capi/core/fd_type.h"
#include "fastdeploy_capi/runtime/runtime_option.h"
#include "fastdeploy_capi/vision/result.h"
#include "fastdeploy_capi/vision/ocr/ppocr/base_define.h"
Go to the source code of this file.
Typedefs | |
typedef struct FD_C_RecognizerWrapper | FD_C_RecognizerWrapper |
typedef struct FD_C_ClassifierWrapper | FD_C_ClassifierWrapper |
typedef struct FD_C_DBDetectorWrapper | FD_C_DBDetectorWrapper |
typedef struct FD_C_PPOCRv2Wrapper | FD_C_PPOCRv2Wrapper |
typedef struct FD_C_PPOCRv3Wrapper | FD_C_PPOCRv3Wrapper |
typedef struct FD_C_ClassifierWrapper FD_C_ClassifierWrapper |
typedef struct FD_C_DBDetectorWrapper FD_C_DBDetectorWrapper |
typedef struct FD_C_PPOCRv2Wrapper FD_C_PPOCRv2Wrapper |
typedef struct FD_C_PPOCRv3Wrapper FD_C_PPOCRv3Wrapper |
typedef struct FD_C_RecognizerWrapper FD_C_RecognizerWrapper |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_ClassifierWrapperBatchPredict | ( | __fd_keep FD_C_ClassifierWrapper * | fd_c_classifier_wrapper, |
FD_C_OneDimMat | imgs, | ||
FD_C_OneDimArrayInt32 * | cls_labels, | ||
FD_C_OneDimArrayFloat * | cls_scores | ||
) |
BatchPredict the input image and get OCR classification model cls_result.
[in] | fd_c_classifier_wrapper | pointer to FD_C_ClassifierWrapper object |
[in] | imgs | The list of input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. |
[in] | cls_labels | The label results of cls model will be written in to this vector. |
[in] | cls_scores | The score results of cls model will be written in to this vector. |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_ClassifierWrapperBatchPredictWithIndex | ( | __fd_keep FD_C_ClassifierWrapper * | fd_c_classifier_wrapper, |
FD_C_OneDimMat | imgs, | ||
FD_C_OneDimArrayInt32 * | cls_labels, | ||
FD_C_OneDimArrayFloat * | cls_scores, | ||
size_t | start_index, | ||
size_t | end_index | ||
) |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_ClassifierWrapperInitialized | ( | __fd_keep FD_C_ClassifierWrapper * | fd_c_classifier_wrapper | ) |
Check if the model is initialized successfully.
[in] | fd_c_classifier_wrapper | pointer to FD_C_ClassifierWrapper object |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_ClassifierWrapperPredict | ( | __fd_keep FD_C_ClassifierWrapper * | fd_c_classifier_wrapper, |
FD_C_Mat | img, | ||
int32_t * | cls_label, | ||
float * | cls_score | ||
) |
Predict the input image and get OCR classification model cls_result.
[in] | fd_c_classifier_wrapper | pointer to FD_C_ClassifierWrapper object |
[in] | img | The input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. |
[in] | cls_label | The label result of cls model will be written in to this param. |
[in] | cls_score | The score result of cls model will be written in to this param. |
FASTDEPLOY_CAPI_EXPORT __fd_give FD_C_ClassifierWrapper* FD_C_CreateClassifierWrapper | ( | const char * | model_file, |
const char * | params_file, | ||
FD_C_RuntimeOptionWrapper * | fd_c_runtime_option_wrapper, | ||
const FD_C_ModelFormat | model_format | ||
) |
Create a new FD_C_ClassifierWrapper object.
[in] | model_file | Path of model file, e.g ./ch_ppocr_mobile_v2.0_cls_infer/model.pdmodel. |
[in] | params_file | Path of parameter file, e.g ./ch_ppocr_mobile_v2.0_cls_infer/model.pdiparams, if the model format is ONNX, this parameter will be ignored. |
[in] | fd_c_runtime_option_wrapper | RuntimeOption for inference, the default will use cpu, and choose the backend defined in valid_cpu_backends . |
[in] | model_format | Model format of the loaded model, default is Paddle format. |
FASTDEPLOY_CAPI_EXPORT __fd_give FD_C_DBDetectorWrapper* FD_C_CreateDBDetectorWrapper | ( | const char * | model_file, |
const char * | params_file, | ||
FD_C_RuntimeOptionWrapper * | fd_c_runtime_option_wrapper, | ||
const FD_C_ModelFormat | model_format | ||
) |
Create a new FD_C_DBDetectorWrapper object.
[in] | model_file | Path of model file, e.g ./ch_PP-OCRv3_det_infer/model.pdmodel. |
[in] | params_file | Path of parameter file, e.g ./ch_PP-OCRv3_det_infer/model.pdiparams, if the model format is ONNX, this parameter will be ignored. |
[in] | custom_option | RuntimeOption for inference, the default will use cpu, and choose the backend defined in valid_cpu_backends . |
[in] | model_format | Model format of the loaded model, default is Paddle format. |
FASTDEPLOY_CAPI_EXPORT __fd_give FD_C_PPOCRv2Wrapper* FD_C_CreatePPOCRv2Wrapper | ( | FD_C_DBDetectorWrapper * | det_model, |
FD_C_ClassifierWrapper * | cls_model, | ||
FD_C_RecognizerWrapper * | rec_model | ||
) |
Set up the detection model path, classification model path and recognition model path respectively.
[in] | det_model | Path of detection model, e.g ./ch_PP-OCRv2_det_infer |
[in] | cls_model | Path of classification model, e.g ./ch_ppocr_mobile_v2.0_cls_infer |
[in] | rec_model | Path of recognition model, e.g ./ch_PP-OCRv2_rec_infer |
FASTDEPLOY_CAPI_EXPORT __fd_give FD_C_PPOCRv3Wrapper* FD_C_CreatePPOCRv3Wrapper | ( | FD_C_DBDetectorWrapper * | det_model, |
FD_C_ClassifierWrapper * | cls_model, | ||
FD_C_RecognizerWrapper * | rec_model | ||
) |
Set up the detection model path, classification model path and recognition model path respectively.
[in] | det_model | Path of detection model, e.g ./ch_PP-OCRv2_det_infer |
[in] | cls_model | Path of classification model, e.g ./ch_ppocr_mobile_v2.0_cls_infer |
[in] | rec_model | Path of recognition model, e.g ./ch_PP-OCRv2_rec_infer |
FASTDEPLOY_CAPI_EXPORT __fd_give FD_C_RecognizerWrapper* FD_C_CreateRecognizerWrapper | ( | const char * | model_file, |
const char * | params_file, | ||
const char * | label_path, | ||
FD_C_RuntimeOptionWrapper * | fd_c_runtime_option_wrapper, | ||
const FD_C_ModelFormat | model_format | ||
) |
Create a new FD_C_RecognizerWrapper object.
[in] | model_file | Path of model file, e.g ./ch_PP-OCRv3_rec_infer/model.pdmodel. |
[in] | params_file | Path of parameter file, e.g ./ch_PP-OCRv3_rec_infer/model.pdiparams, if the model format is ONNX, this parameter will be ignored. |
[in] | label_path | Path of label file used by OCR recognition model. e.g ./ppocr_keys_v1.txt |
[in] | custom_option | RuntimeOption for inference, the default will use cpu, and choose the backend defined in valid_cpu_backends . |
[in] | model_format | Model format of the loaded model, default is Paddle format. |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_DBDetectorWrapperBatchPredict | ( | __fd_keep FD_C_DBDetectorWrapper * | fd_c_dbdetector_wrapper, |
FD_C_OneDimMat | imgs, | ||
FD_C_ThreeDimArrayInt32 * | det_results | ||
) |
BatchPredict the input image and get OCR detection model result.
[in] | fd_c_dbdetector_wrapper | pointer to FD_C_DBDetectorWrapper object |
[in] | imgs | The list input of image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. |
[in] | det_results | The output of OCR detection model result will be writen to this structure. |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_DBDetectorWrapperInitialized | ( | __fd_keep FD_C_DBDetectorWrapper * | fd_c_dbdetector_wrapper | ) |
Check if the model is initialized successfully.
[in] | fd_c_dbdetector_wrapper | pointer to FD_C_DBDetectorWrapper object |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_DBDetectorWrapperPredict | ( | __fd_keep FD_C_DBDetectorWrapper * | fd_c_dbdetector_wrapper, |
FD_C_Mat | img, | ||
FD_C_TwoDimArrayInt32 * | boxes_result | ||
) |
Predict the input image and get OCR detection model result.
[in] | fd_c_dbdetector_wrapper | pointer to FD_C_DBDetectorWrapper object |
[in] | img | The input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. |
[in] | boxes_result | The output of OCR detection model result will be writen to this structure. |
FASTDEPLOY_CAPI_EXPORT void FD_C_DestroyClassifierWrapper | ( | __fd_take FD_C_ClassifierWrapper * | fd_c_classifier_wrapper | ) |
Destroy a FD_C_ClassifierWrapper object.
[in] | fd_c_classifier_wrapper | pointer to FD_C_ClassifierWrapper object |
FASTDEPLOY_CAPI_EXPORT void FD_C_DestroyDBDetectorWrapper | ( | __fd_take FD_C_DBDetectorWrapper * | fd_c_dbdetector_wrapper | ) |
Destroy a FD_C_DBDetectorWrapper object.
[in] | fd_c_dbdetector_wrapper | pointer to FD_C_DBDetectorWrapper object |
FASTDEPLOY_CAPI_EXPORT void FD_C_DestroyPPOCRv2Wrapper | ( | __fd_take FD_C_PPOCRv2Wrapper * | fd_c_ppocrv2_wrapper | ) |
Destroy a FD_C_PPOCRv2Wrapper object.
[in] | fd_c_ppocrv2_wrapper | pointer to FD_C_PPOCRv2Wrapper object |
FASTDEPLOY_CAPI_EXPORT void FD_C_DestroyPPOCRv3Wrapper | ( | __fd_take FD_C_PPOCRv3Wrapper * | fd_c_ppocrv3_wrapper | ) |
Destroy a FD_C_PPOCRv3Wrapper object.
[in] | fd_c_ppocrv3_wrapper | pointer to FD_C_PPOCRv3Wrapper object |
FASTDEPLOY_CAPI_EXPORT void FD_C_DestroyRecognizerWrapper | ( | __fd_take FD_C_RecognizerWrapper * | fd_c_recognizer_wrapper | ) |
Destroy a FD_C_RecognizerWrapper object.
[in] | fd_c_recognizer_wrapper | pointer to FD_C_RecognizerWrapper object |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_PPOCRv2WrapperBatchPredict | ( | __fd_keep FD_C_PPOCRv2Wrapper * | fd_c_ppocrv2_wrapper, |
FD_C_OneDimMat | imgs, | ||
FD_C_OneDimOCRResult * | batch_result | ||
) |
BatchPredict the input image and get OCR result.
[in] | fd_c_ppocrv2_wrapper | pointer to FD_C_PPOCRv2Wrapper object |
[in] | imgs | The list of input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. |
[in] | batch_result | The output list of OCR result will be writen to this structure. |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_PPOCRv2WrapperInitialized | ( | __fd_keep FD_C_PPOCRv2Wrapper * | fd_c_ppocrv2_wrapper | ) |
Check if the model is initialized successfully.
[in] | fd_c_ppocrv2_wrapper | pointer to FD_C_PPOCRv2Wrapper object |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_PPOCRv2WrapperPredict | ( | __fd_keep FD_C_PPOCRv2Wrapper * | fd_c_ppocrv2_wrapper, |
FD_C_Mat | img, | ||
FD_C_OCRResult * | result | ||
) |
Predict the input image and get OCR result.
[in] | fd_c_ppocrv2_wrapper | pointer to FD_C_PPOCRv2Wrapper object |
[in] | img | The input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. |
[in] | result | The output OCR result will be writen to this structure. |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_PPOCRv3WrapperBatchPredict | ( | __fd_keep FD_C_PPOCRv3Wrapper * | fd_c_ppocrv3_wrapper, |
FD_C_OneDimMat | imgs, | ||
FD_C_OneDimOCRResult * | batch_result | ||
) |
BatchPredict the input image and get OCR result.
[in] | fd_c_ppocrv3_wrapper | pointer to FD_C_PPOCRv3Wrapper object |
[in] | imgs | The list of input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. |
[in] | batch_result | The output list of OCR result will be writen to this structure. |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_PPOCRv3WrapperInitialized | ( | __fd_keep FD_C_PPOCRv3Wrapper * | fd_c_ppocrv3_wrapper | ) |
Check if the model is initialized successfully.
[in] | fd_c_ppocrv3_wrapper | pointer to FD_C_PPOCRv3Wrapper object |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_PPOCRv3WrapperPredict | ( | __fd_keep FD_C_PPOCRv3Wrapper * | fd_c_ppocrv3_wrapper, |
FD_C_Mat | img, | ||
FD_C_OCRResult * | result | ||
) |
Predict the input image and get OCR result.
[in] | fd_c_ppocrv3_wrapper | pointer to FD_C_PPOCRv3Wrapper object |
[in] | img | The input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. |
[in] | result | The output OCR result will be writen to this structure. |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_RecognizerWrapperBatchPredict | ( | __fd_keep FD_C_RecognizerWrapper * | fd_c_recognizer_wrapper, |
FD_C_OneDimMat | imgs, | ||
FD_C_OneDimArrayCstr * | texts, | ||
FD_C_OneDimArrayFloat * | rec_scores | ||
) |
Predict the ocr results for a batch of input images.
[in] | fd_c_recognizer_wrapper | pointer to FD_C_RecognizerWrapper object |
[in] | imgs | The list of input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. |
[in] | texts | The list of text results of rec model will be written into this vector. |
[in] | rec_scores | The list of sccore result of rec model will be written into this vector. |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_RecognizerWrapperBatchPredictWithIndex | ( | __fd_keep FD_C_RecognizerWrapper * | fd_c_recognizer_wrapper, |
FD_C_OneDimMat | imgs, | ||
FD_C_OneDimArrayCstr * | texts, | ||
FD_C_OneDimArrayFloat * | rec_scores, | ||
size_t | start_index, | ||
size_t | end_index, | ||
FD_C_OneDimArrayInt32 | indices | ||
) |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_RecognizerWrapperInitialized | ( | __fd_keep FD_C_RecognizerWrapper * | fd_c_recognizer_wrapper | ) |
Check if the model is initialized successfully.
[in] | fd_c_recognizer_wrapper | pointer to FD_C_RecognizerWrapper object |
FASTDEPLOY_CAPI_EXPORT FD_C_Bool FD_C_RecognizerWrapperPredict | ( | __fd_keep FD_C_RecognizerWrapper * | fd_c_recognizer_wrapper, |
FD_C_Mat | img, | ||
FD_C_Cstr * | text, | ||
float * | rec_score | ||
) |
Predict the ocr result for an input image.
[in] | fd_c_recognizer_wrapper | pointer to FD_C_RecognizerWrapper object |
[in] | img | The input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format. |
[in] | text | The text result of rec model will be written into this parameter. |
[in] | rec_score | The sccore result of rec model will be written into this parameter. |