Quellcode durchsuchen

增加模型,修改测试

liangzhongquan vor 2 Jahren
Ursprung
Commit
4c4c33444e

+ 4 - 4
Makefile

@@ -5,13 +5,13 @@ COMMIT_SHA1     := $(shell git rev-parse HEAD)
 AUTHOR          := $(shell git show -s --format='%an')
 
 
-.PHONY: all gpu
+.PHONY: all gpu cpu
 
 all: gpu
 gpu:
 	@docker build -t registry.cn-hangzhou.aliyuncs.com/sxtest/$(NAME):gpu --build-arg VERSION=gpu .
 	# @docker push registry.cn-hangzhou.aliyuncs.com/sxtest/$(NAME):gpu
 
-# cpu:
-# 	@docker build -f cpu.Dockerfile -t registry.cn-hangzhou.aliyuncs.com/sxtest/$(NAME):cpu --build-arg VERSION=cpu .
-# 	@docker push registry.cn-hangzhou.aliyuncs.com/sxtest/$(NAME):cpu
+cpu:
+	@docker build -f cpu.Dockerfile -t registry.cn-hangzhou.aliyuncs.com/sxtest/$(NAME):cpu --build-arg VERSION=cpu .
+	@docker push registry.cn-hangzhou.aliyuncs.com/sxtest/$(NAME):cpu

BIN
en_ppocr_mobile_v2.0_table_structure_infer/inference.pdiparams


BIN
en_ppocr_mobile_v2.0_table_structure_infer/inference.pdiparams.info


BIN
en_ppocr_mobile_v2.0_table_structure_infer/inference.pdmodel


BIN
images/01.jpeg


+ 1 - 1
server.py

@@ -31,7 +31,7 @@ if os.getenv('USE_CUDA') == 'gpu':
 print(f'use gpu: {use_gpu}')
 
 # 初始化模型
-table_engine = PPStructure(layout=False, show_log=True)
+table_engine = PPStructure(layout=False, table=True, show_log=True, table_model_dir="/Users/sxkj/opt/python-workspace/yili-ocr/ocr-table/en_ppocr_mobile_v2.0_table_structure_infer")
 
 
 class TableInfo(BaseModel):

+ 6 - 2
testing/table_test.py

@@ -13,12 +13,13 @@ def send_request(image_path):
         return r.json()
 
 
-class TestIdCardOcr(unittest.TestCase):
+class TestTableOcr(unittest.TestCase):
     def test_it_work(self):
         pong = requests.request("GET", '/'.join([url, 'ping']))
         self.assertEqual('"pong!"', pong.text, 'Not work')
 
     def test_table_01(self):
+        print("被旋转的图片")
         res = send_request('./images/01.jpeg')
         self.assertEqual('000', res['status'], 'Not work')
 
@@ -48,4 +49,7 @@ class TestIdCardOcr(unittest.TestCase):
 
     def test_table_08(self):
         res = send_request('./images/08.jpg')
-        self.assertEqual('000', res['status'], 'Not work')
+        self.assertEqual('000', res['status'], 'Not work')
+
+if __name__ == '__main__':
+    unittest.main()