124 lines
3.1 KiB
YAML
124 lines
3.1 KiB
YAML
Global:
|
|
use_gpu: True
|
|
epoch_num: &epoch_num 200
|
|
log_smooth_window: 10
|
|
print_batch_step: 10
|
|
save_model_dir: ./output/ser_layoutxlm_funsd
|
|
save_epoch_step: 2000
|
|
# evaluation is run every 10 iterations after the 0th iteration
|
|
eval_batch_step: [ 0, 57 ]
|
|
cal_metric_during_train: False
|
|
save_inference_dir:
|
|
use_visualdl: False
|
|
seed: 2022
|
|
infer_img: train_data/FUNSD/testing_data/images/83624198.png
|
|
save_res_path: output/ser_layoutxlm_funsd/res/
|
|
|
|
Architecture:
|
|
model_type: vqa
|
|
algorithm: &algorithm "LayoutXLM"
|
|
Transform:
|
|
Backbone:
|
|
name: LayoutXLMForSer
|
|
pretrained: True
|
|
checkpoints:
|
|
num_classes: &num_classes 7
|
|
|
|
Loss:
|
|
name: VQASerTokenLayoutLMLoss
|
|
num_classes: *num_classes
|
|
|
|
Optimizer:
|
|
name: AdamW
|
|
beta1: 0.9
|
|
beta2: 0.999
|
|
lr:
|
|
name: Linear
|
|
learning_rate: 0.00005
|
|
epochs: *epoch_num
|
|
warmup_epoch: 2
|
|
regularizer:
|
|
name: L2
|
|
factor: 0.00000
|
|
|
|
PostProcess:
|
|
name: VQASerTokenLayoutLMPostProcess
|
|
class_path: &class_path ./train_data/FUNSD/class_list.txt
|
|
|
|
Metric:
|
|
name: VQASerTokenMetric
|
|
main_indicator: hmean
|
|
|
|
Train:
|
|
dataset:
|
|
name: SimpleDataSet
|
|
data_dir: ./train_data/FUNSD/training_data/images/
|
|
label_file_list:
|
|
- ./train_data/FUNSD/train.json
|
|
ratio_list: [ 1.0 ]
|
|
transforms:
|
|
- DecodeImage: # load image
|
|
img_mode: RGB
|
|
channel_first: False
|
|
- VQATokenLabelEncode: # Class handling label
|
|
contains_re: False
|
|
algorithm: *algorithm
|
|
class_path: *class_path
|
|
- VQATokenPad:
|
|
max_seq_len: &max_seq_len 512
|
|
return_attention_mask: True
|
|
- VQASerTokenChunk:
|
|
max_seq_len: *max_seq_len
|
|
- Resize:
|
|
size: [224,224]
|
|
- NormalizeImage:
|
|
scale: 1
|
|
mean: [ 123.675, 116.28, 103.53 ]
|
|
std: [ 58.395, 57.12, 57.375 ]
|
|
order: 'hwc'
|
|
- ToCHWImage:
|
|
- KeepKeys:
|
|
# dataloader will return list in this order
|
|
keep_keys: [ 'input_ids', 'bbox', 'attention_mask', 'token_type_ids', 'image', 'labels']
|
|
loader:
|
|
shuffle: True
|
|
drop_last: False
|
|
batch_size_per_card: 8
|
|
num_workers: 4
|
|
|
|
Eval:
|
|
dataset:
|
|
name: SimpleDataSet
|
|
data_dir: train_data/FUNSD/testing_data/images/
|
|
label_file_list:
|
|
- ./train_data/FUNSD/test.json
|
|
transforms:
|
|
- DecodeImage: # load image
|
|
img_mode: RGB
|
|
channel_first: False
|
|
- VQATokenLabelEncode: # Class handling label
|
|
contains_re: False
|
|
algorithm: *algorithm
|
|
class_path: *class_path
|
|
- VQATokenPad:
|
|
max_seq_len: *max_seq_len
|
|
return_attention_mask: True
|
|
- VQASerTokenChunk:
|
|
max_seq_len: *max_seq_len
|
|
- Resize:
|
|
size: [224,224]
|
|
- NormalizeImage:
|
|
scale: 1
|
|
mean: [ 123.675, 116.28, 103.53 ]
|
|
std: [ 58.395, 57.12, 57.375 ]
|
|
order: 'hwc'
|
|
- ToCHWImage:
|
|
- KeepKeys:
|
|
# dataloader will return list in this order
|
|
keep_keys: [ 'input_ids', 'bbox', 'attention_mask', 'token_type_ids', 'image', 'labels']
|
|
loader:
|
|
shuffle: False
|
|
drop_last: False
|
|
batch_size_per_card: 8
|
|
num_workers: 4
|