Closed davidzhr closed 1 year ago
@tink2123
我用的配置文件是 SLANet.yml 这个配置文件是两个数据集,train 和 val, 原始的数据库, 我应该如何分配一下, 数据清洗成配置文件需要的格式?
可以根据PubTabNet_2.0.0.jsonl中的split字段进行处理,拆分成train val test三部分
C: cd C:\F\PaddleOCR-release-2.6 py -3 tools/train.py -c C:/F/SLANet_ch_border.yml -o Global.epoch_num=1 Global.pretrained_model="C:/Users/Administrator/Desktop/tableBorder/best_accuracy" Train.dataset.name='PubTabDataSet' Eval.dataset.name='PubTabDataSet' Train.dataset.data_dir='C:/F/wtw/pubtabnet/val/' Train.dataset.label_file_list=[C:/F/WTW/PubTabNet_2.0.0_val.jsonl] Eval.dataset.data_dir='C:/F/wtw/pubtabnet/val/' Eval.dataset.label_file_list=[C:/F/WTW/PubTabNet_2.0.0_val.jsonl] Train.loader.num_workers=0 Global.use_gpu=True Global.save_epoch_step=2000 Global.character_dict_path='C:/Users/Administrator/Desktop/tableBorder/table_structure_dict_ch_99span.txt' Global.eval_batch_step=[0,2000] Global.print_batch_step=100 Global.save_model_dir="C:/Users/Administrator/Desktop/tableBorder" Train.loader.batch_size_per_card=8 Train.loader.num_workers=0 Eval.loader.batch_size_per_card=8 Eval.loader.num_workers=0 Optimizer.lr.name=Const Optimizer.lr.learning_rate=0.0005
jsonl中单元格坐标和paddle的对不上,导致上面报错。怎么解决?
jjson坐标是4个数,paddlelabel是四个点,8个数
{"imgid": 548625, "html": {"cells": [{"tokens": []}, {"tokens": ["", "W", "e", "a", "n", "i", "n", "g", ""], "bbox": [66, 4, 96, 13]}, {"tokens": ["", "W", "e", "e", "k", " ", "1", "5", ""], "bbox": [131, 4, 160, 13]}, {"tokens": ["", "O", "f", "f", "-", "t", "e", "s", "t", ""], "bbox": [201, 4, 226, 13]}, {"tokens": ["W", "e", "a", "n", "i", "n", "g"], "bbox": [1, 17, 31, 26]}, {"tokens": ["–"], "bbox": [66, 21, 72, 25]}, {"tokens": ["–"], "bbox": [131, 21, 137, 25]}, {"tokens": ["–"], "bbox": [201, 21, 207, 25]}, {"tokens": ["W", "e", "e", "k", " ", "1", "5"], "bbox": [1, 31, 30, 40]}, {"tokens": ["–"], "bbox": [66, 35, 72, 39]}, {"tokens": ["0", ".", "1", "7", " ", "±", " ", "0", ".", "0", "8"], "bbox": [131, 31, 166, 40]}, {"tokens": ["0", ".", "1", "6", " ", "±", " ", "0", ".", "0", "3"], "bbox": [201, 31, 236, 40]}, {"tokens": ["O", "f", "f", "-", "t", "e", "s", "t"], "bbox": [1, 45, 26, 54]}, {"tokens": ["–"], "bbox": [66, 49, 72, 53]}, {"tokens": ["0", ".", "8", "0", " ", "±", " ", "0", ".", "2", "4"], "bbox": [131, 45, 166, 54]}, {"tokens": ["0", ".", "1", "9", " ", "±", " ", "0", ".", "0", "9"], "bbox": [201, 45, 236, 54]}], "structure": {"tokens": ["", "", " ", "", "", " ", "", " ", "", " ", "", " ", "
请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem
系统环境/System Environment: Global/jupyterlab-paddlepaddle:2.1-cuda11.2-cudnn8_py37
版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components: PaddleOCR 2.6.0
运行指令/Command Code: python3 tools/train.py -c configs/table/SLANet.yml
完整报错/Complete Error Message: bml@jupyter-81f6137aa990a1ed-0:~/zhr/PaddleOCR$ python3 tools/train.py -c configs/table/SLANet.yml [2022/12/28 11:25:44] ppocr INFO: Architecture : [2022/12/28 11:25:44] ppocr INFO: Backbone : [2022/12/28 11:25:44] ppocr INFO: name : PPLCNet [2022/12/28 11:25:44] ppocr INFO: pretrained : True [2022/12/28 11:25:44] ppocr INFO: scale : 1.0 [2022/12/28 11:25:44] ppocr INFO: use_ssld : True [2022/12/28 11:25:44] ppocr INFO: Head : [2022/12/28 11:25:44] ppocr INFO: hidden_size : 256 [2022/12/28 11:25:44] ppocr INFO: loc_reg_num : 4 [2022/12/28 11:25:44] ppocr INFO: max_text_length : 500 [2022/12/28 11:25:44] ppocr INFO: name : SLAHead [2022/12/28 11:25:44] ppocr INFO: Neck : [2022/12/28 11:25:44] ppocr INFO: name : CSPPAN [2022/12/28 11:25:44] ppocr INFO: out_channels : 96 [2022/12/28 11:25:44] ppocr INFO: algorithm : SLANet [2022/12/28 11:25:44] ppocr INFO: model_type : table [2022/12/28 11:25:44] ppocr INFO: Eval : [2022/12/28 11:25:44] ppocr INFO: dataset : [2022/12/28 11:25:44] ppocr INFO: data_dir : train_data/table/pubtabnet/val/ [2022/12/28 11:25:44] ppocr INFO: label_file_list : ['train_data/table/pubtabnet/PubTabNet_2.0.0_val.jsonl'] [2022/12/28 11:25:44] ppocr INFO: name : PubTabDataSet [2022/12/28 11:25:44] ppocr INFO: transforms : [2022/12/28 11:25:44] ppocr INFO: DecodeImage : [2022/12/28 11:25:44] ppocr INFO: channel_first : False [2022/12/28 11:25:44] ppocr INFO: img_mode : BGR [2022/12/28 11:25:44] ppocr INFO: TableLabelEncode : [2022/12/28 11:25:44] ppocr INFO: learn_empty_box : False [2022/12/28 11:25:44] ppocr INFO: loc_reg_num : 4 [2022/12/28 11:25:44] ppocr INFO: max_text_length : 500 [2022/12/28 11:25:44] ppocr INFO: merge_no_span_structure : True [2022/12/28 11:25:44] ppocr INFO: replace_empty_cell_token : False [2022/12/28 11:25:44] ppocr INFO: TableBoxEncode : [2022/12/28 11:25:44] ppocr INFO: in_box_format : xyxy [2022/12/28 11:25:44] ppocr INFO: out_box_format : xyxy [2022/12/28 11:25:44] ppocr INFO: ResizeTableImage : [2022/12/28 11:25:44] ppocr INFO: max_len : 488 [2022/12/28 11:25:44] ppocr INFO: NormalizeImage : [2022/12/28 11:25:44] ppocr INFO: mean : [0.485, 0.456, 0.406] [2022/12/28 11:25:44] ppocr INFO: order : hwc [2022/12/28 11:25:44] ppocr INFO: scale : 1./255. [2022/12/28 11:25:44] ppocr INFO: std : [0.229, 0.224, 0.225] [2022/12/28 11:25:44] ppocr INFO: PaddingTableImage : [2022/12/28 11:25:44] ppocr INFO: size : [488, 488] [2022/12/28 11:25:44] ppocr INFO: ToCHWImage : None [2022/12/28 11:25:44] ppocr INFO: KeepKeys : [2022/12/28 11:25:44] ppocr INFO: keep_keys : ['image', 'structure', 'bboxes', 'bbox_masks', 'shape'] [2022/12/28 11:25:44] ppocr INFO: loader : [2022/12/28 11:25:44] ppocr INFO: batch_size_per_card : 48 [2022/12/28 11:25:44] ppocr INFO: drop_last : False [2022/12/28 11:25:44] ppocr INFO: num_workers : 1 [2022/12/28 11:25:44] ppocr INFO: shuffle : False [2022/12/28 11:25:44] ppocr INFO: Global : [2022/12/28 11:25:44] ppocr INFO: box_format : xyxy [2022/12/28 11:25:44] ppocr INFO: cal_metric_during_train : True [2022/12/28 11:25:44] ppocr INFO: character_dict_path : ppocr/utils/dict/table_structure_dict.txt [2022/12/28 11:25:44] ppocr INFO: character_type : en [2022/12/28 11:25:44] ppocr INFO: checkpoints : None [2022/12/28 11:25:44] ppocr INFO: distributed : False [2022/12/28 11:25:44] ppocr INFO: epoch_num : 100 [2022/12/28 11:25:44] ppocr INFO: eval_batch_step : [0, 1000] [2022/12/28 11:25:44] ppocr INFO: infer_img : doc/table/table.jpg [2022/12/28 11:25:44] ppocr INFO: infer_mode : False [2022/12/28 11:25:44] ppocr INFO: log_smooth_window : 20 [2022/12/28 11:25:44] ppocr INFO: max_text_length : 500 [2022/12/28 11:25:44] ppocr INFO: pretrained_model : None [2022/12/28 11:25:44] ppocr INFO: print_batch_step : 20 [2022/12/28 11:25:44] ppocr INFO: save_epoch_step : 400 [2022/12/28 11:25:44] ppocr INFO: save_inference_dir : ./output/SLANet/infer [2022/12/28 11:25:44] ppocr INFO: save_model_dir : ./output/SLANet [2022/12/28 11:25:44] ppocr INFO: save_res_path : output/infer [2022/12/28 11:25:44] ppocr INFO: use_gpu : True [2022/12/28 11:25:44] ppocr INFO: use_sync_bn : True [2022/12/28 11:25:44] ppocr INFO: use_visualdl : False [2022/12/28 11:25:44] ppocr INFO: Loss : [2022/12/28 11:25:44] ppocr INFO: loc_loss : smooth_l1 [2022/12/28 11:25:44] ppocr INFO: loc_weight : 2.0 [2022/12/28 11:25:44] ppocr INFO: name : SLALoss [2022/12/28 11:25:44] ppocr INFO: structure_weight : 1.0 [2022/12/28 11:25:44] ppocr INFO: Metric : [2022/12/28 11:25:44] ppocr INFO: box_format : xyxy [2022/12/28 11:25:44] ppocr INFO: compute_bbox_metric : False [2022/12/28 11:25:44] ppocr INFO: loc_reg_num : 4 [2022/12/28 11:25:44] ppocr INFO: main_indicator : acc [2022/12/28 11:25:44] ppocr INFO: name : TableMetric [2022/12/28 11:25:44] ppocr INFO: Optimizer : [2022/12/28 11:25:44] ppocr INFO: beta1 : 0.9 [2022/12/28 11:25:44] ppocr INFO: beta2 : 0.999 [2022/12/28 11:25:44] ppocr INFO: clip_norm : 5.0 [2022/12/28 11:25:44] ppocr INFO: lr : [2022/12/28 11:25:44] ppocr INFO: decay_epochs : [40, 50] [2022/12/28 11:25:44] ppocr INFO: learning_rate : 0.001 [2022/12/28 11:25:44] ppocr INFO: name : Piecewise [2022/12/28 11:25:44] ppocr INFO: values : [0.001, 0.0001, 5e-05] [2022/12/28 11:25:44] ppocr INFO: name : Adam [2022/12/28 11:25:44] ppocr INFO: regularizer : [2022/12/28 11:25:44] ppocr INFO: factor : 0.0 [2022/12/28 11:25:44] ppocr INFO: name : L2 [2022/12/28 11:25:44] ppocr INFO: PostProcess : [2022/12/28 11:25:44] ppocr INFO: merge_no_span_structure : True [2022/12/28 11:25:44] ppocr INFO: name : TableLabelDecode [2022/12/28 11:25:44] ppocr INFO: Train : [2022/12/28 11:25:44] ppocr INFO: dataset : [2022/12/28 11:25:44] ppocr INFO: data_dir : train_data/table/pubtabnet/train/ [2022/12/28 11:25:44] ppocr INFO: label_file_list : ['train_data/table/pubtabnet/PubTabNet_2.0.0_train.jsonl'] [2022/12/28 11:25:44] ppocr INFO: name : PubTabDataSet [2022/12/28 11:25:44] ppocr INFO: transforms : [2022/12/28 11:25:44] ppocr INFO: DecodeImage : [2022/12/28 11:25:44] ppocr INFO: channel_first : False [2022/12/28 11:25:44] ppocr INFO: img_mode : BGR [2022/12/28 11:25:44] ppocr INFO: TableLabelEncode : [2022/12/28 11:25:44] ppocr INFO: learn_empty_box : False [2022/12/28 11:25:44] ppocr INFO: loc_reg_num : 4 [2022/12/28 11:25:44] ppocr INFO: max_text_length : 500 [2022/12/28 11:25:44] ppocr INFO: merge_no_span_structure : True [2022/12/28 11:25:44] ppocr INFO: replace_empty_cell_token : False [2022/12/28 11:25:44] ppocr INFO: TableBoxEncode : [2022/12/28 11:25:44] ppocr INFO: in_box_format : xyxy [2022/12/28 11:25:44] ppocr INFO: out_box_format : xyxy [2022/12/28 11:25:44] ppocr INFO: ResizeTableImage : [2022/12/28 11:25:44] ppocr INFO: max_len : 488 [2022/12/28 11:25:44] ppocr INFO: NormalizeImage : [2022/12/28 11:25:44] ppocr INFO: mean : [0.485, 0.456, 0.406] [2022/12/28 11:25:44] ppocr INFO: order : hwc [2022/12/28 11:25:44] ppocr INFO: scale : 1./255. [2022/12/28 11:25:44] ppocr INFO: std : [0.229, 0.224, 0.225] [2022/12/28 11:25:44] ppocr INFO: PaddingTableImage : [2022/12/28 11:25:44] ppocr INFO: size : [488, 488] [2022/12/28 11:25:44] ppocr INFO: ToCHWImage : None [2022/12/28 11:25:44] ppocr INFO: KeepKeys : [2022/12/28 11:25:44] ppocr INFO: keep_keys : ['image', 'structure', 'bboxes', 'bbox_masks', 'shape'] [2022/12/28 11:25:44] ppocr INFO: loader : [2022/12/28 11:25:44] ppocr INFO: batch_size_per_card : 48 [2022/12/28 11:25:44] ppocr INFO: drop_last : True [2022/12/28 11:25:44] ppocr INFO: num_workers : 1 [2022/12/28 11:25:44] ppocr INFO: shuffle : True [2022/12/28 11:25:44] ppocr INFO: profiler_options : None [2022/12/28 11:25:44] ppocr INFO: train with paddle 2.1.3 and device CUDAPlace(0) [2022/12/28 11:25:44] ppocr INFO: Initialize indexs of datasets:['train_data/table/pubtabnet/PubTabNet_2.0.0_train.jsonl'] Traceback (most recent call last): File "tools/train.py", line 202, in
main(config, device, logger, vdl_writer)
File "tools/train.py", line 52, in main
train_dataloader = build_dataloader(config, 'Train', device, logger)
File "/home/bml/zhr/PaddleOCR/ppocr/data/init.py", line 66, in build_dataloader
dataset = eval(module_name)(config, mode, logger, seed)
File "/home/bml/zhr/PaddleOCR/ppocr/data/pubtab_dataset.py", line 49, in init
self.data_lines = self.get_image_info_list(label_file_list, ratio_list)
File "/home/bml/zhr/PaddleOCR/ppocr/data/pubtab_dataset.py", line 62, in get_image_info_list
with open(file, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'train_data/table/pubtabnet/PubTabNet_2.0.0_train.jsonl'
我是下载的数据集 PubTabNet 数据集(https://github.com/ibm-aur-nlp/PubTabNet), 数据集中的文件如下:
bml@jupyter-81f6137aa990a1ed-0:~/storage/pubtabnet$ ls -al total 4003998 drwxr-xr-x 5 bml bml 4096 Jul 21 2020 . drwxr-xr-x 7 bml bml 4096 Dec 28 10:24 .. -rw-r--r-- 1 bml bml 4076381813 Jul 8 2020 PubTabNet_2.0.0.jsonl drwxr-xr-x 3 bml bml 430080 Dec 28 09:53 test drwxr-xr-x 2 bml bml 22851584 Jul 21 2020 train drwxr-xr-x 2 bml bml 421888 Jul 21 2020 val
可以看到数据集总确实没有报错的文件, 请问如何处理?