Răsfoiți Sursa

refine table models inference codes (#2806)

Liu Jiaxuan 10 luni în urmă
părinte
comite
7d0d727333

+ 0 - 5
paddlex/inference/models_new/table_structure_recognition/processors.py

@@ -22,11 +22,6 @@ from ..common.vision import funcs as F
 class Pad:
     """Pad the image."""
 
-    INPUT_KEYS = "img"
-    OUTPUT_KEYS = ["img", "img_size"]
-    DEAULT_INPUTS = {"img": "img"}
-    DEAULT_OUTPUTS = {"img": "img", "img_size": "img_size"}
-
     def __init__(self, target_size, val=127.5):
         """
         Initialize the instance.

+ 0 - 55
paddlex/inference/models_new/table_structure_recognition/result.py

@@ -51,58 +51,3 @@ class TableRecResult(BaseCVResult):
             box = np.reshape(np.array(box), [-1, 1, 2]).astype(np.int64)
             image = cv2.polylines(np.array(image), [box], True, (255, 0, 0), 2)
         return image
-
-
-class StructureTableResult(TableRecResult, HtmlMixin, XlsxMixin):
-    """StructureTableResult"""
-
-    def __init__(self, data):
-        super().__init__(data)
-        HtmlMixin.__init__(self)
-        XlsxMixin.__init__(self)
-
-    def _to_html(self):
-        return self["html"]
-
-
-class TableResult(BaseCVResult, HtmlMixin, XlsxMixin):
-    """TableResult"""
-
-    def __init__(self, data):
-        super().__init__(data)
-        HtmlMixin.__init__(self)
-        XlsxMixin.__init__(self)
-
-    def save_to_html(self, save_path):
-        if not save_path.lower().endswith(("html")):
-            input_path = self["input_path"]
-            save_path = Path(save_path) / f"{Path(input_path).stem}"
-        else:
-            save_path = Path(save_path).stem
-        for table_result in self["table_result"]:
-            table_result.save_to_html(save_path)
-
-    def save_to_xlsx(self, save_path):
-        if not save_path.lower().endswith(("xlsx")):
-            input_path = self["input_path"]
-            save_path = Path(save_path) / f"{Path(input_path).stem}"
-        else:
-            save_path = Path(save_path).stem
-        for table_result in self["table_result"]:
-            table_result.save_to_xlsx(save_path)
-
-    def save_to_img(self, save_path):
-        if not save_path.lower().endswith((".jpg", ".png")):
-            input_path = self["input_path"]
-            save_path = Path(save_path) / f"{Path(input_path).stem}"
-        else:
-            save_path = Path(save_path).stem
-        layout_save_path = f"{save_path}_layout.jpg"
-        ocr_save_path = f"{save_path}_ocr.jpg"
-        table_save_path = f"{save_path}_table"
-        layout_result = self["layout_result"]
-        layout_result.save_to_img(layout_save_path)
-        ocr_result = self["ocr_result"]
-        ocr_result.save_to_img(ocr_save_path)
-        for idx, table_result in enumerate(self["table_result"]):
-            table_result.save_to_img(f"{table_save_path}_{idx}.jpg")