Upload 2 files
Browse files- detection_config.yml +135 -0
- recognition_config.yml +133 -0
detection_config.yml
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Global:
|
| 2 |
+
use_gpu: true
|
| 3 |
+
use_xpu: false
|
| 4 |
+
use_mlu: false
|
| 5 |
+
epoch_num: 50
|
| 6 |
+
log_smooth_window: 20
|
| 7 |
+
print_batch_step: 10
|
| 8 |
+
save_model_dir: output/detection
|
| 9 |
+
save_epoch_step: 1000
|
| 10 |
+
# evaluation is run every 2000 iterations
|
| 11 |
+
eval_batch_step: [0, 2000]
|
| 12 |
+
cal_metric_during_train: False
|
| 13 |
+
pretrained_model: pretrained_models/detection/MobileNetV3_large_x0_5_pretrained.pdparams
|
| 14 |
+
checkpoints:
|
| 15 |
+
save_inference_dir:
|
| 16 |
+
use_visualdl: False
|
| 17 |
+
infer_img:
|
| 18 |
+
save_res_path:
|
| 19 |
+
|
| 20 |
+
Architecture:
|
| 21 |
+
model_type: det
|
| 22 |
+
algorithm: DB
|
| 23 |
+
Transform:
|
| 24 |
+
Backbone:
|
| 25 |
+
name: MobileNetV3
|
| 26 |
+
scale: 0.5
|
| 27 |
+
model_name: large
|
| 28 |
+
Neck:
|
| 29 |
+
name: DBFPN
|
| 30 |
+
out_channels: 256
|
| 31 |
+
Head:
|
| 32 |
+
name: DBHead
|
| 33 |
+
k: 50
|
| 34 |
+
|
| 35 |
+
Loss:
|
| 36 |
+
name: DBLoss
|
| 37 |
+
balance_loss: true
|
| 38 |
+
main_loss_type: DiceLoss
|
| 39 |
+
alpha: 5
|
| 40 |
+
beta: 10
|
| 41 |
+
ohem_ratio: 3
|
| 42 |
+
|
| 43 |
+
Optimizer:
|
| 44 |
+
name: Adam
|
| 45 |
+
beta1: 0.9
|
| 46 |
+
beta2: 0.999
|
| 47 |
+
lr:
|
| 48 |
+
name: Cosine
|
| 49 |
+
learning_rate: 0.001 # learning_rate
|
| 50 |
+
warmup_epoch: 2
|
| 51 |
+
regularizer:
|
| 52 |
+
name: 'L2'
|
| 53 |
+
factor: 0
|
| 54 |
+
|
| 55 |
+
PostProcess:
|
| 56 |
+
name: DBPostProcess
|
| 57 |
+
thresh: 0.3
|
| 58 |
+
box_thresh: 0.6
|
| 59 |
+
max_candidates: 1000
|
| 60 |
+
unclip_ratio: 1.5
|
| 61 |
+
|
| 62 |
+
Metric:
|
| 63 |
+
name: DetMetric
|
| 64 |
+
main_indicator: hmean
|
| 65 |
+
|
| 66 |
+
Train:
|
| 67 |
+
dataset:
|
| 68 |
+
name: SimpleDataSet
|
| 69 |
+
data_dir: ./
|
| 70 |
+
label_file_list:
|
| 71 |
+
- dataset/detection_train.txt
|
| 72 |
+
ratio_list: [1.0]
|
| 73 |
+
transforms:
|
| 74 |
+
- DecodeImage: # load image
|
| 75 |
+
img_mode: BGR
|
| 76 |
+
channel_first: False
|
| 77 |
+
- DetLabelEncode: # Class handling label
|
| 78 |
+
- IaaAugment:
|
| 79 |
+
augmenter_args:
|
| 80 |
+
- { 'type': Fliplr, 'args': { 'p': 0.5 } }
|
| 81 |
+
- { 'type': Affine, 'args': { 'rotate': [-10, 10] } }
|
| 82 |
+
- { 'type': Resize, 'args': { 'size': [0.5, 3] } }
|
| 83 |
+
- EastRandomCropData:
|
| 84 |
+
size: [640, 640]
|
| 85 |
+
max_tries: 50
|
| 86 |
+
keep_ratio: true
|
| 87 |
+
- MakeBorderMap:
|
| 88 |
+
shrink_ratio: 0.4
|
| 89 |
+
thresh_min: 0.3
|
| 90 |
+
thresh_max: 0.7
|
| 91 |
+
- MakeShrinkMap:
|
| 92 |
+
shrink_ratio: 0.4
|
| 93 |
+
min_text_size: 8
|
| 94 |
+
- NormalizeImage:
|
| 95 |
+
scale: 1./255.
|
| 96 |
+
mean: [0.485, 0.456, 0.406]
|
| 97 |
+
std: [0.229, 0.224, 0.225]
|
| 98 |
+
order: 'hwc'
|
| 99 |
+
- ToCHWImage:
|
| 100 |
+
- KeepKeys:
|
| 101 |
+
keep_keys: ['image', 'threshold_map', 'threshold_mask', 'shrink_map', 'shrink_mask'] # the order of the dataloader list
|
| 102 |
+
loader:
|
| 103 |
+
shuffle: True
|
| 104 |
+
drop_last: False
|
| 105 |
+
batch_size_per_card: 8
|
| 106 |
+
num_workers: 4
|
| 107 |
+
use_shared_memory: True
|
| 108 |
+
|
| 109 |
+
Eval:
|
| 110 |
+
dataset:
|
| 111 |
+
name: SimpleDataSet
|
| 112 |
+
data_dir: ./
|
| 113 |
+
label_file_list:
|
| 114 |
+
- dataset/detection_test.txt
|
| 115 |
+
transforms:
|
| 116 |
+
- DecodeImage: # load image
|
| 117 |
+
img_mode: BGR
|
| 118 |
+
channel_first: False
|
| 119 |
+
- DetLabelEncode: # Class handling label
|
| 120 |
+
- DetResizeForTest:
|
| 121 |
+
image_shape: [736, 1280]
|
| 122 |
+
- NormalizeImage:
|
| 123 |
+
scale: 1./255.
|
| 124 |
+
mean: [0.485, 0.456, 0.406]
|
| 125 |
+
std: [0.229, 0.224, 0.225]
|
| 126 |
+
order: 'hwc'
|
| 127 |
+
- ToCHWImage:
|
| 128 |
+
- KeepKeys:
|
| 129 |
+
keep_keys: ['image', 'shape', 'polys', 'ignore_tags']
|
| 130 |
+
loader:
|
| 131 |
+
shuffle: False
|
| 132 |
+
drop_last: False
|
| 133 |
+
batch_size_per_card: 1 # must be 1
|
| 134 |
+
num_workers: 4
|
| 135 |
+
use_shared_memory: True
|
recognition_config.yml
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Global:
|
| 2 |
+
debug: false
|
| 3 |
+
use_gpu: true
|
| 4 |
+
epoch_num: 50
|
| 5 |
+
log_smooth_window: 20
|
| 6 |
+
print_batch_step: 10
|
| 7 |
+
save_model_dir: output/recognition
|
| 8 |
+
save_epoch_step: 100
|
| 9 |
+
eval_batch_step: [0, 2000]
|
| 10 |
+
cal_metric_during_train: true
|
| 11 |
+
pretrained_model: pretrained_models/recognition/en_PP-OCRv3_rec_train/best_accuracy.pdparams
|
| 12 |
+
checkpoints:
|
| 13 |
+
save_inference_dir:
|
| 14 |
+
use_visualdl: false
|
| 15 |
+
infer_img:
|
| 16 |
+
character_dict_path: PaddleOCR/ppocr/utils/en_dict.txt
|
| 17 |
+
max_text_length: &max_text_length 25
|
| 18 |
+
infer_mode: false
|
| 19 |
+
use_space_char: true
|
| 20 |
+
distributed: true
|
| 21 |
+
save_res_path: output/recognition/predicts/text.txt
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
Optimizer:
|
| 25 |
+
name: Adam
|
| 26 |
+
beta1: 0.9
|
| 27 |
+
beta2: 0.999
|
| 28 |
+
lr:
|
| 29 |
+
name: Cosine
|
| 30 |
+
learning_rate: 0.001
|
| 31 |
+
warmup_epoch: 5
|
| 32 |
+
regularizer:
|
| 33 |
+
name: L2
|
| 34 |
+
factor: 3.0e-05
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
Architecture:
|
| 38 |
+
model_type: rec
|
| 39 |
+
algorithm: SVTR_LCNet
|
| 40 |
+
Transform:
|
| 41 |
+
Backbone:
|
| 42 |
+
name: MobileNetV1Enhance
|
| 43 |
+
scale: 0.5
|
| 44 |
+
last_conv_stride: [1, 2]
|
| 45 |
+
last_pool_type: avg
|
| 46 |
+
last_pool_kernel_size: [2, 2]
|
| 47 |
+
Head:
|
| 48 |
+
name: MultiHead
|
| 49 |
+
head_list:
|
| 50 |
+
- CTCHead:
|
| 51 |
+
Neck:
|
| 52 |
+
name: svtr
|
| 53 |
+
dims: 64
|
| 54 |
+
depth: 2
|
| 55 |
+
hidden_dims: 120
|
| 56 |
+
use_guide: True
|
| 57 |
+
Head:
|
| 58 |
+
fc_decay: 0.00001
|
| 59 |
+
- SARHead:
|
| 60 |
+
enc_dim: 512
|
| 61 |
+
max_text_length: *max_text_length
|
| 62 |
+
|
| 63 |
+
Loss:
|
| 64 |
+
name: MultiLoss
|
| 65 |
+
loss_config_list:
|
| 66 |
+
- CTCLoss:
|
| 67 |
+
- SARLoss:
|
| 68 |
+
|
| 69 |
+
PostProcess:
|
| 70 |
+
name: CTCLabelDecode
|
| 71 |
+
|
| 72 |
+
Metric:
|
| 73 |
+
name: RecMetric
|
| 74 |
+
main_indicator: acc
|
| 75 |
+
ignore_space: False
|
| 76 |
+
|
| 77 |
+
Train:
|
| 78 |
+
dataset:
|
| 79 |
+
name: SimpleDataSet
|
| 80 |
+
data_dir: ./
|
| 81 |
+
ext_op_transform_idx: 1
|
| 82 |
+
label_file_list:
|
| 83 |
+
- dataset/recognition_train.txt
|
| 84 |
+
transforms:
|
| 85 |
+
- DecodeImage:
|
| 86 |
+
img_mode: BGR
|
| 87 |
+
channel_first: false
|
| 88 |
+
- RecConAug:
|
| 89 |
+
prob: 0.5
|
| 90 |
+
ext_data_num: 2
|
| 91 |
+
image_shape: [48, 320, 3]
|
| 92 |
+
max_text_length: *max_text_length
|
| 93 |
+
- RecAug:
|
| 94 |
+
- MultiLabelEncode:
|
| 95 |
+
- RecResizeImg:
|
| 96 |
+
image_shape: [3, 48, 320]
|
| 97 |
+
- KeepKeys:
|
| 98 |
+
keep_keys:
|
| 99 |
+
- image
|
| 100 |
+
- label_ctc
|
| 101 |
+
- label_sar
|
| 102 |
+
- length
|
| 103 |
+
- valid_ratio
|
| 104 |
+
loader:
|
| 105 |
+
shuffle: true
|
| 106 |
+
batch_size_per_card: 128
|
| 107 |
+
drop_last: true
|
| 108 |
+
num_workers: 4
|
| 109 |
+
Eval:
|
| 110 |
+
dataset:
|
| 111 |
+
name: SimpleDataSet
|
| 112 |
+
data_dir: ./
|
| 113 |
+
label_file_list:
|
| 114 |
+
- dataset/recognition_test.txt
|
| 115 |
+
transforms:
|
| 116 |
+
- DecodeImage:
|
| 117 |
+
img_mode: BGR
|
| 118 |
+
channel_first: false
|
| 119 |
+
- MultiLabelEncode:
|
| 120 |
+
- RecResizeImg:
|
| 121 |
+
image_shape: [3, 48, 320]
|
| 122 |
+
- KeepKeys:
|
| 123 |
+
keep_keys:
|
| 124 |
+
- image
|
| 125 |
+
- label_ctc
|
| 126 |
+
- label_sar
|
| 127 |
+
- length
|
| 128 |
+
- valid_ratio
|
| 129 |
+
loader:
|
| 130 |
+
shuffle: false
|
| 131 |
+
drop_last: false
|
| 132 |
+
batch_size_per_card: 128
|
| 133 |
+
num_workers: 4
|