提交 d61c5cba 编写于 作者: D dyning

Merge branch 'ocr_refine' of https://github.com/wangjiawei04/Serving into ocr_refine

...@@ -38,7 +38,7 @@ python ocr_debugger_server.py ...@@ -38,7 +38,7 @@ python ocr_debugger_server.py
## Web Debugger Client Prediction ## Web Debugger Client Prediction
``` ```
python ocr_web_clint.py python ocr_web_client.py
``` ```
## Benchmark ## Benchmark
...@@ -53,3 +53,35 @@ Dataset: RCTW 500 sample images ...@@ -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 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 | | 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
```
...@@ -43,7 +43,7 @@ python ocr_debugger_server.py ...@@ -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单卡 ...@@ -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 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 | | 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
```
...@@ -65,7 +65,7 @@ class OCRService(WebService): ...@@ -65,7 +65,7 @@ class OCRService(WebService):
ocr_service = OCRService(name="ocr") ocr_service = OCRService(name="ocr")
ocr_service.load_model_config("ocr_det_model") ocr_service.load_model_config("ocr_det_model")
ocr_service.set_gpus("0") 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.init_det()
ocr_service.run_debugger_service() ocr_service.run_debugger_service()
ocr_service.run_web_service() ocr_service.run_web_service()
...@@ -66,7 +66,7 @@ class OCRService(WebService): ...@@ -66,7 +66,7 @@ class OCRService(WebService):
ocr_service = OCRService(name="ocr") ocr_service = OCRService(name="ocr")
ocr_service.load_model_config("ocr_det_model") ocr_service.load_model_config("ocr_det_model")
ocr_service.set_gpus("0") 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.init_det()
ocr_service.run_rpc_service() ocr_service.run_rpc_service()
ocr_service.run_web_service() ocr_service.run_web_service()
...@@ -28,7 +28,7 @@ def cv2_to_base64(image): ...@@ -28,7 +28,7 @@ def cv2_to_base64(image):
headers = {"Content-type": "application/json"} 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/" test_img_dir = "rec_img/"
for img_file in os.listdir(test_img_dir): for img_file in os.listdir(test_img_dir):
......
...@@ -66,6 +66,6 @@ ocr_service = OCRService(name="ocr") ...@@ -66,6 +66,6 @@ ocr_service = OCRService(name="ocr")
ocr_service.load_model_config("ocr_rec_model") ocr_service.load_model_config("ocr_rec_model")
ocr_service.set_gpus("0") ocr_service.set_gpus("0")
ocr_service.init_rec() 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_rpc_service()
ocr_service.run_web_service() ocr_service.run_web_service()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册