diff --git a/docs/api_docs/python/ocr.md b/docs/api_docs/python/ocr.md index a197263d5..8b071b454 100644 --- a/docs/api_docs/python/ocr.md +++ b/docs/api_docs/python/ocr.md @@ -1,5 +1,22 @@ # OCR(文字识别) +## fastdeploy.vision.ocr.DBDetectorPreprocessor + +```{eval-rst} +.. autoclass:: fastdeploy.vision.ocr.DBDetectorPreprocessor + :members: + :inherited-members: +``` + +## fastdeploy.vision.ocr.DBDetectorPostprocessor + +```{eval-rst} +.. autoclass:: fastdeploy.vision.ocr.DBDetectorPostprocessor + :members: + :inherited-members: +``` + + ## fastdeploy.vision.ocr.DBDetector ```{eval-rst} @@ -8,6 +25,22 @@ :inherited-members: ``` +## fastdeploy.vision.ocr.ClassifierPreprocessor + +```{eval-rst} +.. autoclass:: fastdeploy.vision.ocr.ClassifierPreprocessor + :members: + :inherited-members: +``` + +## fastdeploy.vision.ocr.ClassifierPostprocessor + +```{eval-rst} +.. autoclass:: fastdeploy.vision.ocr.ClassifierPostprocessor + :members: + :inherited-members: +``` + ## fastdeploy.vision.ocr.Classifier ```{eval-rst} @@ -16,6 +49,23 @@ :inherited-members: ``` + +## fastdeploy.vision.ocr.RecognizerPreprocessor + +```{eval-rst} +.. autoclass:: fastdeploy.vision.ocr.RecognizerPreprocessor + :members: + :inherited-members: +``` + +## fastdeploy.vision.ocr.RecognizerPostprocessor + +```{eval-rst} +.. autoclass:: fastdeploy.vision.ocr.RecognizerPostprocessor + :members: + :inherited-members: +``` + ## fastdeploy.vision.ocr.Recognizer ```{eval-rst} diff --git a/python/fastdeploy/vision/ocr/ppocr/__init__.py b/python/fastdeploy/vision/ocr/ppocr/__init__.py index e19fb686e..403f70aa7 100755 --- a/python/fastdeploy/vision/ocr/ppocr/__init__.py +++ b/python/fastdeploy/vision/ocr/ppocr/__init__.py @@ -24,12 +24,14 @@ def sort_boxes(boxes): class DBDetectorPreprocessor: def __init__(self): - """Create a preprocessor for DBDetectorModel + """ + Create a preprocessor for DBDetectorModel """ self._preprocessor = C.vision.ocr.DBDetectorPreprocessor() def run(self, input_ims): """Preprocess input images for DBDetectorModel + :param: input_ims: (list of numpy.ndarray) The input image :return: pair(list of FDTensor, list of std::array) """ @@ -66,12 +68,14 @@ class DBDetectorPreprocessor: class DBDetectorPostprocessor: def __init__(self): - """Create a postprocessor for DBDetectorModel + """ + Create a postprocessor for DBDetectorModel """ self._postprocessor = C.vision.ocr.DBDetectorPostprocessor() def run(self, runtime_results, batch_det_img_info): """Postprocess the runtime results for DBDetectorModel + :param: runtime_results: (list of FDTensor or list of pyArray)The output FDTensor results from runtime :param: batch_det_img_info: (list of std::array)The output of det_preprocessor :return: list of Result(If the runtime_results is predict by batched samples, the length of this list equals to the batch size) @@ -80,10 +84,17 @@ class DBDetectorPostprocessor: @property def det_db_thresh(self): + """ + Return the det_db_thresh of DBDetectorPostprocessor + """ return self._postprocessor.det_db_thresh @det_db_thresh.setter def det_db_thresh(self, value): + """Set the det_db_thresh for DBDetectorPostprocessor + + :param: value : the det_db_thresh value + """ assert isinstance( value, float), "The value to set `det_db_thresh` must be type of float." @@ -91,10 +102,17 @@ class DBDetectorPostprocessor: @property def det_db_box_thresh(self): + """ + Return the det_db_box_thresh of DBDetectorPostprocessor + """ return self._postprocessor.det_db_box_thresh @det_db_box_thresh.setter def det_db_box_thresh(self, value): + """Set the det_db_box_thresh for DBDetectorPostprocessor + + :param: value : the det_db_box_thresh value + """ assert isinstance( value, float ), "The value to set `det_db_box_thresh` must be type of float." @@ -102,10 +120,17 @@ class DBDetectorPostprocessor: @property def det_db_unclip_ratio(self): + """ + Return the det_db_unclip_ratio of DBDetectorPostprocessor + """ return self._postprocessor.det_db_unclip_ratio @det_db_unclip_ratio.setter def det_db_unclip_ratio(self, value): + """Set the det_db_unclip_ratio for DBDetectorPostprocessor + + :param: value : the det_db_unclip_ratio value + """ assert isinstance( value, float ), "The value to set `det_db_unclip_ratio` must be type of float." @@ -113,10 +138,17 @@ class DBDetectorPostprocessor: @property def det_db_score_mode(self): + """ + Return the det_db_score_mode of DBDetectorPostprocessor + """ return self._postprocessor.det_db_score_mode @det_db_score_mode.setter def det_db_score_mode(self, value): + """Set the det_db_score_mode for DBDetectorPostprocessor + + :param: value : the det_db_score_mode value + """ assert isinstance( value, str), "The value to set `det_db_score_mode` must be type of str." @@ -124,10 +156,17 @@ class DBDetectorPostprocessor: @property def use_dilation(self): + """ + Return the use_dilation of DBDetectorPostprocessor + """ return self._postprocessor.use_dilation @use_dilation.setter def use_dilation(self, value): + """Set the use_dilation for DBDetectorPostprocessor + + :param: value : the use_dilation value + """ assert isinstance( value, bool), "The value to set `use_dilation` must be type of bool." @@ -160,6 +199,7 @@ class DBDetector(FastDeployModel): def clone(self): """Clone OCR detection model object + :return: a new OCR detection model object """ @@ -334,10 +374,17 @@ class ClassifierPostprocessor: @property def cls_thresh(self): + """ + Return the cls_thresh of ClassifierPostprocessor + """ return self._postprocessor.cls_thresh @cls_thresh.setter def cls_thresh(self, value): + """Set the cls_thresh for ClassifierPostprocessor + + :param: value: the value of cls_thresh + """ assert isinstance( value, float), "The value to set `cls_thresh` must be type of float."