首页 Paddle框架 帖子详情
[初学者]ppocr 识别模型训练加载dataSet 时crash
收藏
快速回复
Paddle框架 问答模型训练 803 2
[初学者]ppocr 识别模型训练加载dataSet 时crash
收藏
快速回复
Paddle框架 问答模型训练 803 2

使用ppocrLabel标记后生成的训练集,启动识别训练时直接crash (大概追了下源码似乎是在数据增强处理后挂了)每次crash前parse的数据行是随机的,没查明白是怎么回事。 在社区看到一个类似的帖子,说是数据集的问题(没具体说明),有大佬指点下吗? 数据集是ppocrLabel标记生成的,格式没认为调整过。  (注: 最开始是使用自己生成的标记数据,也会出现这个问题, 后来使用ppocrLabel标记的数据发现也有这个问题)

[2023/04/09 17:49:39] ppocr INFO: profiler_options : None
[2023/04/09 17:49:39] ppocr INFO: train with paddle 2.4.2 and device Place(gpu:0)
[2023/04/09 17:49:39] ppocr INFO: Initialize indexs of datasets:['./train_data/rec/train.txt']
[2023/04/09 17:49:39] ppocr INFO: Initialize indexs of datasets:['./train_data/rec/val.txt']
W0409 17:49:39.314785 3418786 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.6, Runtime API Version: 11.6
W0409 17:49:39.319849 3418786 gpu_resources.cc:91] device: 0, cuDNN Version: 8.4.
[2023/04/09 17:49:40] ppocr INFO: train dataloader has 18 iters
[2023/04/09 17:49:40] ppocr INFO: valid dataloader has 7 iters
[2023/04/09 17:49:40] ppocr WARNING: The shape of model params head.ctc_head.fc.weight [64, 96] not matched with loaded params head.ctc_head.fc.weight [64, 97] !
[2023/04/09 17:49:40] ppocr WARNING: The shape of model params head.ctc_head.fc.bias [96] not matched with loaded params head.ctc_head.fc.bias [97] !
[2023/04/09 17:49:40] ppocr WARNING: The shape of model params head.sar_head.decoder.embedding.weight [98, 512] not matched with loaded params head.sar_head.decoder.embedding.weight [99, 512] !
[2023/04/09 17:49:40] ppocr WARNING: The shape of model params head.sar_head.decoder.prediction.weight [1536, 97] not matched with loaded params head.sar_head.decoder.prediction.weight [1536, 98] !
[2023/04/09 17:49:40] ppocr WARNING: The shape of model params head.sar_head.decoder.prediction.bias [97] not matched with loaded params head.sar_head.decoder.prediction.bias [98] !
[2023/04/09 17:49:40] ppocr INFO: load pretrain successful from ./pretrain_models/en_PP-OCRv3_rec_train/best_accuracy
[2023/04/09 17:49:40] ppocr INFO: During the training process, after the 0th iteration, an evaluation is run every 700 iterations
[2023/04/09 17:50:35] ppocr ERROR: When parsing line /home/judy/ppOCR/PaddleOCR-release-2.6/train_data/rec/train/20151016100404_WHITE_crop_1.jpg E606416634CHN6508221F2510147LCNMMBKCL0PNA978
, error happened with msg: Traceback (most recent call last):
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/simple_dataset.py", line 137, in __getitem__
outs = transform(data, self.ops)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/__init__.py", line 57, in transform
data = op(data)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/rec_img_aug.py", line 47, in __call__
img = tia_distort(img, random.randint(3, 6))
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/text_image_aug/augment.py", line 60, in tia_distort
dst = trans.generate()
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/text_image_aug/warp_mls.py", line 42, in generate
return self.gen_img()
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/text_image_aug/warp_mls.py", line 148, in gen_img
nx = np.clip(nx, 0, src_w - 1)
File "<__array_function__ internals>", line 180, in clip
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 2154, in clip
return _wrapfunc(a, 'clip', a_min, a_max, out=out, **kwargs)
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc
return bound(*args, **kwds)
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/_methods.py", line 135, in _clip
if _clip_dep_is_scalar_nan(min):
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/_methods.py", line 95, in _clip_dep_is_scalar_nan
if ndim(a) != 0:
File "<__array_function__ internals>", line 180, in ndim
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 3154, in ndim
return a.ndim
RecursionError: maximum recursion depth exceeded while calling a Python object

[2023/04/09 17:50:36] ppocr ERROR: When parsing line /home/judy/ppOCR/PaddleOCR-release-2.6/train_data/rec/train/20151016092733_OFF_crop_1.jpg E606407766CHN9210055F2510147LCMMNHNKNA0DA912
, error happened with msg: Traceback (most recent call last):
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/simple_dataset.py", line 137, in __getitem__
outs = transform(data, self.ops)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/__init__.py", line 57, in transform
data = op(data)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/rec_img_aug.py", line 47, in __call__
img = tia_distort(img, random.randint(3, 6))
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/text_image_aug/augment.py", line 60, in tia_distort
dst = trans.generate()
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/text_image_aug/warp_mls.py", line 42, in generate
return self.gen_img()
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/text_image_aug/warp_mls.py", line 148, in gen_img
nx = np.clip(nx, 0, src_w - 1)
File "<__array_function__ internals>", line 180, in clip
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 2154, in clip
return _wrapfunc(a, 'clip', a_min, a_max, out=out, **kwargs)
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc
return bound(*args, **kwds)
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/_methods.py", line 135, in _clip
if _clip_dep_is_scalar_nan(min):
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/_methods.py", line 95, in _clip_dep_is_scalar_nan
if ndim(a) != 0:
File "<__array_function__ internals>", line 180, in ndim
RecursionError: maximum recursion depth exceeded

[2023/04/09 17:50:37] ppocr ERROR: When parsing line /home/judy/ppOCR/PaddleOCR-release-2.6/train_data/rec/train/20151016101327_WHITE_crop_0.jpg POCHNYU<, error happened with msg: Traceback (most recent call last):
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/simple_dataset.py", line 137, in __getitem__
outs = transform(data, self.ops)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/__init__.py", line 57, in transform
data = op(data)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/rec_img_aug.py", line 53, in __call__
data = self.bda(data)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/rec_img_aug.py", line 90, in __call__
img = add_gasuss_noise(img)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/rec_img_aug.py", line 722, in add_gasuss_noise
out = np.clip(out, 0, 255)
File "<__array_function__ internals>", line 180, in clip
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 2154, in clip
return _wrapfunc(a, 'clip', a_min, a_max, out=out, **kwargs)
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc
return bound(*args, **kwds)
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/_methods.py", line 135, in _clip
if _clip_dep_is_scalar_nan(min):
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/_methods.py", line 95, in _clip_dep_is_scalar_nan
if ndim(a) != 0:
File "<__array_function__ internals>", line 180, in ndim
RecursionError: maximum recursion depth exceeded while calling a Python object

[2023/04/09 17:50:38] ppocr ERROR: When parsing line /home/judy/ppOCR/PaddleOCR-release-2.6/train_data/rec/train/20151016093540_OFF_crop_1.jpg E606409128CHN8902052M2510147NA0MPGM0<<<, error happened with msg: Traceback (most recent call last):
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/simple_dataset.py", line 137, in __getitem__
outs = transform(data, self.ops)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/__init__.py", line 57, in transform
data = op(data)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/rec_img_aug.py", line 53, in __call__
data = self.bda(data)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/rec_img_aug.py", line 90, in __call__
img = add_gasuss_noise(img)
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/rec_img_aug.py", line 722, in add_gasuss_noise
out = np.clip(out, 0, 255)
File "<__array_function__ internals>", line 180, in clip
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 2154, in clip
return _wrapfunc(a, 'clip', a_min, a_max, out=out, **kwargs)
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc
return bound(*args, **kwds)
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/_methods.py", line 135, in _clip
if _clip_dep_is_scalar_nan(min):
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/_methods.py", line 95, in _clip_dep_is_scalar_nan
if ndim(a) != 0:
File "<__array_function__ internals>", line 180, in ndim
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 3154, in ndim
return a.ndim
RecursionError: maximum recursion depth exceeded while calling a Python object

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

Current thread 0x00007f3bb27434c0 (most recent call first):
File "<__array_function__ internals>", line 180 in ndim
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/_methods.py", line 95 in _clip_dep_is_scalar_nan
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/_methods.py", line 135 in _clip
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 57 in _wrapfunc
File "/home/judy/.conda/envs/ppocr_py3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 2154 in clip
File "<__array_function__ internals>", line 180 in clip
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/text_image_aug/warp_mls.py", line 148 in gen_img
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/text_image_aug/warp_mls.py", line 42 in generate
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/text_image_aug/augment.py", line 60 in tia_distort
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/rec_img_aug.py", line 47 in __call__
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/imaug/__init__.py", line 57 in transform
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/simple_dataset.py", line 137 in __getitem__
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/simple_dataset.py", line 147 in __getitem__
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/simple_dataset.py", line 147 in __getitem__
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/simple_dataset.py", line 147 in __getitem__
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/simple_dataset.py", line 147 in __getitem__
File "/home/judy/ppOCR/PaddleOCR-release-2.6/ppocr/data/simple_dataset.py", line 147 in __getitem__

0
收藏
回复
全部评论(2)
时间顺序
x
xpp123www
#2 回复于2023-04

同事协助解决了, 配置文件中的max_text_length的长度 与 标记文件中的文本长度不匹配导致的(实际识别长度>配置文件的长度) 

1
回复
达拉崩吧贝比
#3 回复于2024-03
同事协助解决了, 配置文件中的max_text_length的长度 与 标记文件中的文本长度不匹配导致的(实际识别长度>配置文件的长度) 

改了之后还是这个错误怎么办啊

 

0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户