Skip to content

Commit

Permalink
update for serving (PaddlePaddle#6518)
Browse files Browse the repository at this point in the history
  • Loading branch information
tink2123 committed Jun 8, 2022
1 parent 21d9f4b commit f10c458
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion deploy/pdserving/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ The recognition model is the same.
2. Run the following command to start the service.
```
# Start the service and save the running log in log.txt
python3 web_service.py &>log.txt &
python3 web_service.py --config=config.yml &>log.txt &
```
After the service is successfully started, a log similar to the following will be printed in log.txt
![](./imgs/start_server.png)
Expand Down
2 changes: 1 addition & 1 deletion deploy/pdserving/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ python3 -m paddle_serving_client.convert --dirname ./ch_PP-OCRv3_rec_infer/ \
2. 启动服务可运行如下命令:
```
# 启动服务,运行日志保存在log.txt
python3 web_service.py &>log.txt &
python3 web_service.py --config=config.yml &>log.txt &
```
成功启动服务后,log.txt中会打印类似如下日志
![](./imgs/start_server.png)
Expand Down
7 changes: 4 additions & 3 deletions deploy/pdserving/web_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import cv2
import base64
# from paddle_serving_app.reader import OCRReader
from ocr_reader import OCRReader, DetResizeForTest
from ocr_reader import OCRReader, DetResizeForTest, ArgsParser
from paddle_serving_app.reader import Sequential, ResizeByFactor
from paddle_serving_app.reader import Div, Normalize, Transpose
from paddle_serving_app.reader import DBPostProcess, FilterBoxes, GetRotateCropImage, SortedBoxes
Expand Down Expand Up @@ -85,7 +85,7 @@ def preprocess(self, input_dicts, data_id, log_id):
dt_boxes = copy.deepcopy(self.dt_list)
feed_list = []
img_list = []
max_wh_ratio = 320/48.
max_wh_ratio = 320 / 48.
## Many mini-batchs, the type of feed_data is list.
max_batch_size = 6 # len(dt_boxes)

Expand Down Expand Up @@ -163,5 +163,6 @@ def get_pipeline_response(self, read_op):


uci_service = OcrService(name="ocr")
uci_service.prepare_pipeline_config("config.yml")
FLAGS = ArgsParser().parse_args()
uci_service.prepare_pipeline_config(yml_dict=FLAGS.conf_dict)
uci_service.run_service()
2 changes: 0 additions & 2 deletions test_tipc/test_serving_infer_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ function func_serving(){

cd ${serving_dir_value}
# cpp serving
unset https_proxy
unset http_proxy
for gpu_id in ${gpu_value[*]}; do
if [ ${gpu_id} = "null" ]; then
if [ ${model_name} = "ch_PP-OCRv2" ] || [ ${model_name} = "ch_PP-OCRv3" ] || [ ${model_name} = "ch_ppocr_mobile_v2.0" ] || [ ${model_name} = "ch_ppocr_server_v2.0" ]; then
Expand Down
6 changes: 2 additions & 4 deletions test_tipc/test_serving_infer_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ function func_serving(){
python_list=(${python_list})

cd ${serving_dir_value}
unset https_proxy
unset http_proxy
python=${python_list[0]}

# python serving
Expand Down Expand Up @@ -147,7 +145,7 @@ function func_serving(){
status_check $last_status "${pipeline_cmd}" "${status_log}" "${model_name}"
sleep 2s
done
ps ux | grep -E 'web_service|pipeline' | awk '{print $2}' | xargs kill -s 9
ps ux | grep -E 'web_service' | awk '{print $2}' | xargs kill -s 9
done
done
elif [ ${use_gpu} = "gpu" ]; then
Expand Down Expand Up @@ -197,7 +195,7 @@ function func_serving(){
status_check $last_status "${pipeline_cmd}" "${status_log}" "${model_name}"
sleep 2s
done
ps ux | grep -E 'web_service|pipeline' | awk '{print $2}' | xargs kill -s 9
ps ux | grep -E 'web_service' | awk '{print $2}' | xargs kill -s 9
done
done
else
Expand Down

0 comments on commit f10c458

Please sign in to comment.