使用ch_PP-OCRv4_rec.yml训练模型报错AttributeError: 'SimpleDataSet' object has no attribute 'ds_width' #13221
Unanswered
futureflsl
asked this question in
Q&A
Replies: 3 comments
-
You may need to try installing PaddleOCR from the |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
你是不是配置文件搞错了 PaddleOCR/configs/rec/PP-OCRv4/ch_PP-OCRv4_rec.yml Lines 76 to 77 in 4336771 这里是 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
问题描述 / Problem Description
使用ch_PP-OCRv4_rec.yml训练模型报错AttributeError: 'SimpleDataSet' object has no attribute 'ds_width'
运行环境 / Runtime Environment
复现代码 / Reproduction Code
完整报错 / Complete Error Message
python tools/train.py -c configs/rec/ch_PP-OCRv4_rec.yml -o Optimizer.base_lr=0.001
D:\anaconda3\envs\paddle\lib\site-packages\setuptools\sandbox.py:13: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
D:\anaconda3\envs\paddle\lib\site-packages\pkg_resources_init_.py:2871: DeprecationWarning: Deprecated call to
pkg_resources.declare_namespace('mpl_toolkits')
.Implementing implicit namespace packages (as specified in PEP 420) is preferred to
pkg_resources.declare_namespace
. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packagesdeclare_namespace(pkg)
D:\anaconda3\envs\paddle\lib\site-packages\pkg_resources_init_.py:2871: DeprecationWarning: Deprecated call to
pkg_resources.declare_namespace('google')
.Implementing implicit namespace packages (as specified in PEP 420) is preferred to
pkg_resources.declare_namespace
. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packagesdeclare_namespace(pkg)
[2024/06/29 16:33:18] ppocr INFO: Architecture :
[2024/06/29 16:33:18] ppocr INFO: Backbone :
[2024/06/29 16:33:18] ppocr INFO: name : PPLCNetV3
[2024/06/29 16:33:18] ppocr INFO: scale : 0.95
[2024/06/29 16:33:18] ppocr INFO: Head :
[2024/06/29 16:33:18] ppocr INFO: head_list :
[2024/06/29 16:33:18] ppocr INFO: CTCHead :
[2024/06/29 16:33:18] ppocr INFO: Head :
[2024/06/29 16:33:18] ppocr INFO: fc_decay : 1e-05
[2024/06/29 16:33:18] ppocr INFO: Neck :
[2024/06/29 16:33:18] ppocr INFO: depth : 2
[2024/06/29 16:33:18] ppocr INFO: dims : 120
[2024/06/29 16:33:18] ppocr INFO: hidden_dims : 120
[2024/06/29 16:33:18] ppocr INFO: kernel_size : [1, 3]
[2024/06/29 16:33:18] ppocr INFO: name : svtr
[2024/06/29 16:33:18] ppocr INFO: use_guide : True
[2024/06/29 16:33:18] ppocr INFO: NRTRHead :
[2024/06/29 16:33:18] ppocr INFO: max_text_length : 25
[2024/06/29 16:33:18] ppocr INFO: nrtr_dim : 384
[2024/06/29 16:33:18] ppocr INFO: name : MultiHead
[2024/06/29 16:33:18] ppocr INFO: Transform : None
[2024/06/29 16:33:18] ppocr INFO: algorithm : SVTR_LCNet
[2024/06/29 16:33:18] ppocr INFO: model_type : rec
[2024/06/29 16:33:18] ppocr INFO: Eval :
[2024/06/29 16:33:18] ppocr INFO: dataset :
[2024/06/29 16:33:18] ppocr INFO: data_dir : ./rec-fast-train/dataset/val/images
[2024/06/29 16:33:18] ppocr INFO: label_file_list : ['./rec-fast-train/dataset/val/val.txt']
[2024/06/29 16:33:18] ppocr INFO: name : SimpleDataSet
[2024/06/29 16:33:18] ppocr INFO: transforms :
[2024/06/29 16:33:18] ppocr INFO: DecodeImage :
[2024/06/29 16:33:18] ppocr INFO: channel_first : False
[2024/06/29 16:33:18] ppocr INFO: img_mode : BGR
[2024/06/29 16:33:18] ppocr INFO: MultiLabelEncode :
[2024/06/29 16:33:18] ppocr INFO: gtc_encode : NRTRLabelEncode
[2024/06/29 16:33:18] ppocr INFO: RecResizeImg :
[2024/06/29 16:33:18] ppocr INFO: image_shape : [3, 48, 320]
[2024/06/29 16:33:18] ppocr INFO: KeepKeys :
[2024/06/29 16:33:18] ppocr INFO: keep_keys : ['image', 'label_ctc', 'label_gtc', 'length', 'valid_ratio']
[2024/06/29 16:33:18] ppocr INFO: loader :
[2024/06/29 16:33:18] ppocr INFO: batch_size_per_card : 4
[2024/06/29 16:33:18] ppocr INFO: drop_last : False
[2024/06/29 16:33:18] ppocr INFO: num_workers : 1
[2024/06/29 16:33:18] ppocr INFO: shuffle : False
[2024/06/29 16:33:18] ppocr INFO: Global :
[2024/06/29 16:33:18] ppocr INFO: cal_metric_during_train : True
[2024/06/29 16:33:18] ppocr INFO: character_dict_path : C:/Users/Administrator/Desktop/PaddleOCR-2.7.5/rec-fast-train/mychars.txt
[2024/06/29 16:33:18] ppocr INFO: checkpoints : None
[2024/06/29 16:33:18] ppocr INFO: debug : False
[2024/06/29 16:33:18] ppocr INFO: distributed : False
[2024/06/29 16:33:18] ppocr INFO: epoch_num : 300
[2024/06/29 16:33:18] ppocr INFO: eval_batch_step : [0, 2000]
[2024/06/29 16:33:18] ppocr INFO: infer_img : doc/imgs_words/ch/word_1.jpg
[2024/06/29 16:33:18] ppocr INFO: infer_mode : False
[2024/06/29 16:33:18] ppocr INFO: log_smooth_window : 20
[2024/06/29 16:33:18] ppocr INFO: max_text_length : 25
[2024/06/29 16:33:18] ppocr INFO: pretrained_model : None
[2024/06/29 16:33:18] ppocr INFO: print_batch_step : 10
[2024/06/29 16:33:18] ppocr INFO: save_epoch_step : 5
[2024/06/29 16:33:18] ppocr INFO: save_inference_dir : None
[2024/06/29 16:33:18] ppocr INFO: save_model_dir : ./output/rec_ppocr_v4
[2024/06/29 16:33:18] ppocr INFO: save_res_path : ./output/rec/predicts_ppocrv3.txt
[2024/06/29 16:33:18] ppocr INFO: use_gpu : True
[2024/06/29 16:33:18] ppocr INFO: use_space_char : True
[2024/06/29 16:33:18] ppocr INFO: use_visualdl : False
[2024/06/29 16:33:18] ppocr INFO: Loss :
[2024/06/29 16:33:18] ppocr INFO: loss_config_list :
[2024/06/29 16:33:18] ppocr INFO: CTCLoss : None
[2024/06/29 16:33:18] ppocr INFO: NRTRLoss : None
[2024/06/29 16:33:18] ppocr INFO: name : MultiLoss
[2024/06/29 16:33:18] ppocr INFO: Metric :
[2024/06/29 16:33:18] ppocr INFO: main_indicator : acc
[2024/06/29 16:33:18] ppocr INFO: name : RecMetric
[2024/06/29 16:33:18] ppocr INFO: Optimizer :
[2024/06/29 16:33:18] ppocr INFO: base_lr : 0.001
[2024/06/29 16:33:18] ppocr INFO: beta1 : 0.9
[2024/06/29 16:33:18] ppocr INFO: beta2 : 0.999
[2024/06/29 16:33:18] ppocr INFO: lr :
[2024/06/29 16:33:18] ppocr INFO: learning_rate : 0.001
[2024/06/29 16:33:18] ppocr INFO: name : Cosine
[2024/06/29 16:33:18] ppocr INFO: warmup_epoch : 5
[2024/06/29 16:33:18] ppocr INFO: name : Adam
[2024/06/29 16:33:18] ppocr INFO: regularizer :
[2024/06/29 16:33:18] ppocr INFO: factor : 3e-05
[2024/06/29 16:33:18] ppocr INFO: name : L2
[2024/06/29 16:33:18] ppocr INFO: PostProcess :
[2024/06/29 16:33:18] ppocr INFO: name : CTCLabelDecode
[2024/06/29 16:33:18] ppocr INFO: Train :
[2024/06/29 16:33:18] ppocr INFO: dataset :
[2024/06/29 16:33:18] ppocr INFO: data_dir : ./rec-fast-train/dataset/train/images
[2024/06/29 16:33:18] ppocr INFO: ds_width : False
[2024/06/29 16:33:18] ppocr INFO: ext_op_transform_idx : 1
[2024/06/29 16:33:18] ppocr INFO: label_file_list : ['./rec-fast-train/dataset/train/train.txt']
[2024/06/29 16:33:18] ppocr INFO: name : SimpleDataSet
[2024/06/29 16:33:18] ppocr INFO: transforms :
[2024/06/29 16:33:18] ppocr INFO: DecodeImage :
[2024/06/29 16:33:18] ppocr INFO: channel_first : False
[2024/06/29 16:33:18] ppocr INFO: img_mode : BGR
[2024/06/29 16:33:18] ppocr INFO: RecConAug :
[2024/06/29 16:33:18] ppocr INFO: ext_data_num : 2
[2024/06/29 16:33:18] ppocr INFO: image_shape : [48, 320, 3]
[2024/06/29 16:33:18] ppocr INFO: max_text_length : 25
[2024/06/29 16:33:18] ppocr INFO: prob : 0.5
[2024/06/29 16:33:18] ppocr INFO: RecAug : None
[2024/06/29 16:33:18] ppocr INFO: MultiLabelEncode :
[2024/06/29 16:33:18] ppocr INFO: gtc_encode : NRTRLabelEncode
[2024/06/29 16:33:18] ppocr INFO: KeepKeys :
[2024/06/29 16:33:18] ppocr INFO: keep_keys : ['image', 'label_ctc', 'label_gtc', 'length', 'valid_ratio']
[2024/06/29 16:33:18] ppocr INFO: loader :
[2024/06/29 16:33:18] ppocr INFO: batch_size_per_card : 4
[2024/06/29 16:33:18] ppocr INFO: drop_last : True
[2024/06/29 16:33:18] ppocr INFO: num_workers : 1
[2024/06/29 16:33:18] ppocr INFO: shuffle : True
[2024/06/29 16:33:18] ppocr INFO: sampler :
[2024/06/29 16:33:18] ppocr INFO: divided_factor : [8, 16]
[2024/06/29 16:33:18] ppocr INFO: first_bs : 192
[2024/06/29 16:33:18] ppocr INFO: fix_bs : False
[2024/06/29 16:33:18] ppocr INFO: is_training : True
[2024/06/29 16:33:18] ppocr INFO: name : MultiScaleSampler
[2024/06/29 16:33:18] ppocr INFO: scales : [[320, 32], [320, 48], [320, 64]]
[2024/06/29 16:33:18] ppocr INFO: profiler_options : None
[2024/06/29 16:33:18] ppocr INFO: train with paddle 2.4.2 and device Place(gpu:0)
[2024/06/29 16:33:18] ppocr INFO: Initialize indexs of datasets:['./rec-fast-train/dataset/train/train.txt']
list index out of range
Traceback (most recent call last):
File "tools/train.py", line 229, in
main(config, device, logger, vdl_writer, seed)
File "tools/train.py", line 53, in main
train_dataloader = build_dataloader(config, 'Train', device, logger, seed)
File "C:\Users\Administrator\Desktop\PaddleOCR-2.7.5\ppocr\data_init_.py", line 123, in build_dataloader
batch_sampler = eval(sampler_name)(dataset, **config_sampler)
File "C:\Users\Administrator\Desktop\PaddleOCR-2.7.5\ppocr\data\multi_scale_sampler.py", line 32, in init
self.ds_width = data_source.ds_width
AttributeError: 'SimpleDataSet' object has no attribute 'ds_width'
可能解决方案 / Possible solutions
附件 / Appendix
Beta Was this translation helpful? Give feedback.
All reactions