diff --git a/python/examples/ocr/README.md b/python/examples/ocr/README.md index 36bc18d8091874914944580fd8326caa1950c9d6..0fa61ab12b6b4c061d46628bb8e0cbb67bca1c3f 100644 --- a/python/examples/ocr/README.md +++ b/python/examples/ocr/README.md @@ -38,7 +38,7 @@ python ocr_debugger_server.py ## Web Debugger Client Prediction ``` -python ocr_web_clint.py +python ocr_web_client.py ``` ## Benchmark @@ -53,3 +53,35 @@ Dataset: RCTW 500 sample images |------------------------------|----------------|----------------------------|------------------|--------------------|------------------|--------------------|--------------------|------------------|--------------------|--------------------------|--------------------|--------------|---------------| | Serving web service | 8.69 | 13.41 | 109.97 | 2.82 | 87.76 | 4.29 | 3.98 | 78.51 | 3.66 | 4.12 | 181.02 | 136.49 | 317.51 | | Serving Debugger web service | 8.73 | 16.42 | 115.27 | 2.93 | 20.63 | 3.97 | 4.48 | 13.84 | 3.60 | 6.91 | 49.45 | 147.33 | 196.78 | + +## Appendix: Det or Rec only +if you are going to detect images not recognize it or directly recognize the words from images. We also provide Det and Rec server for you. + +### Det Server + +``` +python det_web_server.py +#or +python det_debugger_server.py +``` + +### Det Client + +``` +# also use ocr_web_client.py +python ocr_web_client.py +``` + +### Rec Server + +``` +python rec_web_server.py +#or +python rec_debugger_server.py +``` + +### Rec Client + +``` +python rec_web_client.py +``` diff --git a/python/examples/ocr/README_CN.md b/python/examples/ocr/README_CN.md index 9321333679b4b150f524aff4890579eacbebc46d..44473ea80d056addd8be288649c685f2da245cac 100644 --- a/python/examples/ocr/README_CN.md +++ b/python/examples/ocr/README_CN.md @@ -43,7 +43,7 @@ python ocr_debugger_server.py ## 启动客户端 ``` -python ocr_web_clint.py +python ocr_web_client.py ``` ## 性能指标 @@ -58,3 +58,36 @@ GPU: Nvidia Tesla V100单卡 |------------------------------|----------------|----------------------------|------------------|--------------------|------------------|--------------------|--------------------|------------------|--------------------|--------------------------|--------------------|--------------|---------------| | Serving web service | 8.69 | 13.41 | 109.97 | 2.82 | 87.76 | 4.29 | 3.98 | 78.51 | 3.66 | 4.12 | 181.02 | 136.49 | 317.51 | | Serving Debugger web service | 8.73 | 16.42 | 115.27 | 2.93 | 20.63 | 3.97 | 4.48 | 13.84 | 3.60 | 6.91 | 49.45 | 147.33 | 196.78 | + + +## 附录: 检测/识别单服务启动 +如果您想单独启动检测或者识别服务,我们也提供了启动单服务的代码 + +### 启动检测服务 + +``` +python det_web_server.py +#or +python det_debugger_server.py +``` + +### 检测服务客户端 + +``` +# also use ocr_web_client.py +python ocr_web_client.py +``` + +### 启动识别服务 + +``` +python rec_web_server.py +#or +python rec_debugger_server.py +``` + +### 识别服务客户端 + +``` +python rec_web_client.py +``` diff --git a/python/examples/ocr/det_debugger_server.py b/python/examples/ocr/det_debugger_server.py index 6900585f9615bcfb28b8b0674d79ec1676cbaad4..acfccdb6d24a7e1ba490705dd147f21dbf921d31 100644 --- a/python/examples/ocr/det_debugger_server.py +++ b/python/examples/ocr/det_debugger_server.py @@ -65,7 +65,7 @@ class OCRService(WebService): ocr_service = OCRService(name="ocr") ocr_service.load_model_config("ocr_det_model") ocr_service.set_gpus("0") -ocr_service.prepare_server(workdir="workdir", port=8900, device="gpu", gpuid=0) +ocr_service.prepare_server(workdir="workdir", port=9292, device="gpu", gpuid=0) ocr_service.init_det() ocr_service.run_debugger_service() ocr_service.run_web_service() diff --git a/python/examples/ocr/det_web_server.py b/python/examples/ocr/det_web_server.py index 454e96869d68c80a3522f2706c4d5486fb98b645..dd69be0c70eb0f4dd627aa47ad33045a204f78c0 100644 --- a/python/examples/ocr/det_web_server.py +++ b/python/examples/ocr/det_web_server.py @@ -66,7 +66,7 @@ class OCRService(WebService): ocr_service = OCRService(name="ocr") ocr_service.load_model_config("ocr_det_model") ocr_service.set_gpus("0") -ocr_service.prepare_server(workdir="workdir", port=8900, device="gpu", gpuid=0) +ocr_service.prepare_server(workdir="workdir", port=9292, device="gpu", gpuid=0) ocr_service.init_det() ocr_service.run_rpc_service() ocr_service.run_web_service() diff --git a/python/examples/ocr/rec_web_client.py b/python/examples/ocr/rec_web_client.py index 2bad668cd2c5f46aeebfad01941367727af4d08c..312a2148886d6f084a1c077d84e907cb28c0652a 100644 --- a/python/examples/ocr/rec_web_client.py +++ b/python/examples/ocr/rec_web_client.py @@ -28,7 +28,7 @@ def cv2_to_base64(image): headers = {"Content-type": "application/json"} -url = "http://127.0.0.1:8900/ocr/prediction" +url = "http://127.0.0.1:9292/ocr/prediction" test_img_dir = "rec_img/" for img_file in os.listdir(test_img_dir): diff --git a/python/examples/ocr/rec_web_server.py b/python/examples/ocr/rec_web_server.py index 3e35b2435ac812b130cddb58c55c405e741d2bb8..684c313d4d50cfe00c576c81aad05a810525dcce 100644 --- a/python/examples/ocr/rec_web_server.py +++ b/python/examples/ocr/rec_web_server.py @@ -66,6 +66,6 @@ ocr_service = OCRService(name="ocr") ocr_service.load_model_config("ocr_rec_model") ocr_service.set_gpus("0") ocr_service.init_rec() -ocr_service.prepare_server(workdir="workdir", port=8900, device="gpu", gpuid=0) +ocr_service.prepare_server(workdir="workdir", port=9292, device="gpu", gpuid=0) ocr_service.run_rpc_service() ocr_service.run_web_service()