PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
44.48k stars 7.84k forks source link

Training For Greek Language #8706

Closed Ham714 closed 1 year ago

Ham714 commented 1 year ago

First of of thank you for this wonderful work. I want to trained Paddle-OCR for Greek+English language. Can anyone guide me the flow of this problem.plz

an1018 commented 1 year ago

You can refer to detection document and recognition document. If you still have any question, please contact us again~

Ham714 commented 1 year ago

i just trained the model for detection in 2 days but after that i got h-mean = 0 and when I test the model it gives an empty box. Please guide @an1018

Ham714 commented 1 year ago

You can refer to detection document and recognition document. If you still have any question, please contact us again~

sorry im new to this field thats why im asking and training takes too much time

an1018 commented 1 year ago

Could you share your training config?

Ham714 commented 1 year ago

Could you share your training config?

Global: use_gpu: False epoch_num: 500 log_smooth_window: 20 print_batch_step: 10 save_model_dir: ./output/db_mv3/ save_epoch_step: 10

evaluation is run every 2000 iterations

eval_batch_step: [0, 2000] cal_metric_during_train: False pretrained_model: C:\Users\Muhammad Hamza\Downloads\PaddleOCR\tools\pretrain_models\MobileNetV3_large_x0_5_pretrained checkpoints: save_inference_dir: use_visualdl: False infer_img: C:\Users\Muhammad Hamza\Downloads\PaddleOCR\tools\GreekDataSet\inference save_res_path: ./output/det_db/predicts_db.txt

Architecture: model_type: det algorithm: DB Transform: Backbone: name: MobileNetV3 scale: 0.5 model_name: large Neck: name: DBFPN out_channels: 256 Head: name: DBHead k: 50

Loss: name: DBLoss balance_loss: true main_loss_type: DiceLoss alpha: 5 beta: 10 ohem_ratio: 3

Optimizer: name: Adam beta1: 0.9 beta2: 0.999 lr: learning_rate: 0.001 regularizer: name: 'L2' factor: 0

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: C:\Users\Muhammad Hamza\Downloads\PaddleOCR\tools\GreekDataSet label_file_list: [C:\Users\Muhammad Hamza\Downloads\PaddleOCR\tools\GreekDataSet\Train\Label.txt] ratio_list: [1.0] transforms:

Eval: dataset: name: SimpleDataSet data_dir: C:\Users\Muhammad Hamza\Downloads\PaddleOCR\tools\GreekDataSet label_file_list: [C:\Users\Muhammad Hamza\Downloads\PaddleOCR\tools\GreekDataSet\Test\Label.txt] transforms:

Ham714 commented 1 year ago

this one is rec config.... it also giving accuracy = 0

Global: use_gpu: False epoch_num: 500 log_smooth_window: 20 print_batch_step: 10 save_model_dir: ./output/rec/svt/ save_epoch_step: 3

evaluation is run every 2000 iterations after the 0th iteration

eval_batch_step: [0, 2000] cal_metric_during_train: True pretrained_model: checkpoints: save_inference_dir: use_visualdl: False infer_img: C:\Users\Muhammad Hamza\Downloads\PaddleOCR\tools\PaddleOCR Dataset\sample.jpg

for data or label process

character_dict_path: ./PaddleOCR Dataset/greek_char.txt max_text_length: 25 infer_mode: True use_space_char: False save_res_path: ./output/rec/predicts_svtr_tiny_bn.txt

Optimizer: name: AdamW beta1: 0.9 beta2: 0.99 epsilon: 0.00000008 weight_decay: 0.05 no_weight_decay_name: norm pos_embed one_dim_param_no_weight_decay: true lr: name: Cosine learning_rate: 0.00025 warmup_epoch: 10

Architecture: model_type: rec algorithm: SVTR Transform: name: STN_ON tps_inputsize: [32, 64] tps_outputsize: [32, 100] num_control_points: 20 tps_margins: [0.05,0.05] stn_activation: none Backbone: name: SVTRNet img_size: [32, 100] out_char_num: 25 out_channels: 192 patch_merging: 'Conv' embed_dim: [64, 128, 256] depth: [3, 6, 3] num_heads: [2, 4, 8] mixer: ['Local','Local','Local','Local','Local','Local','Global','Global','Global','Global','Global','Global'] local_mixer: [[7, 11], [7, 11], [7, 11]] last_stage: True prenorm: false Neck: name: SequenceEncoder encoder_type: reshape Head: name: CTCHead

Loss: name: CTCLoss

PostProcess: name: CTCLabelDecode

Metric: name: RecMetric main_indicator: acc

Train: dataset: name : SimpleDataSet data_dir : C:\Users\Muhammad Hamza\Downloads\PaddleOCR\tools\PaddleOCR Dataset\train label_file_list : [C:\Users\Muhammad Hamza\Downloads\PaddleOCR\tools\PaddleOCR Dataset\train\rec_gt.txt] ratio_list: [0.1] transforms:

Eval: dataset: name : SimpleDataSet data_dir : C:\Users\Muhammad Hamza\Downloads\PaddleOCR\tools\PaddleOCR Dataset\test label_file_list : [C:\Users\Muhammad Hamza\Downloads\PaddleOCR\tools\PaddleOCR Dataset\test\rec_gt.txt]

ratio_list: [0.1]

transforms:
  - DecodeImage: # load image
      img_mode: BGR
      channel_first: False
  - CTCLabelEncode: # Class handling label
  - SVTRRecResizeImg:
      character_dict_path:
      image_shape: [3, 64, 256]
      padding: False
  - KeepKeys:
      keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order

loader: shuffle: False drop_last: False batch_size_per_card: 8 num_workers: 2

Ham714 commented 1 year ago

Could you share your training config?

actually right now im using small dataset to check if it giving some result after that i will work on big dataset. im being following all that is written in the documentation

Ham714 commented 1 year ago

Could you share your training config?

@an1018

an1018 commented 1 year ago

On the small dataset,is h_mean still 0?

Ham714 commented 1 year ago

On the small dataset,is h_mean still 0?

yes they are single words of greek and english alphabets both written and printed 800 for training and 300 for eval @an1018

Ham714 commented 1 year ago

On the small dataset,is h_mean still 0?

yes they are single words of greek and english alphabets both written and printed 800 for training and 300 for eval @an1018

Ham714 commented 1 year ago

@an1018 sorry i mistakenly close the issue

an1018 commented 1 year ago

Could you share some images, and the size of the image?

Ham714 commented 1 year ago

PaddleOCR Dataset.zip this dataset i am using @an1018

Ham714 commented 1 year ago

@an1018 i thought may be the dataset im using have some problems that i use this one GreekDataSet.zip

Ham714 commented 1 year ago

@an1018 they are just used for testing purpose if i get some accuracy in this than i will prepare some big dataset for Greek language

Ham714 commented 1 year ago

@an1018 ??

Ham714 commented 1 year ago

Could you share some images, and the size of the image? @an1018 Plz Guide me

masoudMZB commented 1 year ago

same here. tried to train models on my own dataset. even tried to just test pretrained models(no training ) . still hmean 0 and empty boxes for detections

models/configs are from here : https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/doc/doc_en/models_list_en.md#1.3

and training/ testing process : https://github.com/PaddlePaddle/PaddleOCR/blob/release%2F2.6/doc/doc_en/detection_en.md

@LDOUBLEV @an1018 @andyjpaddle