| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- Global:
- model_name: SLANet_plus # To use static model for inference.
- use_gpu: False # 使用CPU
- epoch_num: 8 # 可适当增加训练轮数
- log_smooth_window: 10 # 日志平滑窗口
- print_batch_step: 10 # 每10个batch打印一次日志
- save_model_dir: ./output/SLANet_plus
- save_epoch_step: 2 # 每2个epoch保存一次模型
- # evaluation is run every 331 iterations after the 0th iteration
- eval_batch_step: [0, 50] # 更频繁评估
- cal_metric_during_train: True
- pretrained_model: "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_pretrained_model/SLANet_plus_pretrained.pdparams"
- checkpoints:
- save_inference_dir: ./output/SLANet_plus/infer
- use_visualdl: False
- infer_img: paddlex/repo_manager/repos/PaddleOCR/ppstructure/docs/table/table.jpg
- # for data or label process
- character_dict_path: paddlex/repo_manager/repos/PaddleOCR/ppocr/utils/dict/table_structure_dict_ch.txt
- character_type: en
- max_text_length: &max_text_length 500
- box_format: &box_format xyxyxyxy # 'xywh', 'xyxy', 'xyxyxyxy'
- infer_mode: False
- use_sync_bn: False # 是否使用同步BN, Mac必须关闭
- save_res_path: output/infer
- d2s_train_image_shape: [3, 488, 488]
- Optimizer:
- name: Adam
- beta1: 0.9
- beta2: 0.999
- clip_norm: 5.0
- lr:
- learning_rate: 0.0008 # 微调学习率
- regularizer:
- name: 'L2'
- factor: 0.00000
- Architecture:
- model_type: table
- algorithm: SLANet
- Backbone:
- name: PPLCNet
- scale: 1.0
- pretrained: True
- use_ssld: True
- Neck:
- name: CSPPAN
- out_channels: 96
- Head:
- name: SLAHead
- hidden_size: 256
- max_text_length: *max_text_length
- loc_reg_num: &loc_reg_num 8
- Loss:
- name: SLALoss
- structure_weight: 1.0
- loc_weight: 2.0
- loc_loss: smooth_l1
- PostProcess:
- name: TableLabelDecode
- merge_no_span_structure: &merge_no_span_structure True
- Metric:
- name: TableMetric
- main_indicator: acc
- compute_bbox_metric: False
- loc_reg_num: *loc_reg_num
- box_format: *box_format
- del_thead_tbody: True
- Train:
- dataset:
- name: PubTabDataSet
- data_dir: dataset/table_rec_dataset_examples/ # ✅ 正确路径
- label_file_list: [dataset/table_rec_dataset_examples/train.txt] # ✅ 正确文件
- transforms:
- - DecodeImage:
- img_mode: BGR
- channel_first: False
- - TableLabelEncode:
- learn_empty_box: False
- merge_no_span_structure: *merge_no_span_structure
- replace_empty_cell_token: False
- loc_reg_num: *loc_reg_num
- max_text_length: *max_text_length
- - TableBoxEncode:
- in_box_format: *box_format
- out_box_format: *box_format
- - ResizeTableImage:
- max_len: 488
- - NormalizeImage:
- scale: 1./255.
- mean: [0.485, 0.456, 0.406]
- std: [0.229, 0.224, 0.225]
- order: 'hwc'
- - PaddingTableImage:
- size: [488, 488]
- - ToCHWImage:
- - KeepKeys:
- keep_keys: ['image', 'structure', 'bboxes', 'bbox_masks', 'length', 'shape']
- loader:
- shuffle: True
- batch_size_per_card: 32 # 减小batch_size提高稳定性
- drop_last: True # 丢弃不完整的最后一个batch
- num_workers: 2 # 减少worker数量,避免CPU负载过高
- Eval:
- dataset:
- name: PubTabDataSet
- data_dir: dataset/table_rec_dataset_examples/ # ✅ 正确路径
- label_file_list: [dataset/table_rec_dataset_examples/val.txt] # ✅ 正确文件
- ratio_list: [1.0] # 添加这一行,长度与 label_file_list 相同
- transforms:
- - DecodeImage:
- img_mode: BGR
- channel_first: False
- - TableLabelEncode:
- learn_empty_box: False
- merge_no_span_structure: *merge_no_span_structure
- replace_empty_cell_token: False
- loc_reg_num: *loc_reg_num
- max_text_length: *max_text_length
- - TableBoxEncode:
- in_box_format: *box_format
- out_box_format: *box_format
- - ResizeTableImage:
- max_len: 488
- - NormalizeImage:
- scale: 1./255.
- mean: [0.485, 0.456, 0.406]
- std: [0.229, 0.224, 0.225]
- order: 'hwc'
- - PaddingTableImage:
- size: [488, 488]
- - ToCHWImage:
- - KeepKeys:
- keep_keys: ['image', 'structure', 'bboxes', 'bbox_masks', 'length', 'shape']
- loader:
- shuffle: False
- drop_last: False
- batch_size_per_card: 48
- num_workers: 1
|