Răsfoiți Sursa

Develop (#2145)

* modify installation_other_devices.md for export (#2133)

* fix resize about w,h order (#2132)

* Update README.md

* Update document_scene_information_extraction.md

* Update document_scene_information_extraction_en.md

* Update document_scene_information_extraction_en.md

* bugfix

* update doc (#2138)

* Support Cython generator type (#2136)

* update doc (#2140)

* [Feat] Add pipeline serving (#2077)

* Support pipeline serving

* Refactor

* Update det and instance_seg apps

* Fix bugs and enhance typing

* Set device when creating app

* Add TS apps

* Add ppchatocrv3 app

* Fix bugs and add anomaly detection app

* Fix bugs

* Update ppchatocrv3

* Update ppchatocrv3 APIs

* Update serving CLI

* Update ppchatocrv3

* Update and fix

* Fix bugs

* Update APIs

* Fix and update

* Remove bs setting

* new doc (#2134)

* update readme (#2139)

* uodate readme

* update readme

---------

Co-authored-by: cuicheng01 <45199522+cuicheng01@users.noreply.github.com>

* fix README.md

* fix README_en.md

* Develop (#2142)

* update doc

* update README

* update README

* Update README.md

* Update README_en.md

* str path (#2144)

* str path

* bugfix

* add faiss-cpu

* bugfix

* Update README.md

---------

Co-authored-by: a31413510 <31413510@qq.com>
Co-authored-by: Tingquan Gao <gaotingquan@baidu.com>
Co-authored-by: cuicheng01 <45199522+cuicheng01@users.noreply.github.com>
Co-authored-by: Lin Manhui <bob1998425@hotmail.com>
Co-authored-by: AmberC0209 <55582609+AmberC0209@users.noreply.github.com>
Co-authored-by: Tingquan Gao <35441050@qq.com>
dyning 1 an în urmă
părinte
comite
9842e55eb3

+ 1 - 0
README.md

@@ -541,6 +541,7 @@ for res in output:
   * [📊 表格结构识别模块使用教程](./docs/module_usage/tutorials/ocr_modules/table_structure_recognition.md)
   * [📄 文档图像方向分类使用教程](./docs/module_usage/tutorials/ocr_modules/doc_img_orientation_classification.md)
   * [🔧 文本图像矫正模块使用教程](./docs/module_usage/tutorials/ocr_modules/text_image_unwarping.md)
+  * [📐 公式识别模块使用教程](./docs/module_usage/tutorials/ocr_modules/formula_recognition.md)
   
   </details>
 

+ 1 - 0
README_en.md

@@ -534,6 +534,7 @@ For other pipelines in Python scripts, just adjust the `pipeline` parameter of t
   * [📊 Table Structure Recognition Module Usage Guide](./docs/module_usage/tutorials/ocr_modules/table_structure_recognition_en.md)
   * [📄 Document Image Orientation Classification Usage Guide](./docs/module_usage/tutorials/ocr_modules/doc_img_orientation_classification_en.md)
   * [🔧 Document Image Correction Module Usage Guide](./docs/module_usage/tutorials/ocr_modules/text_image_unwarping_en.md)
+  * [📐 Formula Recognition Module Usage Guide](./docs/module_usage/tutorials/ocr_modules/formula_recognition_en.md)
   </details>
 
 * <details>

+ 3 - 3
paddlex/inference/pipelines/__init__.py

@@ -66,17 +66,17 @@ def create_pipeline_from_config(
         predictor_kwargs["use_hpip"] = use_hpip
     if hpi_params is not None:
         predictor_kwargs["hpi_params"] = hpi_params
-        pipeline_setting.pop("hpi_params")
+        pipeline_setting.pop("hpi_params", None)
     elif "hpi_params" in pipeline_setting:
         predictor_kwargs["hpi_params"] = pipeline_setting.pop("hpi_params")
     if device is not None:
         predictor_kwargs["device"] = device
-        pipeline_setting.pop("device")
+        pipeline_setting.pop("device", None)
     elif "device" in pipeline_setting:
         predictor_kwargs["device"] = pipeline_setting.pop("device")
     if pp_option is not None:
         predictor_kwargs["pp_option"] = pp_option
-        pipeline_setting.pop("pp_option")
+        pipeline_setting.pop("pp_option", None)
     elif "pp_option" in pipeline_setting:
         predictor_kwargs["pp_option"] = pipeline_setting.pop("pp_option")
 

+ 4 - 4
paddlex/inference/utils/io/readers.py

@@ -81,7 +81,7 @@ class PDFReader(_BaseReader):
         super().__init__(backend, **bk_args)
 
     def read(self, in_path):
-        return self._backend.read_file(in_path)
+        return self._backend.read_file(str(in_path))
 
     def _init_backend(self, bk_type, bk_args):
         return PDFReaderBackend(**bk_args)
@@ -98,7 +98,7 @@ class ImageReader(_BaseReader):
 
     def read(self, in_path):
         """read the image file from path"""
-        arr = self._backend.read_file(in_path)
+        arr = self._backend.read_file(str(in_path))
         return arr
 
     def _init_backend(self, bk_type, bk_args):
@@ -147,7 +147,7 @@ class VideoReader(_GenerativeReader):
     def read(self, in_path):
         """read vide file from path"""
         self._backend.set_pos(self.st_frame_id)
-        gen = self._backend.read_file(in_path)
+        gen = self._backend.read_file(str(in_path))
         if self.num_frames is not None:
             gen = itertools.islice(gen, self.num_frames)
         yield from gen
@@ -286,7 +286,7 @@ class CSVReader(_BaseReader):
 
     def read(self, in_path):
         """read the image file from path"""
-        arr = self._backend.read_file(in_path)
+        arr = self._backend.read_file(str(in_path))
         return arr
 
     def _init_backend(self, bk_type, bk_args):

+ 6 - 6
paddlex/inference/utils/io/writers.py

@@ -95,7 +95,7 @@ class ImageWriter(_BaseWriter):
 
     def write(self, out_path, obj):
         """write"""
-        return self._backend.write_obj(out_path, obj)
+        return self._backend.write_obj(str(out_path), obj)
 
     def _init_backend(self, bk_type, bk_args):
         """init backend"""
@@ -119,7 +119,7 @@ class TextWriter(_BaseWriter):
 
     def write(self, out_path, obj):
         """write"""
-        return self._backend.write_obj(out_path, obj)
+        return self._backend.write_obj(str(out_path), obj)
 
     def _init_backend(self, bk_type, bk_args):
         """init backend"""
@@ -138,7 +138,7 @@ class JsonWriter(_BaseWriter):
         super().__init__(backend=backend, **bk_args)
 
     def write(self, out_path, obj, **bk_args):
-        return self._backend.write_obj(out_path, obj, **bk_args)
+        return self._backend.write_obj(str(out_path), obj, **bk_args)
 
     def _init_backend(self, bk_type, bk_args):
         if bk_type == "json":
@@ -158,7 +158,7 @@ class HtmlWriter(_BaseWriter):
         super().__init__(backend=backend, **bk_args)
 
     def write(self, out_path, obj, **bk_args):
-        return self._backend.write_obj(out_path, obj, **bk_args)
+        return self._backend.write_obj(str(out_path), obj, **bk_args)
 
     def _init_backend(self, bk_type, bk_args):
         if bk_type == "html":
@@ -176,7 +176,7 @@ class XlsxWriter(_BaseWriter):
         super().__init__(backend=backend, **bk_args)
 
     def write(self, out_path, obj, **bk_args):
-        return self._backend.write_obj(out_path, obj, **bk_args)
+        return self._backend.write_obj(str(out_path), obj, **bk_args)
 
     def _init_backend(self, bk_type, bk_args):
         if bk_type == "xlsx":
@@ -307,7 +307,7 @@ class CSVWriter(_BaseWriter):
 
     def write(self, out_path, obj):
         """write"""
-        return self._backend.write_obj(out_path, obj)
+        return self._backend.write_obj(str(out_path), obj)
 
     def _init_backend(self, bk_type, bk_args):
         """init backend"""

+ 5 - 5
paddlex/inference/utils/pp_option.py

@@ -121,7 +121,7 @@ class PaddlePredictorOption(object):
 
     @property
     def shape_info_filename(self):
-        self._cfg["shape_info_filename"]
+        return self._cfg["shape_info_filename"]
 
     @shape_info_filename.setter
     def shape_info_filename(self, shape_info_filename: str):
@@ -130,7 +130,7 @@ class PaddlePredictorOption(object):
 
     @property
     def trt_calib_mode(self):
-        self._cfg["trt_calib_mode"]
+        return self._cfg["trt_calib_mode"]
 
     @trt_calib_mode.setter
     def trt_calib_mode(self, trt_calib_mode):
@@ -139,7 +139,7 @@ class PaddlePredictorOption(object):
 
     @property
     def cpu_threads(self):
-        self._cfg["cpu_threads"]
+        return self._cfg["cpu_threads"]
 
     @cpu_threads.setter
     def cpu_threads(self, cpu_threads):
@@ -150,7 +150,7 @@ class PaddlePredictorOption(object):
 
     @property
     def trt_use_static(self):
-        self._cfg["trt_use_static"]
+        return self._cfg["trt_use_static"]
 
     @trt_use_static.setter
     def trt_use_static(self, trt_use_static):
@@ -167,7 +167,7 @@ class PaddlePredictorOption(object):
 
     @property
     def enable_new_ir(self):
-        self._cfg["enable_new_ir"]
+        return self._cfg["enable_new_ir"]
 
     @enable_new_ir.setter
     def enable_new_ir(self, enable_new_ir: bool):

+ 1 - 0
requirements.txt

@@ -31,3 +31,4 @@ erniebot == 0.5.0
 erniebot-agent == 0.5.0
 unstructured
 networkx
+faiss-cpu