PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
44.74k stars 7.86k forks source link

训练文字识别报错:RecursionError: maximum recursion depth exceeded while calling a Python object #11148

Open great-wind opened 1 year ago

great-wind commented 1 year ago

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

查询之后,得到的答案是程序在运行过程中超过最大的递归深度,可以通过修改默认的递归深度解决,但是治标不治本,请问该问题如何从根本上解决???求大佬解惑

PavloMyrotiuk commented 11 months ago

Have similar error:

Exception in thread Thread-1 (_thread_loop):
Traceback (most recent call last):
  File "/Users/pmyrotiuk/Workspace/PaddleOCR/ppocr/data/simple_dataset.py", line 159, in __getitem__
    outs = transform(data, self.ops)
  File "/Users/pmyrotiuk/Workspace/PaddleOCR/ppocr/data/imaug/__init__.py", line 56, in transform
    data = op(data)
  File "/Users/pmyrotiuk/Workspace/PaddleOCR/ppocr/data/imaug/label_ops.py", line 1260, in __call__
    data_ctc = copy.deepcopy(data)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/copy.py", line 206, in _deepcopy_list
    append(deepcopy(a, memo))
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/copy.py", line 177, in deepcopy
    _keep_alive(x, memo) # Make sure x lives at least as long as d
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/copy.py", line 254, in _keep_alive
    memo[id(memo)].append(x)
RecursionError: maximum recursion depth exceeded while calling a Python object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/site-packages/paddle/io/dataloader/dataloader_iter.py", line 235, in _thread_loop
    batch = self._dataset_fetcher.fetch(
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/site-packages/paddle/io/dataloader/fetcher.py", line 78, in fetch
    data.append(self.dataset[idx])
  File "/Users/pmyrotiuk/Workspace/PaddleOCR/ppocr/data/simple_dataset.py", line 169, in __getitem__
    return self.__getitem__(rnd_idx)
  File "/Users/pmyrotiuk/Workspace/PaddleOCR/ppocr/data/simple_dataset.py", line 169, in __getitem__
    return self.__getitem__(rnd_idx)
  File "/Users/pmyrotiuk/Workspace/PaddleOCR/ppocr/data/simple_dataset.py", line 169, in __getitem__
    return self.__getitem__(rnd_idx)
  [Previous line repeated 980 more times]
  File "/Users/pmyrotiuk/Workspace/PaddleOCR/ppocr/data/simple_dataset.py", line 163, in __getitem__
    data_line, traceback.format_exc()))
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/traceback.py", line 183, in format_exc
    return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain))
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/traceback.py", line 135, in format_exception
    te = TracebackException(type(value), value, tb, limit=limit, compact=True)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/site-packages/exceptiongroup/_formatting.py", line 96, in __init__
    self.stack = traceback.StackSummary.extract(
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/traceback.py", line 383, in extract
    f.line
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/traceback.py", line 306, in line
    self._line = linecache.getline(self.filename, self.lineno)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/linecache.py", line 30, in getline
    lines = getlines(filename, module_globals)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/linecache.py", line 46, in getlines
    return updatecache(filename, module_globals)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/linecache.py", line 136, in updatecache
    with tokenize.open(fullname) as fp:
  File "/opt/homebrew/Caskroom/miniconda/base/envs/paddle-train/lib/python3.10/tokenize.py", line 394, in open
    buffer = _builtin_open(filename, 'rb')
RecursionError: maximum recursion depth exceeded while calling a Python object
Haeppypuppy commented 9 months ago

Same here

iterations [2024/02/16 20:08:38] ppocr ERROR: When parsing line icdar_c4_train_imgs/img_440.jpg [{"transcription": "Sprite", "points": [[817, 247], [872, 250], [867, 279], [811, 276]]}, {"transcription": "DARY", "points": [[806, 74], [858, 61], [860, 91], [808, 104]]}, {"transcription": "###", "points": [[749, 444], [763, 451], [761, 482], [747, 476]]}, {"transcription": "###", "points": [[761, 453], [778, 461], [777, 481], [760, 473]]}, {"transcription": "Sprite", "points": [[888, 565], [927, 548], [929, 566], [890, 583]]}, {"transcription": "###", "points": [[1048, 456], [1111, 485], [1101, 490], [1038, 460]]}, {"transcription": "###", "points": [[1131, 434], [1174, 451], [1148, 460], [1105, 443]]}, {"transcription": "Sottis", "points": [[834, 420], [855, 416], [856, 428], [835, 432]]}, {"transcription": "###", "points": [[251, 301], [284, 304], [278, 313], [245, 310]]}, {"transcription": "###", "points": [[257, 293], [286, 294], [283, 303], [254, 302]]}, {"transcription": "###", "points": [[466, 180], [516, 175], [519, 188], [469, 192]]}, {"transcription": "###", "points": [[1037, 458], [1108, 492], [1096, 498], [1026, 464]]}] , error happened with msg: Traceback (most recent call last): File "C:\Users\nana\0216\PaddleOCR-release-2.6.1\ppocr\data\simple_dataset.py", line 151, in getitem data['image'] = img RecursionError: maximum recursion depth exceeded while calling a Python object

Fatal Python error: Cannot recover from stack overflow. Python runtime state: initialized

RishabhSheoran commented 7 months ago

Hi! Did you find a solution?