PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

RuntimeError: could not execute a primitive 错误问题

Open ybshaw opened this issue 2 years ago • 2 comments

使用Flask包装成http接口,开启服务之后,测试图片时出现下面错误(每次从第二张图片开始就报错导,第一张是正常)

  • 我的代码
model = PaddleOCR(......)
file_path = '/home/ocr/test.jpg'
ocr_output,  ocr_time = get_ocr_output(img_path=file_path, model=model)
  • 报错问题:
Traceback (most recent call last):
  File "server.py", line 100, in server
    ocr_output,  ocr_time = get_ocr_output(img_path=file_path, model=model)
  File "/root/hangyan/route-rec/ocr.py", line 24, in get_ocr_output
    output = model.ocr(img_path, cls=True)
  File "/root/py-venvs/flaks-venv/lib64/python3.6/site-packages/paddleocr/paddleocr.py", line 474, in ocr
    dt_boxes, rec_res = self.__call__(img, cls)
  File "/root/py-venvs/flaks-venv/lib64/python3.6/site-packages/paddleocr/tools/infer/predict_system.py", line 85, in __call__
    img_crop_list)
  File "/root/py-venvs/flaks-venv/lib64/python3.6/site-packages/paddleocr/tools/infer/predict_cls.py", line 111, in __call__
    self.predictor.run()
RuntimeError: could not execute a primitive

关闭mkldnn时,就没有这种错误,看了相关的issue,发现有人提出说是版本问题,但是我升级了版本,还是一样的问题;推测是mkldnn的问题,想问下是因为开启mkldnn之后内存占用过大的原因吗,但是看报错信息又是在predict_cls.py文件中,有没有相关解决办法呢

  • 环境
centos 7 CPU 2核, 内存2G
paddlepaddle==2.3.1
paddleocr==2.5.0.3

ybshaw avatar Oct 19 '22 09:10 ybshaw

经过测试,本地windows环境下不会出现这种问题 windows配置信息

处理器:Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz   3.60 GHz
内存:16G

同样代码,在4核CPU 8G内存的 Intel Xeon CPU E5-2678的服务器上也是一样的错误信息

ybshaw avatar Oct 19 '22 09:10 ybshaw

我的也是 , 服务器上报错

pengfeidip avatar Oct 28 '22 01:10 pengfeidip

请问现在这个问题有解决吗,在不关闭mkldnn加速的情况下

uniqlo1 avatar Jun 27 '24 03:06 uniqlo1

@uniqlo1 换成dev 版本的paddle再试试看

GreatV avatar Jun 27 '24 05:06 GreatV

@uniqlo1 换成dev 版本的paddle再试试看

这个更换了版本后还是同样的问题。请问这个问题的出现和什么因素相关呢?是否是和机器的内存大小有关,可以通过其他的一些参数设置来解决这个问题吗?

uniqlo1 avatar Jul 17 '24 02:07 uniqlo1