yan chuanli 2 years ago
parent
commit
38c08c1201
2 changed files with 16 additions and 23 deletions
  1. 6 21
      TestAllOcr/test_interface.py
  2. 10 2
      to_md/use.py

+ 6 - 21
TestAllOcr/test_interface.py

@@ -11,9 +11,6 @@ envl = 'DX_test'
 url = config.URL[envl]
 token = config.TOKEN[envl]
 
-# 生产集群
-class TestSbOcr(unittest.TestCase):
-
     def _helper(self, image_path, suffix):
         root = Path(__file__).parent
         image_path = str(root / image_path)
@@ -41,17 +38,6 @@ class TestSbOcr(unittest.TestCase):
         suffix = '/xxw/schoolcert'
         self._helper(image_path, suffix)
 
-    def test_cet(self):
-        image_path = './image/cet.jpg'
-        suffix = '/cet/cet'
-        self._helper(image_path, suffix)
-
-    def test_blef(self):
-        image_path = './image/blfe.jpg'
-        suffix = '/blfe/blfe'
-        self._helper(image_path, suffix)
-
-# 测试集群
 class TestOcr(unittest.TestCase):
 
     def _helper(self, image_path, suffix):
@@ -63,31 +49,30 @@ class TestOcr(unittest.TestCase):
 
     def test_bank(self):
         image_path = './image/bankcard.jpg'
-        suffix = '/yhksbtest/bankcard'
+        suffix = '/yhksb/bankcard' if 'sb' in envl else '/yhksbtest/bankcard'
         self._helper(image_path, suffix)
 
     def test_idcard(self):
         image_path = './image/idcard.jpg'
-        suffix = '/sfzsbtest/idcard'
+        suffix = '/sfzsb/idcard' if 'sb' in envl else '/sfzsbtest/idcard'
         self._helper(image_path, suffix)
 
     def test_regbook(self):
         image_path = './image/regbook.jpg'
-        suffix = '/hkbsbtest/regbook'
+        suffix = '/hkbsb/regbook' if 'sb' in envl else '/hkbsbtest/regbook'
         self._helper(image_path, suffix)
 
     def test_schoolcert(self):
         image_path = './image/schoolcert.jpg'
-        suffix = '/xxwtest/schoolcert'
+        suffix = '/xxw/schoolcert' if 'sb' in envl else '/xxwtest/schoolcert'
         self._helper(image_path, suffix)
 
     def test_cet(self):
         image_path = './image/cet.jpg'
-        suffix = '/cettest/cet'
+        suffix = '/cet/cet' if 'sb' in envl else '/cettest/cet'
         self._helper(image_path, suffix)
 
     def test_blef(self):
         image_path = './image/blfe.jpg'
-        suffix = '/blfetest/blfe'
+        suffix = '/blfe/blfe' if 'sb' in envl else '/blfetest/blfe'
         self._helper(image_path, suffix)
-

+ 10 - 2
to_md/use.py

@@ -1,3 +1,11 @@
+'''
+Author: zeke-chin zeke-chin@icloud.com
+Date: 2022-09-26 14:58:10
+LastEditors: zeke-chin zeke-chin@icloud.com
+LastEditTime: 2022-09-27 10:00:47
+FilePath: /HROCR/to_md/to_md/use.py
+Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE`
+'''
 
 from pathlib import Path
 
@@ -8,7 +16,7 @@ from new import MD, Image, Dataset, parser_path
 image_path = Path('/Users/sxkj/Desktop/户口本9.8/img')
 image_type = 0
 # 是否旋转
-image_rotate = True
+image_rotate = False
 ocr_address = 'local'  # 'local' 'test' 'sb'
 
 ocr_name = 'regbook'  # 'cet' 'idcard' 'bankcard' 'regbook' 'schoolcert'
@@ -19,7 +27,7 @@ filed = 'regbook'
 # md_path = '/Users/zeke/work/sx/OCR/HROCR/to_md/example' or image_path.parent
 md_path = None or image_path.parent
 
-md_file = parser_path(Path(md_path) / Path(md_name), image_rotate)
+md_file = parser_path(Path(md_path) / Path(md_name + image_path.stem), image_rotate)
 
 
 if __name__ == '__main__':