PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

Tensor holds no memory. Call Tensor::mutable_data firstly.

Open KrisTopherHao opened this issue 1 year ago • 4 comments

  • 系统环境/System Environment:
  • 版本号/Version:Paddle: PaddleOCR:
  • 运行指令/Command Code:
  • 完整报错/Complete Error Message:

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/tornado/web.py",line 1786,in _execute result = await result File "/usr/local/lib/python3.8/site-packages/tornado/gen.py", line 780,in run yielded = self.gen.throw(exc) File "/home/ocr_wh/paddle0cr/appGPU.py",line 42, in post tl,t2=yield self.inference(self.request.body ) File "/usr/local/lib/python3.8/site-packages/tornado/gen.py", line 767, in run value = future.result( ) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57,in run result = self.fn(*self.args,**self.kwargs) File "/home/ocr_wh/paddle0cr/appGPU.py",line 90, in inference ocr_result, infer_elapse = rapid ocr(image_np, box_thresh=box_thresh, File "/usr/local/lib/python3.8/site-packages/rapidocr_paddle/main.py", line 93, in _call img,cls_res, cls_elapse = self.text_cls(img) File "/usr/local/lib/python3.8/site-packages/rapidocr_paddle/ch_ppocr_v2_cls/text_cls.py", line 64, in _call prob_out = self.infer(norm img_batch)[0] File "/usr/local/lib/python3.8/site-packages/rapidocr_paddle/utils.py", line 67, in call output = output_tensor.copy_to_cpu( ) RuntimeError: (PreconditionNotMet)Tensor holds no memory. Call Tensor::mutable_data firstly. [Hint: holder should not be null.] (at /paddle/paddle/phi/core/dense_tensor_impl.cc:48)

KrisTopherHao avatar Jan 31 '24 10:01 KrisTopherHao

系统环境/System Environment:Linux CUDA 11.2 版本号/Version:Paddle:2.6.0 PaddleOCR:2.7.0.3

多线程并行调用ocr识别代码时,报错 File "/usr/local/lib/python3.8/site-packages/rapidocr_paddle/utils.py", line 67, in call output = output_tensor.copy_to_cpu( ) RuntimeError: (PreconditionNotMet)Tensor holds no memory. Call Tensor::mutable_data firstly. [Hint: holder should not be null.] (at /paddle/paddle/phi/core/dense_tensor_impl.cc:48)

代码示例如下: import paddleocr from paddleocr import PaddleOCR

ocr = PaddleOCR(lang="en", rec_model_type='en', rec_algorithm = 'CRNN', ocr_version = 'PP-OCRv3', use_gpu = True, det_db_thresh=0.4, show_log = False, use_angle_cls = True)

result = ocr.ocr('img.jpg')

ysy1418899560 avatar Feb 05 '24 11:02 ysy1418899560

did you have the solution for this issue ? i encounter the same error when i want to threading PPOCR.

RickyGunawan09 avatar Feb 13 '24 08:02 RickyGunawan09

同样问题

huyuejingling avatar Mar 28 '24 04:03 huyuejingling

我的伙计,或许增加一个time.sleep()延时怎么样?

NatureTao avatar Apr 29 '24 12:04 NatureTao