[Doc] Improve PPOCR API docs. (#1428)

* Add Huawei Ascend NPU deploy through PaddleLite CANN

* Add NNAdapter interface for paddlelite

* Modify Huawei Ascend Cmake

* Update way for compiling Huawei Ascend NPU deployment

* remove UseLiteBackend in UseCANN

* Support compile python whlee

* Change names of nnadapter API

* Add nnadapter pybind and remove useless API

* Support Python deployment on Huawei Ascend NPU

* 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

* Add models suppor for ascend

* Add PPOCR rec reszie for ascend

* fix conflict for ascend

* Rename CANN to Ascend

* Rename CANN to Ascend

* Improve ascend

* fix ascend bug

* improve ascend docs

* improve ascend docs

* improve ascend docs

* Add English doc for quantization

* Improve Ascend

* Improve Ascend

* Move ascend python demo

* Imporve ascend

* Fix PPOCR rec model bug

* Improve ascend

* Improve ascend

* Improve ascend

* Improve ascend

* Add  new paddleseg quantization support

* Add  new paddleseg quantization support

* Add  new paddleseg quantization support

* Add  new paddleseg quantization support

* Imporve ascend

* Imporve ascend

* Improve ascend

* acc eval script

* acc eval

* remove acc_eval from branch huawei

* Add detection and segmentation examples for Ascend deployment

* Add detection and segmentation examples for Ascend deployment

* Add Ascend model list

* Add ascend model list

* Add ascend model list

* Add ascend model list

* Add ascend model list

* Add ascend model list

* Add ascend model list

* Add PPOCR example for ascend deploy

* Imporve paddle lite compiliation

* Add FlyCV doc

* Add FlyCV doc

* Add FlyCV doc

* Imporve Ascend docs

* Imporve Ascend docs

* Improve PPOCR example

* Support Ascend deployment on X86 platform

* Improve Ascend docs

* Improve ascend

* Improve ascend

* Change Paddle Lite Ascend URL

* fix ascend docs

* fix ascend docs

* Fix Paddle Lite Ascend Lib

* Imporve compile of Ascend

* Imporve compile of Ascend

* fix paddle lite compile

* Remove useless opencv code for ocr

* Improve PPOCR API docs

* Improve PPOCR API docs

* Improve PPOCR API docs
This commit is contained in:
yunyaoXYY
2023-02-24 09:45:39 +08:00
committed by GitHub
parent 524c85745b
commit df79c58814
2 changed files with 99 additions and 2 deletions

View File

@@ -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<int, 4>)
"""
@@ -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<int, 4>)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."