PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

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

Open great-wind opened this issue 1 year ago • 3 comments

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

  • 系统环境/System Environment:Linux version 3.10.0-514.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) )
  • 版本号/Version:Paddle:2.4.2,PaddleOCR:2.7.0.3,问题相关组件/Related components:
  • 运行指令/Command Code:python tools/train.py -c configs/rec/rec_mv3_none_bilstm_ctc.yml
  • 完整报错/Complete Error Message:
[2023/10/27 10:57:17] ppocr INFO: Architecture : 
[2023/10/27 10:57:17] ppocr INFO:     Backbone : 
[2023/10/27 10:57:17] ppocr INFO:         model_name : large
[2023/10/27 10:57:17] ppocr INFO:         name : MobileNetV3
[2023/10/27 10:57:17] ppocr INFO:         scale : 0.5
[2023/10/27 10:57:17] ppocr INFO:     Head : 
[2023/10/27 10:57:17] ppocr INFO:         fc_decay : 0
[2023/10/27 10:57:17] ppocr INFO:         name : CTCHead
[2023/10/27 10:57:17] ppocr INFO:     Neck : 
[2023/10/27 10:57:17] ppocr INFO:         encoder_type : rnn
[2023/10/27 10:57:17] ppocr INFO:         hidden_size : 96
[2023/10/27 10:57:17] ppocr INFO:         name : SequenceEncoder
[2023/10/27 10:57:17] ppocr INFO:     Transform : None
[2023/10/27 10:57:17] ppocr INFO:     algorithm : CRNN
[2023/10/27 10:57:17] ppocr INFO:     model_type : rec
[2023/10/27 10:57:17] ppocr INFO: Eval : 
[2023/10/27 10:57:17] ppocr INFO:     dataset : 
[2023/10/27 10:57:17] ppocr INFO:         data_dir : ./rec_seal_real_straighten/test/
[2023/10/27 10:57:17] ppocr INFO:         label_file_list : ['./rec_seal_real_straighten/test.txt']
[2023/10/27 10:57:17] ppocr INFO:         name : SimpleDataSet
[2023/10/27 10:57:17] ppocr INFO:         transforms : 
[2023/10/27 10:57:17] ppocr INFO:             DecodeImage : 
[2023/10/27 10:57:17] ppocr INFO:                 channel_first : False
[2023/10/27 10:57:17] ppocr INFO:                 img_mode : BGR
[2023/10/27 10:57:17] ppocr INFO:             CTCLabelEncode : None
[2023/10/27 10:57:17] ppocr INFO:             RecResizeImg : 
[2023/10/27 10:57:17] ppocr INFO:                 image_shape : [3, 32, 100]
[2023/10/27 10:57:17] ppocr INFO:             KeepKeys : 
[2023/10/27 10:57:17] ppocr INFO:                 keep_keys : ['image', 'label', 'length']
[2023/10/27 10:57:17] ppocr INFO:     loader : 
[2023/10/27 10:57:17] ppocr INFO:         batch_size_per_card : 1
[2023/10/27 10:57:17] ppocr INFO:         drop_last : False
[2023/10/27 10:57:17] ppocr INFO:         num_workers : 1
[2023/10/27 10:57:17] ppocr INFO:         shuffle : False
[2023/10/27 10:57:17] ppocr INFO:         use_shared_memory : False
[2023/10/27 10:57:17] ppocr INFO: Global : 
[2023/10/27 10:57:17] ppocr INFO:     cal_metric_during_train : True
[2023/10/27 10:57:17] ppocr INFO:     character_dict_path : ppocr/utils/en_dict.txt
[2023/10/27 10:57:17] ppocr INFO:     checkpoints : None
[2023/10/27 10:57:17] ppocr INFO:     distributed : False
[2023/10/27 10:57:17] ppocr INFO:     epoch_num : 30
[2023/10/27 10:57:17] ppocr INFO:     eval_batch_step : [0, 135]
[2023/10/27 10:57:17] ppocr INFO:     infer_img : doc/imgs_words_en/word_10.png
[2023/10/27 10:57:17] ppocr INFO:     infer_mode : False
[2023/10/27 10:57:17] ppocr INFO:     log_smooth_window : 20
[2023/10/27 10:57:17] ppocr INFO:     max_text_length : 25
[2023/10/27 10:57:17] ppocr INFO:     pretrained_model : ./pretrain_models/rec_mv3_none_bilstm_ctc_v2.0_train/best_accuracy
[2023/10/27 10:57:17] ppocr INFO:     print_batch_step : 10
[2023/10/27 10:57:17] ppocr INFO:     save_epoch_step : 3
[2023/10/27 10:57:17] ppocr INFO:     save_inference_dir : ./
[2023/10/27 10:57:17] ppocr INFO:     save_model_dir : ./output/rec/mv3_none_bilstm_ctc/
[2023/10/27 10:57:17] ppocr INFO:     save_res_path : ./output/rec/predicts_ic15.txt
[2023/10/27 10:57:17] ppocr INFO:     use_gpu : True
[2023/10/27 10:57:17] ppocr INFO:     use_space_char : False
[2023/10/27 10:57:17] ppocr INFO:     use_visualdl : False
[2023/10/27 10:57:17] ppocr INFO: Loss : 
[2023/10/27 10:57:17] ppocr INFO:     name : CTCLoss
[2023/10/27 10:57:17] ppocr INFO: Metric : 
[2023/10/27 10:57:17] ppocr INFO:     main_indicator : acc
[2023/10/27 10:57:17] ppocr INFO:     name : RecMetric
[2023/10/27 10:57:17] ppocr INFO: Optimizer : 
[2023/10/27 10:57:17] ppocr INFO:     beta1 : 0.9
[2023/10/27 10:57:17] ppocr INFO:     beta2 : 0.999
[2023/10/27 10:57:17] ppocr INFO:     lr : 
[2023/10/27 10:57:17] ppocr INFO:         learning_rate : 0.0001
[2023/10/27 10:57:17] ppocr INFO:     name : Adam
[2023/10/27 10:57:17] ppocr INFO:     regularizer : 
[2023/10/27 10:57:17] ppocr INFO:         factor : 0
[2023/10/27 10:57:17] ppocr INFO:         name : L2
[2023/10/27 10:57:17] ppocr INFO: PostProcess : 
[2023/10/27 10:57:17] ppocr INFO:     name : CTCLabelDecode
[2023/10/27 10:57:17] ppocr INFO: Train : 
[2023/10/27 10:57:17] ppocr INFO:     dataset : 
[2023/10/27 10:57:17] ppocr INFO:         data_dir : ./rec_seal_real_straighten/train/
[2023/10/27 10:57:17] ppocr INFO:         label_file_list : ['./rec_seal_real_straighten/train.txt']
[2023/10/27 10:57:17] ppocr INFO:         name : SimpleDataSet
[2023/10/27 10:57:17] ppocr INFO:         transforms : 
[2023/10/27 10:57:17] ppocr INFO:             DecodeImage : 
[2023/10/27 10:57:17] ppocr INFO:                 channel_first : False
[2023/10/27 10:57:17] ppocr INFO:                 img_mode : BGR
[2023/10/27 10:57:17] ppocr INFO:             CTCLabelEncode : None
[2023/10/27 10:57:17] ppocr INFO:             RecResizeImg : 
[2023/10/27 10:57:17] ppocr INFO:                 image_shape : [3, 32, 100]
[2023/10/27 10:57:17] ppocr INFO:             KeepKeys : 
[2023/10/27 10:57:17] ppocr INFO:                 keep_keys : ['image', 'label', 'length']
[2023/10/27 10:57:17] ppocr INFO:     loader : 
[2023/10/27 10:57:17] ppocr INFO:         batch_size_per_card : 9
[2023/10/27 10:57:17] ppocr INFO:         drop_last : True
[2023/10/27 10:57:17] ppocr INFO:         num_workers : 1
[2023/10/27 10:57:17] ppocr INFO:         shuffle : True
[2023/10/27 10:57:17] ppocr INFO:         use_shared_memory : False
[2023/10/27 10:57:17] ppocr INFO: profiler_options : None
[2023/10/27 10:57:17] ppocr INFO: train with paddle 2.4.2 and device Place(gpu:0)
[2023/10/27 10:57:17] ppocr INFO: Initialize indexs of datasets:['./rec_seal_real_straighten/train.txt']
[2023/10/27 10:57:17] ppocr INFO: Initialize indexs of datasets:['./rec_seal_real_straighten/test.txt']
[2023/10/27 10:57:19] ppocr INFO: train dataloader has 135 iters
[2023/10/27 10:57:19] ppocr INFO: valid dataloader has 224 iters
[2023/10/27 10:57:19] ppocr WARNING: The shape of model params head.fc.bias [96] not matched with loaded params head.fc.bias [37] !
[2023/10/27 10:57:19] ppocr WARNING: The shape of model params head.fc.weight [192, 96] not matched with loaded params head.fc.weight [192, 37] !
[2023/10/27 10:57:19] ppocr INFO: load pretrain successful from ./pretrain_models/rec_mv3_none_bilstm_ctc_v2.0_train/best_accuracy
[2023/10/27 10:57:19] ppocr INFO: During the training process, after the 0th iteration, an evaluation is run every 135 iterations
[2023/10/27 10:57:25] ppocr ERROR: When parsing line 0829_0.png	科技有限公司
, error happened with msg: Traceback (most recent call last):
  File "/home/liguobao/PaddleOCR/ppocr/data/simple_dataset.py", line 157, in __getitem__
    data['image'] = img
RecursionError: maximum recursion depth exceeded while calling a Python object

我们提供了AceIssueSolver来帮助你解答问题,你是否想要它来解答(请填写yes/no)?/We provide AceIssueSolver to solve issues, do you want it? (Please write yes/no): no

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

great-wind avatar Oct 27 '23 07:10 great-wind