Env:
- linux + python3.7
- paddlepaddle 2.1.1 pip3 install paddlepaddle-gpu==2.1.1
- paddleocr 2.0.6 pip3 install paddleocr==2.0.6
I expect to deploy PaddleOCR on my machine using Flask. And I want to speed up the prediction using Mkldnn. However, an error occurred in the second prediction When using flask to deploy the OCR model with enable mkldnn.
However, the third prediction will not be wrong, and the fourth prediction will be wrong again. Moreover, there is no error occurred when I set threaded to False.
The error message:
The code to reproduce the problem is as follows.
from flask import Flask
from paddleocr import PaddleOCR, draw_ocr
app = Flask(__name__)
ocr_japan = PaddleOCR(use_angle_cls=True, use_gpu=False, lang="japan")
ocr_en = PaddleOCR(use_angle_cls=True, use_gpu=False, lang="en")
ocr_korean = PaddleOCR(use_angle_cls=True, use_gpu=False, lang="korean")
ocr_chinese = PaddleOCR(use_angle_cls=False, use_gpu=False, lang="ch", enable_mkldnn=True)
@app.route('/')
def hello_world():
result = ocr_chinese.ocr("./image.jpg", cls=False)
print(result)
return "1"
if __name__ == '__main__':
app.run(host="0.0.0.0", port=8088, threaded=True) # failed
#app.run(host="0.0.0.0", port=8088, threaded=False) # success
When enable is set to False, the correct result can be obtained and no error is reported, but the prediction speed is too slow.
I found that there is a conv2d OP dnnl warning before every error.
Paddle/paddle/fluid/framework/operator.cc
Line 242 in 89fdd6c
| | LOG(WARNING) << Type() << " raises an exception " |
The tested image.jpg
https://raw.githubusercontent.com/PaddlePaddle/PaddleOCR/dygraph/doc/imgs/11.jpg
2条答案
按热度按时间uurv41yg1#
您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看 官网API文档 、 常见问题 、 历史Issue 、 AI社区 来寻求解答。祝您生活愉快~
Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the API , FAQ , Github Issue and AI community to get the answer.Have a nice day!
c0vxltue2#
Reproduced with
vim /home/li/miniconda3/envs/py3.7/lib/python3.7/site-packages/paddleocr/paddleocr.py
, as solution to this issue No module named 'tools.infer' PaddleOCR#1024The error is: In very second step, paddle with mkldnn true failed
could not create primitive