first commit
Some checks are pending
Build/Publish Develop Docs / deploy (push) Waiting to run

This commit is contained in:
2025-07-02 08:57:16 +03:00
commit 56532cc9a9
1901 changed files with 457695 additions and 0 deletions

View File

@@ -0,0 +1,163 @@
Global:
model_type: det
model_dir: ./models/ch_PP-OCRv4_det_infer
model_filename: inference.pdmodel
params_filename: inference.pdiparams
algorithm: DB
Distillation:
alpha: 1.0
loss: l2
QuantAware:
use_pact: false
activation_bits: 8
is_full_quantize: false
onnx_format: false
activation_quantize_type: moving_average_abs_max
weight_quantize_type: channel_wise_abs_max
not_quant_pattern:
- skip_quant
quantize_op_types:
- conv2d
weight_bits: 8
TrainConfig:
epochs: 2
eval_iter: 200
learning_rate:
type: CosineAnnealingDecay
learning_rate: 0.000005
optimizer_builder:
optimizer:
type: Adam
weight_decay: 5.0e-05
PostProcess:
name: DBPostProcess
thresh: 0.3
box_thresh: 0.6
max_candidates: 1000
unclip_ratio: 1.5
Metric:
name: DetMetric
main_indicator: hmean
Train:
dataset:
name: SimpleDataSet
data_dir: datasets/chinese
label_file_list:
- datasets/chinese/zhongce_training_fix_1.6k.txt
- datasets/chinese/label_train_all_f4_part2.txt
- datasets/chinese/label_train_all_f4_part3.txt
- datasets/chinese/label_train_all_f4_part4.txt
- datasets/chinese/label_train_all_f4_part5.txt
- datasets/chinese/synth_en_my_clip.txt
- datasets/chinese/synth_ch_my_clip.txt
- datasets/chinese/synth_en_my_largeword_clip.txt
ratio_list:
- 0.3
- 0.2
- 0.1
- 0.2
- 0.2
- 0.1
- 0.2
- 0.2
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- DetLabelEncode: null
- IaaAugment:
augmenter_args:
- type: Fliplr
args:
p: 0.5
- type: Affine
args:
rotate:
- -10
- 10
- type: Resize
args:
size:
- 0.5
- 3
- EastRandomCropData:
size:
- 960
- 960
max_tries: 50
keep_ratio: true
- MakeBorderMap:
shrink_ratio: 0.4
thresh_min: 0.3
thresh_max: 0.7
- MakeShrinkMap:
shrink_ratio: 0.4
min_text_size: 8
- NormalizeImage:
scale: 1./255.
mean:
- 0.485
- 0.456
- 0.406
std:
- 0.229
- 0.224
- 0.225
order: hwc
- ToCHWImage: null
- KeepKeys:
keep_keys:
- image
- threshold_map
- threshold_mask
- shrink_map
- shrink_mask
loader:
shuffle: true
drop_last: false
batch_size_per_card: 4
num_workers: 4
Eval:
dataset:
name: SimpleDataSet
data_dir: datasets/v4_4_test_dataset
label_file_list:
- datasets/v4_4_test_dataset/label.txt
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- DetLabelEncode: null
- DetResizeForTest:
limit_side_len: 960
limit_type: max
- NormalizeImage:
scale: 1./255.
mean:
- 0.485
- 0.456
- 0.406
std:
- 0.229
- 0.224
- 0.225
order: hwc
- ToCHWImage: null
- KeepKeys:
keep_keys:
- image
- shape
- polys
- ignore_tags
loader:
shuffle: false
drop_last: false
batch_size_per_card: 1
num_workers: 10

View File

@@ -0,0 +1,161 @@
Global:
model_type: det
model_dir: ./models/ch_PP-OCRv4_det_server_infer
model_filename: inference.pdmodel
params_filename: inference.pdiparams
algorithm: DB
Distillation:
alpha: 1.0
loss: l2
QuantAware:
use_pact: false
activation_bits: 8
is_full_quantize: false
onnx_format: false
activation_quantize_type: moving_average_abs_max
weight_quantize_type: channel_wise_abs_max
not_quant_pattern:
- skip_quant
quantize_op_types:
- conv2d
weight_bits: 8
TrainConfig:
epochs: 1
eval_iter: 200
learning_rate:
type: CosineAnnealingDecay
learning_rate: 0.000005
optimizer_builder:
optimizer:
type: Adam
weight_decay: 5.0e-05
PostProcess:
name: DBPostProcess
thresh: 0.3
box_thresh: 0.6
max_candidates: 1000
unclip_ratio: 1.5
Metric:
name: DetMetric
main_indicator: hmean
Train:
dataset:
name: SimpleDataSet
data_dir: datasets/chinese
label_file_list:
- datasets/chinese/zhongce_training_fix_1.6k.txt
- datasets/chinese/label_train_all_f4_part2.txt
- datasets/chinese/label_train_all_f4_part3.txt
- datasets/chinese/label_train_all_f4_part4.txt
- datasets/chinese/label_train_all_f4_part5.txt
- datasets/chinese/synth_en_my_clip.txt
- datasets/chinese/synth_ch_my_clip.txt
- datasets/chinese/synth_en_my_largeword_clip.txt
ratio_list:
- 0.3
- 0.2
- 0.1
- 0.2
- 0.2
- 0.1
- 0.2
- 0.2
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- DetLabelEncode: null
- IaaAugment:
augmenter_args:
- type: Fliplr
args:
p: 0.5
- type: Affine
args:
rotate:
- -10
- 10
- type: Resize
args:
size:
- 0.5
- 3
- EastRandomCropData:
size:
- 960
- 960
max_tries: 50
keep_ratio: true
- MakeBorderMap:
shrink_ratio: 0.4
thresh_min: 0.3
thresh_max: 0.7
- MakeShrinkMap:
shrink_ratio: 0.4
min_text_size: 8
- NormalizeImage:
scale: 1./255.
mean:
- 0.485
- 0.456
- 0.406
std:
- 0.229
- 0.224
- 0.225
order: hwc
- ToCHWImage: null
- KeepKeys:
keep_keys:
- image
- threshold_map
- threshold_mask
- shrink_map
- shrink_mask
loader:
shuffle: true
drop_last: false
batch_size_per_card: 2
num_workers: 8
Eval:
dataset:
name: SimpleDataSet
data_dir: datasets/v4_4_test_dataset_small
label_file_list:
- datasets/v4_4_test_dataset_small/label.txt
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- DetLabelEncode: null
- DetResizeForTest: null
- NormalizeImage:
scale: 1./255.
mean:
- 0.485
- 0.456
- 0.406
std:
- 0.229
- 0.224
- 0.225
order: hwc
- ToCHWImage: null
- KeepKeys:
keep_keys:
- image
- shape
- polys
- ignore_tags
loader:
shuffle: false
drop_last: false
batch_size_per_card: 1
num_workers: 2

View File

@@ -0,0 +1,115 @@
Global:
model_dir: ./models/ch_PP-OCRv4_rec_infer
model_filename: inference.pdmodel
params_filename: inference.pdiparams
model_type: rec
algorithm: SVTR
character_dict_path: ./ppocr_keys_v1.txt
max_text_length: &max_text_length 25
use_space_char: true
Distillation:
alpha: [1.0, 1.0]
loss: ['skd', 'l2']
node:
- ['softmax_11.tmp_0']
- ['linear_170.tmp_1']
QuantAware:
use_pact: false
activation_bits: 8
is_full_quantize: false
onnx_format: false
activation_quantize_type: moving_average_abs_max
weight_quantize_type: channel_wise_abs_max
not_quant_pattern:
- skip_quant
quantize_op_types:
- conv2d
weight_bits: 8
TrainConfig:
epochs: 1
eval_iter: 1000
logging_iter: 100
learning_rate:
type: CosineAnnealingDecay
learning_rate: 0.00001
optimizer_builder:
optimizer:
type: Adam
weight_decay: 5.0e-05
PostProcess:
name: CTCLabelDecode
Metric:
name: RecMetric
main_indicator: acc
ignore_space: False
Train:
dataset:
name: MultiScaleDataSet
ds_width: false
data_dir: datasets/real_data/
label_file_list:
- datasets/real_data/train_list.txt
ext_op_transform_idx: 1
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- RecConAug:
prob: 0.5
ext_data_num: 2
image_shape: [48, 320, 3]
max_text_length: *max_text_length
- RecAug:
- MultiLabelEncode:
gtc_encode: NRTRLabelEncode
- KeepKeys:
keep_keys:
- image
- label_ctc
- label_gtc
- length
- valid_ratio
sampler:
name: MultiScaleSampler
scales: [[320, 32], [320, 48], [320, 64]]
first_bs: &bs 64
fix_bs: false
divided_factor: [8, 16] # w, h
is_training: True
loader:
shuffle: true
batch_size_per_card: *bs
drop_last: true
num_workers: 8
Eval:
dataset:
name: SimpleDataSet
data_dir: datasets/real_data/
label_file_list:
- datasets/real_data/val_list.txt
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- MultiLabelEncode:
gtc_encode: NRTRLabelEncode
- RecResizeImg:
image_shape: [3, 48, 320]
- KeepKeys:
keep_keys:
- image
- label_ctc
- label_gtc
- length
- valid_ratio
loader:
shuffle: false
drop_last: false
batch_size_per_card: 1
num_workers: 4

View File

@@ -0,0 +1,113 @@
Global:
model_dir: ./models/ch_PP-OCRv4_rec_server_infer
model_filename: inference.pdmodel
params_filename: inference.pdiparams
model_type: rec
algorithm: SVTR
character_dict_path: ./ppocr_keys_v1.txt
max_text_length: &max_text_length 25
use_space_char: true
Distillation:
alpha: 1.0
loss: 'l2'
QuantAware:
use_pact: false
activation_bits: 8
is_full_quantize: false
onnx_format: false
activation_quantize_type: moving_average_abs_max
weight_quantize_type: channel_wise_abs_max
not_quant_pattern:
- skip_quant
quantize_op_types:
- conv2d
weight_bits: 8
TrainConfig:
epochs: 1
eval_iter: 1000
logging_iter: 100
learning_rate:
type: CosineAnnealingDecay
learning_rate: 0.00001
optimizer_builder:
optimizer:
type: Adam
weight_decay: 5.0e-05
PostProcess:
name: CTCLabelDecode
Metric:
name: RecMetric
main_indicator: acc
ignore_space: False
Train:
dataset:
name: MultiScaleDataSet
ds_width: false
data_dir: datasets/real_data/
ext_op_transform_idx: 1
label_file_list:
- datasets/real_data/train_list.txt
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- RecConAug:
prob: 0.5
ext_data_num: 2
image_shape: [48, 320, 3]
max_text_length: *max_text_length
- RecAug:
- MultiLabelEncode:
gtc_encode: NRTRLabelEncode
- KeepKeys:
keep_keys:
- image
- label_ctc
- label_gtc
- length
- valid_ratio
sampler:
name: MultiScaleSampler
scales: [[320, 32], [320, 48], [320, 64]]
first_bs: &bs 64
fix_bs: false
divided_factor: [8, 16] # w, h
is_training: True
loader:
shuffle: true
batch_size_per_card: *bs
drop_last: true
num_workers: 8
Eval:
dataset:
name: SimpleDataSet
data_dir: datasets/real_data/
label_file_list:
- datasets/real_data/val_list.txt
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- MultiLabelEncode:
gtc_encode: NRTRLabelEncode
- RecResizeImg:
image_shape: [3, 48, 320]
- KeepKeys:
keep_keys:
- image
- label_ctc
- label_gtc
- length
- valid_ratio
loader:
shuffle: false
drop_last: false
batch_size_per_card: 1
num_workers: 4