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
43.03k stars 7.72k forks source link

RecursionError: maximum recursion depth exceeded while calling a Python object #11733

Closed A123798qw closed 4 months ago

A123798qw commented 6 months ago

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

[2024/03/13 19:48:44] ppocr ERROR: When parsing line C:\Users\user\Desktop\PaddleOCR-2.6.0\train_data\det\train\ENmotor35.jpg [{"transcription": "3-PHASE", "points": [[283, 77], [419, 77], [419, 99], [283, 99]], "difficult": false, "key_cls": "PHASE"}, {"transcription": "50HP", "points": [[175, 143], [242, 143], [242, 162], [175, 162]], "difficult": false, "key_cls": "HP"}, {"transcription": "37kW", "points": [[248, 141], [313, 141], [313, 161], [248, 161]], "difficult": false, "key_cls": "kW"}, {"transcription": "200LA", "points": [[426, 134], [511, 134], [511, 157], [426, 157]], "difficult": false, "key_cls": "FRAME"}, {"transcription": "POLES2", "points": [[94, 168], [224, 168], [224, 190], [94, 190]], "difficult": false, "key_cls": "POLE"}, {"transcription": "Hz50", "points": [[108, 187], [269, 187], [269, 212], [108, 212]], "difficult": false, "key_cls": "FREQUENCY"}, {"transcription": "380", "points": [[193, 211], [285, 211], [285, 233], [193, 233]], "difficult": false, "key_cls": "VOLTS"}, {"transcription": "70", "points": [[206, 237], [248, 237], [248, 263], [206, 263]], "difficult": false, "key_cls": "AMPS"}, {"transcription": "R.PM.2940", "points": [[80, 263], [264, 263], [264, 287], [80, 287]], "difficult": false, "key_cls": "RPM"}, {"transcription": "DATE 2011", "points": [[58, 375], [208, 375], [208, 405], [58, 405]], "difficult": false, "key_cls": "DATE"}] , error happened with msg: Traceback (most recent call last): File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\simple_dataset.py", line 138, in getitem outs = transform(data, self.ops) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug__init.py", line 53, in transform data = op(data) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug\label_ops.py", line 67, in call txt_tags = np.array(txt_tags, dtype=np.bool) File "C:\Users\user\anaconda3\envs\paddle310\lib\site-packages\numpy__init.py", line 324, in getattr raise AttributeError(former_attrs[attr]) AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?

[2024/03/13 19:48:44] ppocr ERROR: When parsing line C:\Users\user\Desktop\PaddleOCR-2.6.0\train_data\det\train\ENmotor12.jpg [{"transcription": "10HP", "points": [[55, 107], [109, 107], [109, 132], [55, 132]], "difficult": false, "key_cls": "HP"}, {"transcription": "FR.132M", "points": [[113, 107], [174, 107], [174, 128], [113, 128]], "difficult": false, "key_cls": "FRAME"}, {"transcription": "3 PHASE", "points": [[154, 67], [258, 67], [258, 95], [154, 95]], "difficult": false, "key_cls": "PHASE"}, {"transcription": "4P", "points": [[60, 134], [89, 134], [89, 155], [60, 155]], "difficult": false, "key_cls": "POLE"}, {"transcription": "50", "points": [[56, 185], [80, 185], [80, 207], [56, 207]], "difficult": false, "key_cls": "FREQUENCY"}, {"transcription": "50", "points": [[53, 212], [78, 212], [78, 235], [53, 235]], "difficult": false, "key_cls": "FREQUENCY"}, {"transcription": "60", "points": [[52, 240], [77, 240], [77, 260], [52, 260]], "difficult": false, "key_cls": "FREQUENCY"}, {"transcription": "60", "points": [[53, 266], [79, 266], [79, 287], [53, 287]], "difficult": false, "key_cls": "FREQUENCY"}, {"transcription": "220", "points": [[108, 184], [147, 184], [147, 202], [108, 202]], "difficult": false, "key_cls": "VOLTS"}, {"transcription": "380", "points": [[108, 209], [148, 209], [148, 230], [108, 230]], "difficult": false, "key_cls": "VOLTS"}, {"transcription": "220", "points": [[106, 236], [146, 236], [146, 255], [106, 255]], "difficult": false, "key_cls": "VOLTS"}, {"transcription": "380", "points": [[106, 262], [146, 262], [146, 288], [106, 288]], "difficult": false, "key_cls": "VOLTS"}, {"transcription": "28", "points": [[197, 176], [236, 176], [236, 203], [197, 203]], "difficult": false, "key_cls": "AMPS"}, {"transcription": "16.1", "points": [[196, 204], [239, 204], [239, 227], [196, 227]], "difficult": false, "key_cls": "AMPS"}, {"transcription": "26.6", "points": [[193, 232], [236, 232], [236, 257], [193, 257]], "difficult": false, "key_cls": "AMPS"}, {"transcription": "15.4", "points": [[196, 260], [241, 260], [241, 281], [196, 281]], "difficult": false, "key_cls": "AMPS"}, {"transcription": "1445", "points": [[265, 177], [310, 177], [310, 196], [265, 196]], "difficult": false, "key_cls": "RPM"}, {"transcription": "1445", "points": [[268, 204], [316, 204], [316, 224], [268, 224]], "difficult": false, "key_cls": "RPM"}, {"transcription": "1740", "points": [[267, 229], [313, 229], [313, 252], [267, 252]], "difficult": false, "key_cls": "RPM"}, {"transcription": "1740", "points": [[264, 257], [315, 257], [315, 279], [264, 279]], "difficult": false, "key_cls": "RPM"}, {"transcription": "86.5", "points": [[325, 176], [370, 176], [370, 197], [325, 197]], "difficult": false, "key_cls": "EFF"}, {"transcription": "86.5", "points": [[328, 202], [368, 202], [368, 224], [328, 224]], "difficult": false, "key_cls": "EFF"}, {"transcription": "87.0", "points": [[330, 226], [375, 226], [375, 250], [330, 250]], "difficult": false, "key_cls": "EFF"}, {"transcription": "87.0", "points": [[325, 257], [374, 257], [374, 280], [325, 280]], "difficult": false, "key_cls": "EFF"}] , error happened with msg: Traceback (most recent call last): File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\simple_dataset.py", line 138, in getitem outs = transform(data, self.ops) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug__init.py", line 53, in transform data = op(data) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug\label_ops.py", line 67, in call txt_tags = np.array(txt_tags, dtype=np.bool) File "C:\Users\user\anaconda3\envs\paddle310\lib\site-packages\numpy__init.py", line 324, in getattr raise AttributeError(former_attrs[attr]) AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?

[2024/03/13 19:48:44] ppocr ERROR: When parsing line C:\Users\user\Desktop\PaddleOCR-2.6.0\train_data\det\train\ENmotor19.jpg [{"transcription": "3HP", "points": [[434, 278], [580, 278], [580, 327], [434, 327]], "difficult": false, "key_cls": "HP"}, {"transcription": "2.2kW", "points": [[622, 280], [800, 280], [800, 328], [622, 328]], "difficult": false, "key_cls": "kW"}, {"transcription": "182T", "points": [[990, 202], [1097, 202], [1097, 239], [990, 239]], "difficult": false, "key_cls": "FRAME"}, {"transcription": "4", "points": [[432, 323], [502, 323], [502, 363], [432, 363]], "difficult": false, "key_cls": "POLE"}, {"transcription": "3", "points": [[748, 323], [798, 323], [798, 364], [748, 364]], "difficult": false, "key_cls": "PHASE"}, {"transcription": "60", "points": [[544, 373], [629, 373], [629, 409], [544, 409]], "difficult": false, "key_cls": "FREQUENCY"}, {"transcription": "208-230/460", "points": [[450, 413], [743, 413], [743, 466], [450, 466]], "difficult": false, "key_cls": "VOLTS"}, {"transcription": "8.6-7.8/3.9", "points": [[459, 469], [694, 469], [694, 521], [459, 521]], "difficult": false, "key_cls": "AMPS"}, {"transcription": "1760/", "points": [[513, 573], [666, 573], [666, 621], [513, 621]], "difficult": false, "key_cls": "RPM"}, {"transcription": "200V", "points": [[394, 796], [536, 796], [536, 849], [394, 849]], "difficult": false, "key_cls": "VOLTS"}, {"transcription": "87.5", "points": [[1350, 735], [1450, 735], [1450, 788], [1350, 788]], "difficult": false, "key_cls": "EFF"}, {"transcription": "85.5", "points": [[1355, 791], [1451, 791], [1451, 841], [1355, 841]], "difficult": false, "key_cls": "EFF"}] , error happened with msg: Traceback (most recent call last): File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\simple_dataset.py", line 138, in getitem outs = transform(data, self.ops) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug__init.py", line 53, in transform data = op(data) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug\label_ops.py", line 67, in call txt_tags = np.array(txt_tags, dtype=np.bool) File "C:\Users\user\anaconda3\envs\paddle310\lib\site-packages\numpy__init.py", line 324, in getattr raise AttributeError(former_attrs[attr]) AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?

[2024/03/13 19:48:44] ppocr ERROR: When parsing line C:\Users\user\Desktop\PaddleOCR-2.6.0\train_data\det\train\ENmotor17.jpg [{"transcription": "1.5kW", "points": [[137, 94], [242, 94], [242, 122], [137, 122]], "difficult": false, "key_cls": "kW"}, {"transcription": "4P", "points": [[272, 100], [309, 100], [309, 124], [272, 124]], "difficult": false, "key_cls": "POLE"}, {"transcription": "90L", "points": [[215, 145], [253, 145], [253, 166], [215, 166]], "difficult": false, "key_cls": "FRAME"}, {"transcription": "1440", "points": [[216, 167], [268, 167], [268, 186], [216, 186]], "difficult": false, "key_cls": "RPM"}, {"transcription": "8.7/3.9", "points": [[217, 189], [287, 189], [287, 210], [217, 210]], "difficult": false, "key_cls": "AMPS"}, {"transcription": "220/380V", "points": [[338, 97], [465, 97], [465, 124], [338, 124]], "difficult": false, "key_cls": "VOLTS"}, {"transcription": "50Hz", "points": [[495, 100], [560, 100], [560, 125], [495, 125]], "difficult": false, "key_cls": "FREQUENCY"}, {"transcription": "THREE PHASE", "points": [[374, 64], [510, 64], [510, 83], [374, 83]], "difficult": false, "key_cls": "PHASE"}] , error happened with msg: Traceback (most recent call last): File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\simple_dataset.py", line 138, in getitem outs = transform(data, self.ops) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug__init.py", line 53, in transform data = op(data) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug\label_ops.py", line 67, in call txt_tags = np.array(txt_tags, dtype=np.bool) File "C:\Users\user\anaconda3\envs\paddle310\lib\site-packages\numpy__init.py", line 324, in getattr raise AttributeError(former_attrs[attr]) AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?

[2024/03/13 19:48:44] ppocr ERROR: When parsing line C:\Users\user\Desktop\PaddleOCR-2.6.0\train_data\det\train\ENmotor35.jpg [{"transcription": "3-PHASE", "points": [[283, 77], [419, 77], [419, 99], [283, 99]], "difficult": false, "key_cls": "PHASE"}, {"transcription": "50HP", "points": [[175, 143], [242, 143], [242, 162], [175, 162]], "difficult": false, "key_cls": "HP"}, {"transcription": "37kW", "points": [[248, 141], [313, 141], [313, 161], [248, 161]], "difficult": false, "key_cls": "kW"}, {"transcription": "200LA", "points": [[426, 134], [511, 134], [511, 157], [426, 157]], "difficult": false, "key_cls": "FRAME"}, {"transcription": "POLES2", "points": [[94, 168], [224, 168], [224, 190], [94, 190]], "difficult": false, "key_cls": "POLE"}, {"transcription": "Hz50", "points": [[108, 187], [269, 187], [269, 212], [108, 212]], "difficult": false, "key_cls": "FREQUENCY"}, {"transcription": "380", "points": [[193, 211], [285, 211], [285, 233], [193, 233]], "difficult": false, "key_cls": "VOLTS"}, {"transcription": "70", "points": [[206, 237], [248, 237], [248, 263], [206, 263]], "difficult": false, "key_cls": "AMPS"}, {"transcription": "R.PM.2940", "points": [[80, 263], [264, 263], [264, 287], [80, 287]], "difficult": false, "key_cls": "RPM"}, {"transcription": "DATE 2011", "points": [[58, 375], [208, 375], [208, 405], [58, 405]], "difficult": false, "key_cls": "DATE"}] , error happened with msg: Traceback (most recent call last): File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\simple_dataset.py", line 138, in getitem outs = transform(data, self.ops) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug__init.py", line 53, in transform data = op(data) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug\label_ops.py", line 67, in call txt_tags = np.array(txt_tags, dtype=np.bool) File "C:\Users\user\anaconda3\envs\paddle310\lib\site-packages\numpy__init.py", line 324, in getattr raise AttributeError(former_attrs[attr]) AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?

Exception in thread Thread-1 (_thread_loop): Traceback (most recent call last): File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\simple_dataset.py", line 138, in getitem outs = transform(data, self.ops) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug__init.py", line 53, in transform data = op(data) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\imaug\label_ops.py", line 67, in call txt_tags = np.array(txt_tags, dtype=np.bool) File "C:\Users\user\anaconda3\envs\paddle310\lib\site-packages\numpy__init.py", line 324, in getattr raise AttributeError(former_attrs[attr]) AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\simple_dataset.py", line 153, in getitem return self.getitem(rnd_idx) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\simple_dataset.py", line 153, in getitem return self.getitem(rnd_idx) File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\simple_dataset.py", line 153, in getitem return self.getitem(rnd_idx) [Previous line repeated 985 more times] File "C:\Users\user\Desktop\PaddleOCR-2.6.0\ppocr\data\simple_dataset.py", line 140, in getitem self.logger.error( File "C:\Users\user\anaconda3\envs\paddle310\lib\logging__init.py", line 1506, in error self._log(ERROR, msg, args, **kwargs) File "C:\Users\user\anaconda3\envs\paddle310\lib\logging__init__.py", line 1624, in _log self.handle(record) File "C:\Users\user\anaconda3\envs\paddle310\lib\logging__init.py", line 1634, in handle self.callHandlers(record) File "C:\Users\user\anaconda3\envs\paddle310\lib\logging\init.py", line 1696, in callHandlers hdlr.handle(record) File "C:\Users\user\anaconda3\envs\paddle310\lib\logging\init.py", line 968, in handle self.emit(record) File "C:\Users\user\anaconda3\envs\paddle310\lib\logging\init.py", line 1218, in emit StreamHandler.emit(self, record) File "C:\Users\user\anaconda3\envs\paddle310\lib\logging\init.py", line 1100, in emit msg = self.format(record) File "C:\Users\user\anaconda3\envs\paddle310\lib\logging\init.py", line 943, in format return fmt.format(record) File "C:\Users\user\anaconda3\envs\paddle310\lib\logging\init.py", line 679, in format if self.usesTime(): File "C:\Users\user\anaconda3\envs\paddle310\lib\logging\init__.py", line 647, in usesTime return self._style.usesTime() File "C:\Users\user\anaconda3\envs\paddle310\lib\logging\init__.py", line 424, in usesTime return self._fmt.find(self.asctime_search) >= 0 RecursionError: maximum recursion depth exceeded while calling a Python object 请尽量不要包含图片在问题中/Please try to not include the image in the issue.

Architecture: model_type: det algorithm: DB Transform: Backbone: name: MobileNetV3 scale: 0.5 model_name: large disable_se: True Neck: name: RSEFPN out_channels: 96 shortcut: True Head: name: DBHead k: 50

Loss: name: DBLoss balance_loss: true main_loss_type: DiceLoss alpha: 5 beta: 10 ohem_ratio: 3 Optimizer: name: Adam beta1: 0.9 beta2: 0.999 lr: name: Cosine learning_rate: 0.00005 warmup_epoch: 2 regularizer: name: L2 factor: 0 PostProcess: name: DBPostProcess thresh: 0.3 box_thresh: 0.6 max_candidates: 1000 unclip_ratio: 1.5 Metric: name: DetMetric main_indicator: hmean Train: dataset: name: SimpleDataSet data_dir: ./train_data/det label_file_list:

A123798qw commented 6 months ago

配置都是按照github上指示的,但不管是訓練哪個模型都是出現這樣狀況

也有試過 打开PaddleOCR下的ppocr\data\simple_dataset.py,头部增加: import sys sys.setrecursionlimit(3000) #设置递归深度 跟這個方法 代码在ppocr\data\simple_dataset.py的130行:

data = {'img_path': img_path, 'label': label} # 修改前 data = {'img_path': img_path, 'label': label.replace('\r', '')} # 修改后 ————————————————

                        版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/HEYUDAGE/article/details/126219497

UserWangZz commented 5 months ago

可能是numpy版本的问题,尝试降低版本或者升级版本 或者参考报错提示: AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool'?

allenpeng88 commented 4 months ago

配置都是按照github上指示的,但不管是訓練哪個模型都是出現這樣狀況

也有試過 打开PaddleOCR下的ppocr\data\simple_dataset.py,头部增加: import sys sys.setrecursionlimit(3000) #设置递归深度 跟這個方法 代码在ppocr\data\simple_dataset.py的130行:

data = {'img_path': img_path, 'label': label} # 修改前 data = {'img_path': img_path, 'label': label.replace('\r', '')} # 修改后 ————————————————

                        版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/HEYUDAGE/article/details/126219497

问题解决了没?我也试了,没有用样的。

aaptl commented 3 months ago

I think there is issue with transform method due to some reason its returning None so its calling again getitem due to that we are getting RecursionError: maximum recursion depth exceeded If someone can help that would be appreciated :)

xdfbb commented 2 months ago

可能是numpy版本的问题,尝试降低版本或者升级版本 或者参考报错提示: AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool'?

我切换到numpy到1.26版本貌似修复问题了,应该是numpy版本太高(1.20.x)了所导致的

SzYang721 commented 1 month ago

Here has the same problem. Have tried to downgrade numpy and added the sys.setrecursionlimit(3000).

The problem persists.

xdfbb commented 1 month ago

Here has the same problem. Have tried to downgrade numpy and added the sys.setrecursionlimit(3000).

The problem persists.

try 1.26?