Safeguard Stage 4 clean2m RTL-fixed intermediate
Browse files- .gitattributes +3 -0
- checkpoints/stage-004-clean2m-rtlfix/benchmark/STAGE4_INTERMEDIATE.md +17 -0
- checkpoints/stage-004-clean2m-rtlfix/benchmark/s3-results.json +42 -0
- checkpoints/stage-004-clean2m-rtlfix/benchmark/status.log +9 -0
- checkpoints/stage-004-clean2m-rtlfix/benchmark/variant-sweep-summary.json +82 -0
- checkpoints/stage-004-clean2m-rtlfix/checkpoint/best_accuracy.pdopt +3 -0
- checkpoints/stage-004-clean2m-rtlfix/checkpoint/best_accuracy.pdparams +3 -0
- checkpoints/stage-004-clean2m-rtlfix/checkpoint/best_accuracy.states +0 -0
- checkpoints/stage-004-clean2m-rtlfix/checkpoint/launch-config.yml +153 -0
- checkpoints/stage-004-clean2m-rtlfix/config/bina02_rtl_label_encode_fixed.patch +50 -0
- checkpoints/stage-004-clean2m-rtlfix/config/bina02_stage4_clean2m.yml +153 -0
- checkpoints/stage-004-clean2m-rtlfix/inference/inference.json +0 -0
- checkpoints/stage-004-clean2m-rtlfix/inference/inference.pdiparams +3 -0
- checkpoints/stage-004-clean2m-rtlfix/inference/inference.yml +205 -0
.gitattributes
CHANGED
|
@@ -46,3 +46,6 @@ checkpoints/aligned169k-step12000-gated-native-v4/best_accuracy.pdparams filter=
|
|
| 46 |
checkpoints/aligned169k-step13000-gated-native-v4/best_accuracy.pdparams filter=lfs diff=lfs merge=lfs -text
|
| 47 |
checkpoints/stage-002-669k-epoch1/paddle-inference/inference.pdiparams filter=lfs diff=lfs merge=lfs -text
|
| 48 |
checkpoints/stage-002-669k-epoch1/paddle-training/best_accuracy.pdparams filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
checkpoints/aligned169k-step13000-gated-native-v4/best_accuracy.pdparams filter=lfs diff=lfs merge=lfs -text
|
| 47 |
checkpoints/stage-002-669k-epoch1/paddle-inference/inference.pdiparams filter=lfs diff=lfs merge=lfs -text
|
| 48 |
checkpoints/stage-002-669k-epoch1/paddle-training/best_accuracy.pdparams filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
checkpoints/stage-004-clean2m-rtlfix/checkpoint/best_accuracy.pdopt filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
checkpoints/stage-004-clean2m-rtlfix/checkpoint/best_accuracy.pdparams filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
checkpoints/stage-004-clean2m-rtlfix/inference/inference.pdiparams filter=lfs diff=lfs merge=lfs -text
|
checkpoints/stage-004-clean2m-rtlfix/benchmark/STAGE4_INTERMEDIATE.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Bina 0.2 RizehPizeh - Stage 4 intermediate
|
| 2 |
+
|
| 3 |
+
This is a resumable intermediate checkpoint, not the final release.
|
| 4 |
+
|
| 5 |
+
Training: PP-OCRv6 medium recognizer, corrected Persian RTL CTC label encoding, balanced 1,000,000 handwritten + 1,000,000 printed line crops, two epochs on 8 GPUs.
|
| 6 |
+
|
| 7 |
+
Exact Persian OCR Triple Threat (6,669 pages per split, zero missing):
|
| 8 |
+
|
| 9 |
+
- Handwriting: WER 22.5451, CER 16.9449, S3 19.5154 (target not met)
|
| 10 |
+
- Printed: WER 8.9257, CER 2.3535, S3 9.8512 (target met)
|
| 11 |
+
|
| 12 |
+
Held-out native-line normalized edit distance:
|
| 13 |
+
|
| 14 |
+
- Handwriting: 0.9920755505
|
| 15 |
+
- Printed: 0.8975607924
|
| 16 |
+
|
| 17 |
+
The checkpoint is preserved for recovery while form-aware page segmentation and reading-order work continues.
|
checkpoints/stage-004-clean2m-rtlfix/benchmark/s3-results.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"splits": {
|
| 3 |
+
"handwriting": {
|
| 4 |
+
"count": 6669,
|
| 5 |
+
"wer": 22.5451,
|
| 6 |
+
"cer": 16.9449,
|
| 7 |
+
"s3": 19.5154,
|
| 8 |
+
"essential_error": 21.5018,
|
| 9 |
+
"triple_threat": 19.6073,
|
| 10 |
+
"reference_importance": 790969.366256,
|
| 11 |
+
"error_importance": 154360.951035,
|
| 12 |
+
"essential_words": 312569,
|
| 13 |
+
"essential_errors": 67208
|
| 14 |
+
},
|
| 15 |
+
"printed": {
|
| 16 |
+
"count": 6669,
|
| 17 |
+
"wer": 8.9257,
|
| 18 |
+
"cer": 2.3535,
|
| 19 |
+
"s3": 9.8512,
|
| 20 |
+
"essential_error": 12.0774,
|
| 21 |
+
"triple_threat": 8.1666,
|
| 22 |
+
"reference_importance": 44585.665084,
|
| 23 |
+
"error_importance": 4392.232612,
|
| 24 |
+
"essential_words": 22596,
|
| 25 |
+
"essential_errors": 2729
|
| 26 |
+
}
|
| 27 |
+
},
|
| 28 |
+
"macro_equal_split": {
|
| 29 |
+
"wer": 15.7354,
|
| 30 |
+
"cer": 9.6492,
|
| 31 |
+
"s3": 14.6833,
|
| 32 |
+
"essential_error": 16.7896,
|
| 33 |
+
"triple_threat": 13.8869
|
| 34 |
+
},
|
| 35 |
+
"triple_threat_weights": {
|
| 36 |
+
"wer": 0.2,
|
| 37 |
+
"cer": 0.2,
|
| 38 |
+
"s3": 0.6
|
| 39 |
+
},
|
| 40 |
+
"missing_predictions": 0,
|
| 41 |
+
"missing_ids": []
|
| 42 |
+
}
|
checkpoints/stage-004-clean2m-rtlfix/benchmark/status.log
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
2026-07-26T07:36:07+00:00 WAITING_FOR_TRAIN
|
| 2 |
+
2026-07-26T09:50:50+00:00 TRAIN_EXIT_CODE=0
|
| 3 |
+
2026-07-26T09:50:50+00:00 EXPORT_START
|
| 4 |
+
2026-07-26T09:50:56+00:00 EXPORT_DONE
|
| 5 |
+
2026-07-26T09:50:56+00:00 BENCH_START ranks=8
|
| 6 |
+
2026-07-26T09:54:31+00:00 BENCH_DONE
|
| 7 |
+
2026-07-26T09:54:53+00:00 DECODE_DONE rows=13338
|
| 8 |
+
2026-07-26T09:56:54+00:00 S3_DONE
|
| 9 |
+
2026-07-26T09:56:54+00:00 POSTTRAIN_DONE
|
checkpoints/stage-004-clean2m-rtlfix/benchmark/variant-sweep-summary.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"variant": "spread_right_first",
|
| 4 |
+
"handwriting_s3": 19.5154,
|
| 5 |
+
"handwriting_wer": 22.5451,
|
| 6 |
+
"handwriting_cer": 16.9449,
|
| 7 |
+
"printed_s3": 9.8512,
|
| 8 |
+
"printed_wer": 8.9257,
|
| 9 |
+
"printed_cer": 2.3535,
|
| 10 |
+
"missing": 0
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"variant": "adaptive_drop_left_header",
|
| 14 |
+
"handwriting_s3": 21.2686,
|
| 15 |
+
"handwriting_wer": 23.3087,
|
| 16 |
+
"handwriting_cer": 17.6208,
|
| 17 |
+
"printed_s3": 9.8512,
|
| 18 |
+
"printed_wer": 8.9257,
|
| 19 |
+
"printed_cer": 2.3535,
|
| 20 |
+
"missing": 0
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"variant": "adaptive",
|
| 24 |
+
"handwriting_s3": 21.2728,
|
| 25 |
+
"handwriting_wer": 24.5539,
|
| 26 |
+
"handwriting_cer": 18.9235,
|
| 27 |
+
"printed_s3": 9.8512,
|
| 28 |
+
"printed_wer": 8.9257,
|
| 29 |
+
"printed_cer": 2.3535,
|
| 30 |
+
"missing": 0
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"variant": "row055",
|
| 34 |
+
"handwriting_s3": 35.9823,
|
| 35 |
+
"handwriting_wer": 43.6914,
|
| 36 |
+
"handwriting_cer": 33.6672,
|
| 37 |
+
"printed_s3": 9.8512,
|
| 38 |
+
"printed_wer": 8.9257,
|
| 39 |
+
"printed_cer": 2.3535,
|
| 40 |
+
"missing": 0
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"variant": "row085",
|
| 44 |
+
"handwriting_s3": 37.3241,
|
| 45 |
+
"handwriting_wer": 45.319,
|
| 46 |
+
"handwriting_cer": 35.1145,
|
| 47 |
+
"printed_s3": 9.8512,
|
| 48 |
+
"printed_wer": 8.9257,
|
| 49 |
+
"printed_cer": 2.3535,
|
| 50 |
+
"missing": 0
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"variant": "spread_left_first",
|
| 54 |
+
"handwriting_s3": 38.4533,
|
| 55 |
+
"handwriting_wer": 44.9782,
|
| 56 |
+
"handwriting_cer": 34.0624,
|
| 57 |
+
"printed_s3": 9.8512,
|
| 58 |
+
"printed_wer": 8.9257,
|
| 59 |
+
"printed_cer": 2.3535,
|
| 60 |
+
"missing": 0
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"variant": "native",
|
| 64 |
+
"handwriting_s3": 40.2798,
|
| 65 |
+
"handwriting_wer": 47.8335,
|
| 66 |
+
"handwriting_cer": 37.4564,
|
| 67 |
+
"printed_s3": 9.8512,
|
| 68 |
+
"printed_wer": 8.9257,
|
| 69 |
+
"printed_cer": 2.3535,
|
| 70 |
+
"missing": 0
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"variant": "row110",
|
| 74 |
+
"handwriting_s3": 43.925,
|
| 75 |
+
"handwriting_wer": 53.3749,
|
| 76 |
+
"handwriting_cer": 42.04,
|
| 77 |
+
"printed_s3": 9.8512,
|
| 78 |
+
"printed_wer": 8.9257,
|
| 79 |
+
"printed_cer": 2.3535,
|
| 80 |
+
"missing": 0
|
| 81 |
+
}
|
| 82 |
+
]
|
checkpoints/stage-004-clean2m-rtlfix/checkpoint/best_accuracy.pdopt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2ed09e6310383f49c44fc0ec5c9672b14c4bf3e41a268f2231816bb4b0671452
|
| 3 |
+
size 263781332
|
checkpoints/stage-004-clean2m-rtlfix/checkpoint/best_accuracy.pdparams
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:34bacad6b55f72e06cee97a4fa05aefc880bfb5d9a8f7c9f504b479e8b1ca8d5
|
| 3 |
+
size 142364527
|
checkpoints/stage-004-clean2m-rtlfix/checkpoint/best_accuracy.states
ADDED
|
Binary file (345 Bytes). View file
|
|
|
checkpoints/stage-004-clean2m-rtlfix/checkpoint/launch-config.yml
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Global:
|
| 2 |
+
model_name: PP-OCRv6_medium_rec
|
| 3 |
+
debug: false
|
| 4 |
+
use_gpu: true
|
| 5 |
+
epoch_num: 2
|
| 6 |
+
log_smooth_window: 20
|
| 7 |
+
print_batch_step: 10
|
| 8 |
+
save_model_dir: /workspace/bina02-ppocr/run/train-stage4-clean2m-lr3e6
|
| 9 |
+
save_epoch_step: 1
|
| 10 |
+
eval_batch_step:
|
| 11 |
+
- 0
|
| 12 |
+
- 200
|
| 13 |
+
cal_metric_during_train: false
|
| 14 |
+
pretrained_model: /workspace/bina02-ppocr/run/train-669k-from-step13/best_accuracy
|
| 15 |
+
checkpoints: null
|
| 16 |
+
save_inference_dir: null
|
| 17 |
+
use_visualdl: false
|
| 18 |
+
infer_img: doc/imgs_words/ch/word_1.jpg
|
| 19 |
+
character_dict_path: /workspace/bina02-ppocr/train-data/manifests/persian_arabic_bina02_dict.txt
|
| 20 |
+
max_text_length: 192
|
| 21 |
+
infer_mode: false
|
| 22 |
+
use_space_char: true
|
| 23 |
+
distributed: false
|
| 24 |
+
d2s_train_image_shape:
|
| 25 |
+
- 3
|
| 26 |
+
- 48
|
| 27 |
+
- 1536
|
| 28 |
+
freeze_batch_norm: true
|
| 29 |
+
trainable_prefixes:
|
| 30 |
+
- backbone.blocks4
|
| 31 |
+
- backbone.blocks5
|
| 32 |
+
- head.ctc_encoder
|
| 33 |
+
- head.ctc_head
|
| 34 |
+
eval_handwriting_rows: 8192
|
| 35 |
+
eval_printed_rows: 8192
|
| 36 |
+
use_amp: false
|
| 37 |
+
Optimizer:
|
| 38 |
+
name: Adam
|
| 39 |
+
beta1: 0.9
|
| 40 |
+
beta2: 0.999
|
| 41 |
+
lr:
|
| 42 |
+
name: Cosine
|
| 43 |
+
learning_rate: 3.0e-06
|
| 44 |
+
warmup_epoch: 0
|
| 45 |
+
regularizer:
|
| 46 |
+
name: L2
|
| 47 |
+
factor: 3.0e-05
|
| 48 |
+
Architecture:
|
| 49 |
+
model_type: rec
|
| 50 |
+
algorithm: SVTR_LCNet
|
| 51 |
+
Transform: null
|
| 52 |
+
Backbone:
|
| 53 |
+
name: PPLCNetV4
|
| 54 |
+
model_size: medium
|
| 55 |
+
train_pool_width: 192
|
| 56 |
+
force_pool_width: true
|
| 57 |
+
Head:
|
| 58 |
+
name: MultiHead
|
| 59 |
+
head_list:
|
| 60 |
+
- CTCHead:
|
| 61 |
+
Neck:
|
| 62 |
+
name: lightsvtr
|
| 63 |
+
dims: 192
|
| 64 |
+
depth: 2
|
| 65 |
+
mlp_ratio: 4.0
|
| 66 |
+
local_kernel: 7
|
| 67 |
+
use_guide: false
|
| 68 |
+
Head:
|
| 69 |
+
fc_decay: 1.0e-05
|
| 70 |
+
- NRTRHead:
|
| 71 |
+
nrtr_dim: 512
|
| 72 |
+
max_text_length: 192
|
| 73 |
+
Loss:
|
| 74 |
+
name: MultiLoss
|
| 75 |
+
weight_1: 1.0
|
| 76 |
+
weight_2: 0.0
|
| 77 |
+
loss_config_list:
|
| 78 |
+
- CTCLoss: null
|
| 79 |
+
- NRTRLoss: null
|
| 80 |
+
PostProcess:
|
| 81 |
+
name: CTCLabelDecode
|
| 82 |
+
Metric:
|
| 83 |
+
name: RecMetric
|
| 84 |
+
main_indicator: handwriting_norm_edit_dis
|
| 85 |
+
ignore_space: false
|
| 86 |
+
domain_split_index: 8192
|
| 87 |
+
Train:
|
| 88 |
+
dataset:
|
| 89 |
+
name: LMDBDataSet
|
| 90 |
+
data_dir: /workspace/bina02-ppocr/data/corpus-v4/balanced/train
|
| 91 |
+
ext_op_transform_idx: 1
|
| 92 |
+
transforms:
|
| 93 |
+
- DecodeImage:
|
| 94 |
+
img_mode: BGR
|
| 95 |
+
channel_first: false
|
| 96 |
+
- RecConAug:
|
| 97 |
+
prob: 0.0
|
| 98 |
+
ext_data_num: 0
|
| 99 |
+
image_shape:
|
| 100 |
+
- 48
|
| 101 |
+
- 1536
|
| 102 |
+
- 3
|
| 103 |
+
max_text_length: 192
|
| 104 |
+
- RecAug: null
|
| 105 |
+
- MultiLabelEncode:
|
| 106 |
+
gtc_encode: NRTRLabelEncode
|
| 107 |
+
- RecResizeImg:
|
| 108 |
+
image_shape:
|
| 109 |
+
- 3
|
| 110 |
+
- 48
|
| 111 |
+
- 1536
|
| 112 |
+
padding: true
|
| 113 |
+
- KeepKeys:
|
| 114 |
+
keep_keys:
|
| 115 |
+
- image
|
| 116 |
+
- label_ctc
|
| 117 |
+
- label_gtc
|
| 118 |
+
- length
|
| 119 |
+
- valid_ratio
|
| 120 |
+
loader:
|
| 121 |
+
shuffle: true
|
| 122 |
+
batch_size_per_card: 32
|
| 123 |
+
drop_last: false
|
| 124 |
+
num_workers: 4
|
| 125 |
+
Eval:
|
| 126 |
+
dataset:
|
| 127 |
+
name: LMDBDataSet
|
| 128 |
+
data_dir: /workspace/bina02-ppocr/data/corpus-v4/balanced/eval
|
| 129 |
+
transforms:
|
| 130 |
+
- DecodeImage:
|
| 131 |
+
img_mode: BGR
|
| 132 |
+
channel_first: false
|
| 133 |
+
- MultiLabelEncode:
|
| 134 |
+
gtc_encode: NRTRLabelEncode
|
| 135 |
+
- RecResizeImg:
|
| 136 |
+
image_shape:
|
| 137 |
+
- 3
|
| 138 |
+
- 48
|
| 139 |
+
- 1536
|
| 140 |
+
padding: true
|
| 141 |
+
- KeepKeys:
|
| 142 |
+
keep_keys:
|
| 143 |
+
- image
|
| 144 |
+
- label_ctc
|
| 145 |
+
- label_gtc
|
| 146 |
+
- length
|
| 147 |
+
- valid_ratio
|
| 148 |
+
loader:
|
| 149 |
+
shuffle: false
|
| 150 |
+
drop_last: false
|
| 151 |
+
batch_size_per_card: 32
|
| 152 |
+
num_workers: 4
|
| 153 |
+
profiler_options: null
|
checkpoints/stage-004-clean2m-rtlfix/config/bina02_rtl_label_encode_fixed.patch
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--- /workspace/bina02-ppocr/PaddleOCR/ppocr/data/imaug/label_ops.py.pre-bina02-rtl-20260726 2026-07-22 11:58:12.000000000 +0000
|
| 2 |
+
+++ /workspace/bina02-ppocr/PaddleOCR/ppocr/data/imaug/label_ops.py 2026-07-26 07:33:44.218402343 +0000
|
| 3 |
+
@@ -18,6 +18,7 @@
|
| 4 |
+
from __future__ import unicode_literals
|
| 5 |
+
|
| 6 |
+
import os
|
| 7 |
+
+import re
|
| 8 |
+
from enum import Enum
|
| 9 |
+
import copy
|
| 10 |
+
import numpy as np
|
| 11 |
+
@@ -116,6 +117,7 @@
|
| 12 |
+
self.beg_str = "sos"
|
| 13 |
+
self.end_str = "eos"
|
| 14 |
+
self.lower = lower
|
| 15 |
+
+ self.reverse = bool(character_dict_path and "arabic" in character_dict_path)
|
| 16 |
+
|
| 17 |
+
if character_dict_path is None:
|
| 18 |
+
logger = get_logger()
|
| 19 |
+
@@ -144,6 +146,22 @@
|
| 20 |
+
def add_special_char(self, dict_character):
|
| 21 |
+
return dict_character
|
| 22 |
+
|
| 23 |
+
+ @staticmethod
|
| 24 |
+
+ def _reverse_for_arabic(text):
|
| 25 |
+
+ groups = []
|
| 26 |
+
+ current = ""
|
| 27 |
+
+ for char in text:
|
| 28 |
+
+ if not bool(re.search("[a-zA-Z0-9 :*.\/%+-]", char)):
|
| 29 |
+
+ if current:
|
| 30 |
+
+ groups.append(current)
|
| 31 |
+
+ groups.append(char)
|
| 32 |
+
+ current = ""
|
| 33 |
+
+ else:
|
| 34 |
+
+ current += char
|
| 35 |
+
+ if current:
|
| 36 |
+
+ groups.append(current)
|
| 37 |
+
+ return "".join(groups[::-1])
|
| 38 |
+
+
|
| 39 |
+
def encode(self, text):
|
| 40 |
+
"""convert text-label into text-index.
|
| 41 |
+
input:
|
| 42 |
+
@@ -158,6 +176,8 @@
|
| 43 |
+
return None
|
| 44 |
+
if self.lower:
|
| 45 |
+
text = text.lower()
|
| 46 |
+
+ if self.reverse:
|
| 47 |
+
+ text = self._reverse_for_arabic(text)
|
| 48 |
+
text_list = []
|
| 49 |
+
for char in text:
|
| 50 |
+
if char not in self.dict:
|
checkpoints/stage-004-clean2m-rtlfix/config/bina02_stage4_clean2m.yml
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Global:
|
| 2 |
+
model_name: PP-OCRv6_medium_rec
|
| 3 |
+
debug: false
|
| 4 |
+
use_gpu: true
|
| 5 |
+
epoch_num: 2
|
| 6 |
+
log_smooth_window: 20
|
| 7 |
+
print_batch_step: 10
|
| 8 |
+
save_model_dir: /workspace/bina02-ppocr/run/train-stage4-clean2m-lr3e6
|
| 9 |
+
save_epoch_step: 1
|
| 10 |
+
eval_batch_step:
|
| 11 |
+
- 0
|
| 12 |
+
- 200
|
| 13 |
+
cal_metric_during_train: false
|
| 14 |
+
pretrained_model: /workspace/bina02-ppocr/run/train-669k-from-step13/best_accuracy
|
| 15 |
+
checkpoints: null
|
| 16 |
+
save_inference_dir: null
|
| 17 |
+
use_visualdl: false
|
| 18 |
+
infer_img: doc/imgs_words/ch/word_1.jpg
|
| 19 |
+
character_dict_path: /workspace/bina02-ppocr/train-data/manifests/persian_arabic_bina02_dict.txt
|
| 20 |
+
max_text_length: 192
|
| 21 |
+
infer_mode: false
|
| 22 |
+
use_space_char: true
|
| 23 |
+
distributed: false
|
| 24 |
+
d2s_train_image_shape:
|
| 25 |
+
- 3
|
| 26 |
+
- 48
|
| 27 |
+
- 1536
|
| 28 |
+
freeze_batch_norm: true
|
| 29 |
+
trainable_prefixes:
|
| 30 |
+
- backbone.blocks4
|
| 31 |
+
- backbone.blocks5
|
| 32 |
+
- head.ctc_encoder
|
| 33 |
+
- head.ctc_head
|
| 34 |
+
eval_handwriting_rows: 8192
|
| 35 |
+
eval_printed_rows: 8192
|
| 36 |
+
use_amp: false
|
| 37 |
+
Optimizer:
|
| 38 |
+
name: Adam
|
| 39 |
+
beta1: 0.9
|
| 40 |
+
beta2: 0.999
|
| 41 |
+
lr:
|
| 42 |
+
name: Cosine
|
| 43 |
+
learning_rate: 3.0e-06
|
| 44 |
+
warmup_epoch: 0
|
| 45 |
+
regularizer:
|
| 46 |
+
name: L2
|
| 47 |
+
factor: 3.0e-05
|
| 48 |
+
Architecture:
|
| 49 |
+
model_type: rec
|
| 50 |
+
algorithm: SVTR_LCNet
|
| 51 |
+
Transform: null
|
| 52 |
+
Backbone:
|
| 53 |
+
name: PPLCNetV4
|
| 54 |
+
model_size: medium
|
| 55 |
+
train_pool_width: 192
|
| 56 |
+
force_pool_width: true
|
| 57 |
+
Head:
|
| 58 |
+
name: MultiHead
|
| 59 |
+
head_list:
|
| 60 |
+
- CTCHead:
|
| 61 |
+
Neck:
|
| 62 |
+
name: lightsvtr
|
| 63 |
+
dims: 192
|
| 64 |
+
depth: 2
|
| 65 |
+
mlp_ratio: 4.0
|
| 66 |
+
local_kernel: 7
|
| 67 |
+
use_guide: false
|
| 68 |
+
Head:
|
| 69 |
+
fc_decay: 1.0e-05
|
| 70 |
+
- NRTRHead:
|
| 71 |
+
nrtr_dim: 512
|
| 72 |
+
max_text_length: 192
|
| 73 |
+
Loss:
|
| 74 |
+
name: MultiLoss
|
| 75 |
+
weight_1: 1.0
|
| 76 |
+
weight_2: 0.0
|
| 77 |
+
loss_config_list:
|
| 78 |
+
- CTCLoss: null
|
| 79 |
+
- NRTRLoss: null
|
| 80 |
+
PostProcess:
|
| 81 |
+
name: CTCLabelDecode
|
| 82 |
+
Metric:
|
| 83 |
+
name: RecMetric
|
| 84 |
+
main_indicator: handwriting_norm_edit_dis
|
| 85 |
+
ignore_space: false
|
| 86 |
+
domain_split_index: 8192
|
| 87 |
+
Train:
|
| 88 |
+
dataset:
|
| 89 |
+
name: LMDBDataSet
|
| 90 |
+
data_dir: /workspace/bina02-ppocr/data/corpus-v4/balanced/train
|
| 91 |
+
ext_op_transform_idx: 1
|
| 92 |
+
transforms:
|
| 93 |
+
- DecodeImage:
|
| 94 |
+
img_mode: BGR
|
| 95 |
+
channel_first: false
|
| 96 |
+
- RecConAug:
|
| 97 |
+
prob: 0.0
|
| 98 |
+
ext_data_num: 0
|
| 99 |
+
image_shape:
|
| 100 |
+
- 48
|
| 101 |
+
- 1536
|
| 102 |
+
- 3
|
| 103 |
+
max_text_length: 192
|
| 104 |
+
- RecAug: null
|
| 105 |
+
- MultiLabelEncode:
|
| 106 |
+
gtc_encode: NRTRLabelEncode
|
| 107 |
+
- RecResizeImg:
|
| 108 |
+
image_shape:
|
| 109 |
+
- 3
|
| 110 |
+
- 48
|
| 111 |
+
- 1536
|
| 112 |
+
padding: true
|
| 113 |
+
- KeepKeys:
|
| 114 |
+
keep_keys:
|
| 115 |
+
- image
|
| 116 |
+
- label_ctc
|
| 117 |
+
- label_gtc
|
| 118 |
+
- length
|
| 119 |
+
- valid_ratio
|
| 120 |
+
loader:
|
| 121 |
+
shuffle: true
|
| 122 |
+
batch_size_per_card: 32
|
| 123 |
+
drop_last: false
|
| 124 |
+
num_workers: 4
|
| 125 |
+
Eval:
|
| 126 |
+
dataset:
|
| 127 |
+
name: LMDBDataSet
|
| 128 |
+
data_dir: /workspace/bina02-ppocr/data/corpus-v4/balanced/eval
|
| 129 |
+
transforms:
|
| 130 |
+
- DecodeImage:
|
| 131 |
+
img_mode: BGR
|
| 132 |
+
channel_first: false
|
| 133 |
+
- MultiLabelEncode:
|
| 134 |
+
gtc_encode: NRTRLabelEncode
|
| 135 |
+
- RecResizeImg:
|
| 136 |
+
image_shape:
|
| 137 |
+
- 3
|
| 138 |
+
- 48
|
| 139 |
+
- 1536
|
| 140 |
+
padding: true
|
| 141 |
+
- KeepKeys:
|
| 142 |
+
keep_keys:
|
| 143 |
+
- image
|
| 144 |
+
- label_ctc
|
| 145 |
+
- label_gtc
|
| 146 |
+
- length
|
| 147 |
+
- valid_ratio
|
| 148 |
+
loader:
|
| 149 |
+
shuffle: false
|
| 150 |
+
drop_last: false
|
| 151 |
+
batch_size_per_card: 32
|
| 152 |
+
num_workers: 4
|
| 153 |
+
profiler_options: null
|
checkpoints/stage-004-clean2m-rtlfix/inference/inference.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
checkpoints/stage-004-clean2m-rtlfix/inference/inference.pdiparams
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f8e1b5b4e9ef11b46c521fed7d1c9b7e7b2d08c4c879aa01353acd7308a6e9fb
|
| 3 |
+
size 62146801
|
checkpoints/stage-004-clean2m-rtlfix/inference/inference.yml
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Global:
|
| 2 |
+
model_name: PP-OCRv6_medium_rec
|
| 3 |
+
Hpi:
|
| 4 |
+
backend_configs:
|
| 5 |
+
paddle_infer:
|
| 6 |
+
trt_dynamic_shapes: &id001
|
| 7 |
+
x:
|
| 8 |
+
- - 1
|
| 9 |
+
- 3
|
| 10 |
+
- 48
|
| 11 |
+
- 160
|
| 12 |
+
- - 1
|
| 13 |
+
- 3
|
| 14 |
+
- 48
|
| 15 |
+
- 320
|
| 16 |
+
- - 8
|
| 17 |
+
- 3
|
| 18 |
+
- 48
|
| 19 |
+
- 3200
|
| 20 |
+
tensorrt:
|
| 21 |
+
dynamic_shapes: *id001
|
| 22 |
+
PreProcess:
|
| 23 |
+
transform_ops:
|
| 24 |
+
- DecodeImage:
|
| 25 |
+
channel_first: false
|
| 26 |
+
img_mode: BGR
|
| 27 |
+
- MultiLabelEncode:
|
| 28 |
+
gtc_encode: NRTRLabelEncode
|
| 29 |
+
- RecResizeImg:
|
| 30 |
+
image_shape:
|
| 31 |
+
- 3
|
| 32 |
+
- 48
|
| 33 |
+
- 1536
|
| 34 |
+
padding: true
|
| 35 |
+
- KeepKeys:
|
| 36 |
+
keep_keys:
|
| 37 |
+
- image
|
| 38 |
+
- label_ctc
|
| 39 |
+
- label_gtc
|
| 40 |
+
- length
|
| 41 |
+
- valid_ratio
|
| 42 |
+
PostProcess:
|
| 43 |
+
name: CTCLabelDecode
|
| 44 |
+
character_dict:
|
| 45 |
+
- '!'
|
| 46 |
+
- '"'
|
| 47 |
+
- '#'
|
| 48 |
+
- '%'
|
| 49 |
+
- '&'
|
| 50 |
+
- ''''
|
| 51 |
+
- (
|
| 52 |
+
- )
|
| 53 |
+
- '*'
|
| 54 |
+
- +
|
| 55 |
+
- ','
|
| 56 |
+
- '-'
|
| 57 |
+
- .
|
| 58 |
+
- /
|
| 59 |
+
- '0'
|
| 60 |
+
- '1'
|
| 61 |
+
- '2'
|
| 62 |
+
- '3'
|
| 63 |
+
- '4'
|
| 64 |
+
- '5'
|
| 65 |
+
- '6'
|
| 66 |
+
- '7'
|
| 67 |
+
- '8'
|
| 68 |
+
- '9'
|
| 69 |
+
- ':'
|
| 70 |
+
- '='
|
| 71 |
+
- '@'
|
| 72 |
+
- A
|
| 73 |
+
- B
|
| 74 |
+
- C
|
| 75 |
+
- D
|
| 76 |
+
- E
|
| 77 |
+
- F
|
| 78 |
+
- G
|
| 79 |
+
- H
|
| 80 |
+
- I
|
| 81 |
+
- J
|
| 82 |
+
- K
|
| 83 |
+
- L
|
| 84 |
+
- M
|
| 85 |
+
- N
|
| 86 |
+
- O
|
| 87 |
+
- P
|
| 88 |
+
- Q
|
| 89 |
+
- R
|
| 90 |
+
- S
|
| 91 |
+
- T
|
| 92 |
+
- U
|
| 93 |
+
- V
|
| 94 |
+
- W
|
| 95 |
+
- X
|
| 96 |
+
- Y
|
| 97 |
+
- Z
|
| 98 |
+
- '['
|
| 99 |
+
- ']'
|
| 100 |
+
- _
|
| 101 |
+
- a
|
| 102 |
+
- b
|
| 103 |
+
- c
|
| 104 |
+
- d
|
| 105 |
+
- e
|
| 106 |
+
- f
|
| 107 |
+
- g
|
| 108 |
+
- h
|
| 109 |
+
- i
|
| 110 |
+
- j
|
| 111 |
+
- k
|
| 112 |
+
- l
|
| 113 |
+
- m
|
| 114 |
+
- n
|
| 115 |
+
- o
|
| 116 |
+
- p
|
| 117 |
+
- q
|
| 118 |
+
- r
|
| 119 |
+
- s
|
| 120 |
+
- t
|
| 121 |
+
- u
|
| 122 |
+
- v
|
| 123 |
+
- w
|
| 124 |
+
- x
|
| 125 |
+
- y
|
| 126 |
+
- z
|
| 127 |
+
- «
|
| 128 |
+
-
|
| 129 |
+
- »
|
| 130 |
+
- â
|
| 131 |
+
- ،
|
| 132 |
+
- ؛
|
| 133 |
+
- ؟
|
| 134 |
+
- ء
|
| 135 |
+
- آ
|
| 136 |
+
- أ
|
| 137 |
+
- ؤ
|
| 138 |
+
- إ
|
| 139 |
+
- ئ
|
| 140 |
+
- ا
|
| 141 |
+
- ب
|
| 142 |
+
- ة
|
| 143 |
+
- ت
|
| 144 |
+
- ث
|
| 145 |
+
- ج
|
| 146 |
+
- ح
|
| 147 |
+
- خ
|
| 148 |
+
- د
|
| 149 |
+
- ذ
|
| 150 |
+
- ر
|
| 151 |
+
- ز
|
| 152 |
+
- س
|
| 153 |
+
- ش
|
| 154 |
+
- ص
|
| 155 |
+
- ض
|
| 156 |
+
- ط
|
| 157 |
+
- ظ
|
| 158 |
+
- ع
|
| 159 |
+
- غ
|
| 160 |
+
- ف
|
| 161 |
+
- ق
|
| 162 |
+
- ل
|
| 163 |
+
- م
|
| 164 |
+
- ن
|
| 165 |
+
- ه
|
| 166 |
+
- و
|
| 167 |
+
- ً
|
| 168 |
+
- ٌ
|
| 169 |
+
- ٍ
|
| 170 |
+
- َ
|
| 171 |
+
- ُ
|
| 172 |
+
- ِ
|
| 173 |
+
- ّ
|
| 174 |
+
- ْ
|
| 175 |
+
- ٔ
|
| 176 |
+
- ٪
|
| 177 |
+
- ٫
|
| 178 |
+
- ٬
|
| 179 |
+
- ٰ
|
| 180 |
+
- پ
|
| 181 |
+
- چ
|
| 182 |
+
- ژ
|
| 183 |
+
- ک
|
| 184 |
+
- گ
|
| 185 |
+
- ھ
|
| 186 |
+
- ۀ
|
| 187 |
+
- ی
|
| 188 |
+
- ە
|
| 189 |
+
- ۰
|
| 190 |
+
- ۱
|
| 191 |
+
- ۲
|
| 192 |
+
- ۳
|
| 193 |
+
- ۴
|
| 194 |
+
- ۵
|
| 195 |
+
- ۶
|
| 196 |
+
- ۷
|
| 197 |
+
- ۸
|
| 198 |
+
- ۹
|
| 199 |
+
-
|
| 200 |
+
- –
|
| 201 |
+
- ’
|
| 202 |
+
- “
|
| 203 |
+
- ”
|
| 204 |
+
- •
|
| 205 |
+
- …
|