Skip to content

Commit

Permalink
update result
Browse files Browse the repository at this point in the history
  • Loading branch information
tink2123 committed Apr 12, 2022
1 parent 94d71d7 commit bc7ea03
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions deploy/pdserving/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ PaddleOCR提供2种服务部署方式:
- 基于PaddleHub Serving的部署:代码路径为"`./deploy/hubserving`",使用方法参考[文档](../../deploy/hubserving/readme.md)
- 基于PaddleServing的部署:代码路径为"`./deploy/pdserving`",按照本教程使用。

* AIStudio演示案例可参考 [基于PaddleServing的OCR服务化部署实战](https://aistudio.baidu.com/aistudio/projectdetail/3630726)

# 基于PaddleServing的服务部署

Expand All @@ -19,6 +18,8 @@ PaddleOCR提供2种服务部署方式:

更多有关PaddleServing服务化部署框架介绍和使用教程参考[文档](https://github.com/PaddlePaddle/Serving/blob/develop/README_CN.md)

AIStudio演示案例可参考 [基于PaddleServing的OCR服务化部署实战](https://aistudio.baidu.com/aistudio/projectdetail/3630726)

## 目录
- [环境准备](#环境准备)
- [模型转换](#模型转换)
Expand Down Expand Up @@ -133,7 +134,7 @@ python3 -m paddle_serving_client.convert --dirname ./ch_PP-OCRv2_rec_infer/ \
python3 pipeline_http_client.py
```
成功运行后,模型预测的结果会打印在cmd窗口中,结果示例为:
![](./imgs/results.png)
![](./imgs/pipeline_result.png)

调整 config.yml 中的并发个数获得最大的QPS, 一般检测和识别的并发数为2:1
```
Expand Down
Binary file added deploy/pdserving/imgs/pipeline_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions deploy/pdserving/pipeline_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ def cv2_to_base64(image):
for idx, img_file in enumerate(os.listdir(test_img_dir)):
with open(os.path.join(test_img_dir, img_file), 'rb') as file:
image_data1 = file.read()
print('{}{}{}'.format('*' * 10, img_file, '*' * 10))

image = cv2_to_base64(image_data1)

for i in range(1):
data = {"key": ["image"], "value": [image]}
r = requests.post(url=url, data=json.dumps(data))
print(r.json())
data = {"key": ["image"], "value": [image]}
r = requests.post(url=url, data=json.dumps(data))
all_result = r.json()["value"][0]
for item in eval(all_result):
print(item)
#print("len result:", len(result))
#print(eval(result[0]))

print("==> total number of test imgs: ", len(os.listdir(test_img_dir)))

0 comments on commit bc7ea03

Please sign in to comment.