ソースを参照

修改配置文件,暂时关闭新模型

fangjiasheng 2 年 前
コミット
53e1d9c579

+ 35 - 35
format_convert/convert_image.py

@@ -87,45 +87,45 @@ def image_process(image_np, image_path, is_from_pdf=False, is_from_docx=False, u
 
     log("into image_preprocess")
     try:
-        # # 图片倾斜校正,写入原来的图片路径
-        # # print("image_process", image_path)
-        # g_r_i = get_rotated_image(image_np, image_path)
-        # if judge_error_code(g_r_i):
-        #     if is_from_docx:
-        #         return []
-        #     else:
-        #         return g_r_i
-        # image_np = cv2.imread(image_path)
-        # if image_np is None:
-        #     return []
-
-        if image_np is None:
-            return []
-
-        with open(image_path, "rb") as f:
-            image_bytes = f.read()
-
-        # idc模型实现图片倾斜校正
-        image_np = from_idc_interface(image_bytes)
-        if judge_error_code(image_np):
+        # 图片倾斜校正,写入原来的图片路径
+        # print("image_process", image_path)
+        g_r_i = get_rotated_image(image_np, image_path)
+        if judge_error_code(g_r_i):
             if is_from_docx:
                 return []
             else:
-                return image_np
-        idc_path = image_path.split(".")[0] + "_idc." + image_path.split(".")[-1]
-        cv2.imwrite(idc_path, image_np)
-        with open(idc_path, "rb") as f:
-            image_bytes = f.read()
+                return g_r_i
+        image_np = cv2.imread(image_path)
+        if image_np is None:
+            return []
 
-        # isr模型去除印章
-        image_np = from_isr_interface(image_bytes)
-        if judge_error_code(image_np):
-            if is_from_docx:
-                return []
-            else:
-                return image_np
-        isr_path = image_path.split(".")[0] + "_isr." + image_path.split(".")[-1]
-        cv2.imwrite(isr_path, image_np)
+        # if image_np is None:
+        #     return []
+        #
+        # with open(image_path, "rb") as f:
+        #     image_bytes = f.read()
+        #
+        # # idc模型实现图片倾斜校正
+        # image_np = from_idc_interface(image_bytes)
+        # if judge_error_code(image_np):
+        #     if is_from_docx:
+        #         return []
+        #     else:
+        #         return image_np
+        # idc_path = image_path.split(".")[0] + "_idc." + image_path.split(".")[-1]
+        # cv2.imwrite(idc_path, image_np)
+        # with open(idc_path, "rb") as f:
+        #     image_bytes = f.read()
+        #
+        # # isr模型去除印章
+        # image_np = from_isr_interface(image_bytes)
+        # if judge_error_code(image_np):
+        #     if is_from_docx:
+        #         return []
+        #     else:
+        #         return image_np
+        # isr_path = image_path.split(".")[0] + "_isr." + image_path.split(".")[-1]
+        # cv2.imwrite(isr_path, image_np)
 
         # otr模型识别表格,需要图片resize成模型所需大小, 写入另一个路径
         best_h, best_w = get_best_predict_size(image_np)

+ 4 - 4
format_convert/convert_test.py

@@ -23,7 +23,7 @@ def test_one(p, from_remote=False):
         # _url = 'http://121.46.18.113:15010/convert'
         # _url = 'http://192.168.2.103:15010/convert'
         # _url = 'http://172.16.160.65:15010/convert'
-        _url = 'http://127.0.0.1:15010/convert'
+        _url = 'http://127.0.0.1:12345/convert'
         result = json.loads(request_post(_url, data, time_out=10000))
         text_str = ""
         for t in result.get("result_html"):
@@ -57,10 +57,10 @@ if __name__ == '__main__':
         # file_path = "C:/Users/Administrator/Desktop/test_xls/merge_cell.xlsx"
         # file_path = "D:/BIDI_DOC/比地_文档/2022/Test_Interface/20210609202634853485.xlsx"
         # file_path = "D:/BIDI_DOC/比地_文档/2022/Test_ODPS/1624325845476.pdf"
-        # file_path = "C:/Users/Administrator/Downloads/1660296734009.pdf"
-        file_path = "C:/Users/Administrator/Desktop/test_image/error10.png"
+        file_path = "C:/Users/Administrator/Downloads/1660296734009.pdf"
+        # file_path = "C:/Users/Administrator/Desktop/test_image/error10.png"
     else:
-        file_path = "test1.doc"
+        file_path = "1660296734009.pdf"
     test_one(file_path, from_remote=True)
 
     # if get_platform() == "Windows":

+ 5 - 5
format_convert/interface.yml

@@ -14,18 +14,18 @@ MASTER:
 
   CONVERT:
     port: [15010]
-    processes: [30]
+    processes: [60]
 
   SCHEDULE:
     port:
 
   OCR:
     port_start: [17000]
-    port_no: [3]
+    port_no: [4]
 
   OTR:
     port_start: [18000]
-    port_no: [3]
+    port_no: [2]
 
   OFFICE:
     port_start: [16000]
@@ -49,11 +49,11 @@ SLAVE:
 
   OCR:
     port_start: [17000]
-    port_no: [2]
+    port_no: [4]
 
   OTR:
     port_start: [18000]
-    port_no: [4]
+    port_no: [2]
 
   OFFICE:
     port_start: