Add v5 YAML configs
Browse files- PP-OCRv5_server_rec.yml +136 -0
PP-OCRv5_server_rec.yml
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Global:
|
| 2 |
+
model_name: PP-OCRv5_server_rec # To use static model for inference.
|
| 3 |
+
debug: false
|
| 4 |
+
use_gpu: true
|
| 5 |
+
epoch_num: 75
|
| 6 |
+
log_smooth_window: 20
|
| 7 |
+
print_batch_step: 10
|
| 8 |
+
save_model_dir: ./output/PP-OCRv5_server_rec
|
| 9 |
+
save_epoch_step: 1
|
| 10 |
+
eval_batch_step: [0, 2000]
|
| 11 |
+
cal_metric_during_train: true
|
| 12 |
+
calc_epoch_interval: 1
|
| 13 |
+
pretrained_model:
|
| 14 |
+
checkpoints:
|
| 15 |
+
save_inference_dir:
|
| 16 |
+
use_visualdl: false
|
| 17 |
+
infer_img: doc/imgs_words/ch/word_1.jpg
|
| 18 |
+
character_dict_path: ./pytorchocr/utils/dict/ppocrv5_dict.txt
|
| 19 |
+
max_text_length: &max_text_length 25
|
| 20 |
+
infer_mode: false
|
| 21 |
+
use_space_char: true
|
| 22 |
+
distributed: true
|
| 23 |
+
save_res_path: ./output/rec/predicts_ppocrv5.txt
|
| 24 |
+
d2s_train_image_shape: [3, 48, 320]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
Optimizer:
|
| 28 |
+
name: Adam
|
| 29 |
+
beta1: 0.9
|
| 30 |
+
beta2: 0.999
|
| 31 |
+
lr:
|
| 32 |
+
name: Cosine
|
| 33 |
+
learning_rate: 0.0005
|
| 34 |
+
warmup_epoch: 1
|
| 35 |
+
regularizer:
|
| 36 |
+
name: L2
|
| 37 |
+
factor: 3.0e-05
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
Architecture:
|
| 41 |
+
model_type: rec
|
| 42 |
+
algorithm: SVTR_HGNet
|
| 43 |
+
Transform:
|
| 44 |
+
Backbone:
|
| 45 |
+
name: PPHGNetV2_B4
|
| 46 |
+
text_rec: True
|
| 47 |
+
Head:
|
| 48 |
+
name: MultiHead
|
| 49 |
+
head_list:
|
| 50 |
+
- CTCHead:
|
| 51 |
+
Neck:
|
| 52 |
+
name: svtr
|
| 53 |
+
dims: 120
|
| 54 |
+
depth: 2
|
| 55 |
+
hidden_dims: 120
|
| 56 |
+
kernel_size: [1, 3]
|
| 57 |
+
use_guide: True
|
| 58 |
+
Head:
|
| 59 |
+
fc_decay: 0.00001
|
| 60 |
+
- NRTRHead:
|
| 61 |
+
nrtr_dim: 384
|
| 62 |
+
max_text_length: *max_text_length
|
| 63 |
+
|
| 64 |
+
Loss:
|
| 65 |
+
name: MultiLoss
|
| 66 |
+
loss_config_list:
|
| 67 |
+
- CTCLoss:
|
| 68 |
+
- NRTRLoss:
|
| 69 |
+
|
| 70 |
+
PostProcess:
|
| 71 |
+
name: CTCLabelDecode
|
| 72 |
+
|
| 73 |
+
Metric:
|
| 74 |
+
name: RecMetric
|
| 75 |
+
main_indicator: acc
|
| 76 |
+
|
| 77 |
+
Train:
|
| 78 |
+
dataset:
|
| 79 |
+
name: MultiScaleDataSet
|
| 80 |
+
ds_width: false
|
| 81 |
+
data_dir: ./train_data/
|
| 82 |
+
ext_op_transform_idx: 1
|
| 83 |
+
label_file_list:
|
| 84 |
+
- ./train_data/train_list.txt
|
| 85 |
+
transforms:
|
| 86 |
+
- DecodeImage:
|
| 87 |
+
img_mode: BGR
|
| 88 |
+
channel_first: false
|
| 89 |
+
- RecAug:
|
| 90 |
+
- MultiLabelEncode:
|
| 91 |
+
gtc_encode: NRTRLabelEncode
|
| 92 |
+
- KeepKeys:
|
| 93 |
+
keep_keys:
|
| 94 |
+
- image
|
| 95 |
+
- label_ctc
|
| 96 |
+
- label_gtc
|
| 97 |
+
- length
|
| 98 |
+
- valid_ratio
|
| 99 |
+
sampler:
|
| 100 |
+
name: MultiScaleSampler
|
| 101 |
+
scales: [[320, 32], [320, 48], [320, 64]]
|
| 102 |
+
first_bs: &bs 128
|
| 103 |
+
fix_bs: false
|
| 104 |
+
divided_factor: [8, 16] # w, h
|
| 105 |
+
is_training: True
|
| 106 |
+
loader:
|
| 107 |
+
shuffle: true
|
| 108 |
+
batch_size_per_card: *bs
|
| 109 |
+
drop_last: true
|
| 110 |
+
num_workers: 16
|
| 111 |
+
Eval:
|
| 112 |
+
dataset:
|
| 113 |
+
name: SimpleDataSet
|
| 114 |
+
data_dir: ./train_data
|
| 115 |
+
label_file_list:
|
| 116 |
+
- ./train_data/val_list.txt
|
| 117 |
+
transforms:
|
| 118 |
+
- DecodeImage:
|
| 119 |
+
img_mode: BGR
|
| 120 |
+
channel_first: false
|
| 121 |
+
- MultiLabelEncode:
|
| 122 |
+
gtc_encode: NRTRLabelEncode
|
| 123 |
+
- RecResizeImg:
|
| 124 |
+
image_shape: [3, 48, 320]
|
| 125 |
+
- KeepKeys:
|
| 126 |
+
keep_keys:
|
| 127 |
+
- image
|
| 128 |
+
- label_ctc
|
| 129 |
+
- label_gtc
|
| 130 |
+
- length
|
| 131 |
+
- valid_ratio
|
| 132 |
+
loader:
|
| 133 |
+
shuffle: false
|
| 134 |
+
drop_last: false
|
| 135 |
+
batch_size_per_card: 128
|
| 136 |
+
num_workers: 4
|