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.25k stars 7.82k forks source link

方向分类器训练出现的问题 #3438

Closed wu-yakun closed 3 years ago

wu-yakun commented 3 years ago

方向分类器的训练txt文件如下图所示: 3ebff81e36b04fd68a9c61ed45f2921

问题:训练txt文件中加上标签是180度的图片,训练就报错,报错内容如下图所示: 2d087b5ae1d1e0569a4a23df395ed79 错误意思是:调用Python对象时超出了最大递归深度,致命的Python错误:无法从堆栈溢出中恢复。

若是把标签是180度的图片去除,训练就正常。此时的训练txt文件如下图所示: 3b6b8310dabba7166c9e7010a85a163

这个问题好奇怪,请小哥哥小姐姐指导下,不胜感激。

WenmuZhou commented 3 years ago

你的config贴上来看看

wu-yakun commented 3 years ago

`Global: use_gpu: true epoch_num: 100 log_smooth_window: 20 print_batch_step: 10 save_model_dir: ./trained_model/cls/ save_epoch_step: 120 eval_batch_step: [0, 1000] cal_metric_during_train: True pretrained_model: checkpoints: save_inference_dir: use_visualdl: False infer_img: doc/imgs_words_en/word_10.png label_list: ['0','180']

Architecture: model_type: cls algorithm: CLS Transform: Backbone: name: MobileNetV3 scale: 0.35 model_name: small Neck: Head: name: ClsHead class_dim: 2

Loss: name: ClsLoss

Optimizer: name: Adam beta1: 0.9 beta2: 0.999 lr: name: Cosine learning_rate: 0.001 regularizer: name: 'L2' factor: 0

PostProcess: name: ClsPostProcess

Metric: name: ClsMetric main_indicator: acc

Train: dataset: name: SimpleDataSet data_dir: ./train_data/character_cls/ label_file_list:

Eval: dataset: name: SimpleDataSet data_dir: ./train_data/character_cls/ label_file_list:

wu-yakun commented 3 years ago

配置文件如上所示。

WenmuZhou commented 3 years ago

看起来是解析180的时候报错了,然后就循环解析去了,你在simpledataset的getitem函数里debug一下看看哪里报错了

wu-yakun commented 3 years ago

感谢大佬,解决了,问题就出在getitem函数中!

WenmuZhou commented 3 years ago

能描述一下是啥错误吗

Jackzhangfei commented 2 years ago

请问一下是如何解决的呢

aaaaalun commented 1 year ago

直接修改代码,让角度的字符串里面没有\r即可。

LWQ2EDU commented 10 months ago

直接修改代码,让角度的字符串里面没有\r即可。

把标注文件中的换行符都换成\r解决了