forked from PaddlePaddle/PaddleOCR
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'PaddlePaddle:main' into main
- Loading branch information
Showing
109 changed files
with
127,234 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
Global: | ||
use_gpu: True | ||
epoch_num: 10 | ||
log_smooth_window: 10 | ||
print_batch_step: 10 | ||
save_model_dir: ./output/rec/pp_formulanet_l/ | ||
save_epoch_step: 2 | ||
# evaluation is run every 417 iterations (1 epoch)(batch_size = 24) # max_seq_len: 1024 | ||
eval_batch_step: [0, 417 ] | ||
cal_metric_during_train: True | ||
pretrained_model: | ||
checkpoints: | ||
save_inference_dir: | ||
use_visualdl: False | ||
infer_img: doc/datasets/pme_demo/0000013.png | ||
infer_mode: False | ||
use_space_char: False | ||
rec_char_dict_path: &rec_char_dict_path ppocr/utils/dict/unimernet_tokenizer | ||
max_new_tokens: &max_new_tokens 1024 | ||
input_size: &input_size [768, 768] | ||
save_res_path: ./output/rec/predicts_unimernet_latexocr.txt | ||
allow_resize_largeImg: False | ||
start_ema: True | ||
|
||
Optimizer: | ||
name: AdamW | ||
beta1: 0.9 | ||
beta2: 0.999 | ||
weight_decay: 0.05 | ||
lr: | ||
name: LinearWarmupCosine | ||
learning_rate: 0.0001 | ||
|
||
Architecture: | ||
model_type: rec | ||
algorithm: PP-FormulaNet-L | ||
in_channels: 3 | ||
Transform: | ||
Backbone: | ||
name: Vary_VIT_B_Formula | ||
image_size: 768 | ||
encoder_embed_dim: 768 | ||
encoder_depth: 12 | ||
encoder_num_heads: 12 | ||
encoder_global_attn_indexes: [2, 5, 8, 11] | ||
Head: | ||
name: PPFormulaNet_Head | ||
max_new_tokens: *max_new_tokens | ||
decoder_start_token_id: 0 | ||
decoder_ffn_dim: 2048 | ||
decoder_hidden_size: 512 | ||
decoder_layers: 8 | ||
temperature: 0.2 | ||
do_sample: False | ||
top_p: 0.95 | ||
encoder_hidden_size: 1024 | ||
is_export: False | ||
length_aware: False | ||
use_parallel: False | ||
parallel_step: 0 | ||
|
||
Loss: | ||
name: PPFormulaNet_L_Loss | ||
|
||
PostProcess: | ||
name: UniMERNetDecode | ||
rec_char_dict_path: *rec_char_dict_path | ||
|
||
Metric: | ||
name: LaTeXOCRMetric | ||
main_indicator: exp_rate | ||
cal_bleu_score: False | ||
|
||
Train: | ||
dataset: | ||
name: SimpleDataSet | ||
data_dir: ./ocr_rec_latexocr_dataset_example | ||
label_file_list: ["./ocr_rec_latexocr_dataset_example/train.txt"] | ||
transforms: | ||
- UniMERNetImgDecode: | ||
input_size: *input_size | ||
- UniMERNetTrainTransform: | ||
- LatexImageFormat: | ||
- UniMERNetLabelEncode: | ||
rec_char_dict_path: *rec_char_dict_path | ||
max_seq_len: *max_new_tokens | ||
- KeepKeys: | ||
keep_keys: ['image', 'label', 'attention_mask'] | ||
|
||
loader: | ||
shuffle: False | ||
drop_last: False | ||
batch_size_per_card: 6 | ||
num_workers: 0 | ||
collate_fn: UniMERNetCollator | ||
|
||
Eval: | ||
dataset: | ||
name: SimpleDataSet | ||
data_dir: ./ocr_rec_latexocr_dataset_example | ||
label_file_list: ["./ocr_rec_latexocr_dataset_example/val.txt"] | ||
transforms: | ||
- UniMERNetImgDecode: | ||
input_size: *input_size | ||
- UniMERNetTestTransform: | ||
- LatexImageFormat: | ||
- UniMERNetLabelEncode: | ||
max_seq_len: *max_new_tokens | ||
rec_char_dict_path: *rec_char_dict_path | ||
- KeepKeys: | ||
keep_keys: ['image', 'label', 'attention_mask', 'filename'] | ||
loader: | ||
shuffle: False | ||
drop_last: False | ||
batch_size_per_card: 10 | ||
num_workers: 0 | ||
collate_fn: UniMERNetCollator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
Global: | ||
use_gpu: True | ||
epoch_num: 20 | ||
log_smooth_window: 10 | ||
print_batch_step: 10 | ||
save_model_dir: ./output/rec/pp_formulanet_s/ | ||
save_epoch_step: 2 | ||
# evaluation is run every 179 iterations (1 epoch)(batch_size = 56) # max_seq_len: 1024 | ||
eval_batch_step: [0, 179] | ||
cal_metric_during_train: True | ||
pretrained_model: | ||
checkpoints: | ||
save_inference_dir: | ||
use_visualdl: False | ||
infer_img: doc/datasets/pme_demo/0000013.png | ||
infer_mode: False | ||
use_space_char: False | ||
rec_char_dict_path: &rec_char_dict_path ppocr/utils/dict/unimernet_tokenizer | ||
max_new_tokens: &max_new_tokens 1024 | ||
input_size: &input_size [384, 384] | ||
save_res_path: ./output/rec/predicts_unimernet_latexocr.txt | ||
allow_resize_largeImg: False | ||
start_ema: True | ||
|
||
Optimizer: | ||
name: AdamW | ||
beta1: 0.9 | ||
beta2: 0.999 | ||
weight_decay: 0.05 | ||
lr: | ||
name: LinearWarmupCosine | ||
learning_rate: 0.0001 | ||
|
||
Architecture: | ||
model_type: rec | ||
algorithm: PP-FormulaNet-S | ||
in_channels: 3 | ||
Transform: | ||
Backbone: | ||
name: PPHGNetV2_B4 | ||
class_num: 1024 | ||
|
||
Head: | ||
name: PPFormulaNet_Head | ||
max_new_tokens: *max_new_tokens | ||
decoder_start_token_id: 0 | ||
decoder_ffn_dim: 1536 | ||
decoder_hidden_size: 384 | ||
decoder_layers: 2 | ||
temperature: 0.2 | ||
do_sample: False | ||
top_p: 0.95 | ||
encoder_hidden_size: 2048 | ||
is_export: False | ||
length_aware: True | ||
use_parallel: True, | ||
parallel_step: 3 | ||
|
||
Loss: | ||
name: PPFormulaNet_S_Loss | ||
parallel_step: 3 | ||
|
||
PostProcess: | ||
name: UniMERNetDecode | ||
rec_char_dict_path: *rec_char_dict_path | ||
|
||
Metric: | ||
name: LaTeXOCRMetric | ||
main_indicator: exp_rate | ||
cal_bleu_score: False | ||
|
||
Train: | ||
dataset: | ||
name: SimpleDataSet | ||
data_dir: ./ocr_rec_latexocr_dataset_example | ||
label_file_list: ["./ocr_rec_latexocr_dataset_example/train.txt"] | ||
transforms: | ||
- UniMERNetImgDecode: | ||
input_size: *input_size | ||
- UniMERNetTrainTransform: | ||
- LatexImageFormat: | ||
- UniMERNetLabelEncode: | ||
rec_char_dict_path: *rec_char_dict_path | ||
max_seq_len: *max_new_tokens | ||
- KeepKeys: | ||
keep_keys: ['image', 'label', 'attention_mask'] | ||
|
||
loader: | ||
shuffle: False | ||
drop_last: False | ||
batch_size_per_card: 14 | ||
num_workers: 0 | ||
collate_fn: UniMERNetCollator | ||
|
||
Eval: | ||
dataset: | ||
name: SimpleDataSet | ||
data_dir: ./ocr_rec_latexocr_dataset_example | ||
label_file_list: ["./ocr_rec_latexocr_dataset_example/val.txt"] | ||
transforms: | ||
- UniMERNetImgDecode: | ||
input_size: *input_size | ||
- UniMERNetTestTransform: | ||
- LatexImageFormat: | ||
- UniMERNetLabelEncode: | ||
max_seq_len: *max_new_tokens | ||
rec_char_dict_path: *rec_char_dict_path | ||
- KeepKeys: | ||
keep_keys: ['image', 'label', 'attention_mask', 'filename'] | ||
loader: | ||
shuffle: False | ||
drop_last: False | ||
batch_size_per_card: 30 | ||
num_workers: 0 | ||
collate_fn: UniMERNetCollator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.