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
43.9k stars 7.8k forks source link

训练车牌识别 acc 一直是 0,使用的 cpu 版本训练 #8856

Closed changyiming closed 1 year ago

changyiming commented 1 year ago

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

大老们,训练完后 acc 始终一直是0,压根就没有识别精度,不知道是什么问题了,请求大老们帮忙分析下是什么因为导致的,尝试过不同的模型最终都未能解决, 使用的数据样本是网上下载的 CCPD2019 车牌数据图片。

rec_icdar15_train.yml 配置参数:

Global:
  use_gpu: false
  epoch_num: 72
  log_smooth_window: 20
  print_batch_step: 10
  save_model_dir: ./output/db_mv3/plate_rec_v1
  save_epoch_step: 5
  # evaluation is run every 2000 iterations
  eval_batch_step: [0, 50]
  cal_metric_during_train: True
  pretrained_model: ./pretrain_models/rec_mv3_none_bilstm_ctc_v2.0_train/best_accuracy
  # pretrain_weights: ./pretrain_models/rec_mv3_none_bilstm_ctc_v2.0_train/best_accuracy
  checkpoints:
  save_inference_dir: ./
  use_visualdl: False
  infer_img: /home/ym/Downloads/r9888.png
  # for data or label process
  character_dict_path: dataset/dict.txt
  #dataset/dict.txt
  character_type: ch
  max_text_length: 9
  infer_mode: False
  use_space_char: True
  save_res_path: ./output/db_mv3/plate_rec_v1/predicts_ic15.txt

Optimizer:
  name: Adam
  beta1: 0.9
  beta2: 0.999
  lr:
    name: Cosine #add new
    learning_rate: 0.0001 #0.0005
    warmup_epoch: 5 #add new
  regularizer:
    name: 'L2'
    factor: 0.00004 #0

Architecture:
  model_type: rec
  algorithm: CRNN
  Transform:
  Backbone:
    name: ResNet #MobileNetV3
    layers: 34 #add new
    #scale: 0.5
    #model_name: large
  Neck:
    name: SequenceEncoder
    encoder_type: rnn
    hidden_size: 256 #96
  Head:
    name: CTCHead
    fc_decay: 0.00004 #0

Loss:
  name: CTCLoss

PostProcess:
  name: CTCLabelDecode

Metric:
  name: RecMetric
  main_indicator: acc

Train:
  dataset:
    name: SimpleDataSet
    data_dir: /usr/projects/PaddleOCR-release-2.6/
    #/usr/projects/PaddleOCR-release-2.6
    label_file_list: ["dataset/train_rec.txt"]
    transforms:
      - DecodeImage: # load image
          img_mode: BGR
          channel_first: False
      - RecAug: # add new
      - CTCLabelEncode: # Class handling label
      - RecResizeImg:
          image_shape: [3, 32, 320] # -> [3, 32, 100]
      - KeepKeys:
          keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  loader:
    shuffle: True
    batch_size_per_card: 256
    drop_last: True
    num_workers: 8
    #use_shared_memory: False

Eval:
  dataset:
    name: SimpleDataSet
    data_dir: /usr/projects/PaddleOCR-release-2.6/
    #/usr/projects/PaddleOCR-release-2.6
    label_file_list: ["dataset/dev_rec.txt"]
    transforms:
      - DecodeImage: # load image
          img_mode: BGR
          channel_first: False
      - CTCLabelEncode: # Class handling label
      - RecResizeImg:
          image_shape: [3, 32, 320] # -> [3, 32, 100]
      - KeepKeys:
          keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  loader:
    shuffle: False
    drop_last: False
    batch_size_per_card: 256
    num_workers: 4
    #use_shared_memory: False
Ham714 commented 1 year ago

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:Centos8 Python3.7
  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:
  • 运行指令/Command Code:[root@localhost PaddleOCR-release-2.6]# python3.7 tools/train.py -c configs/rec/rec_icdar15_train.yml
  • 完整报错/Complete Error Message: [2023/01/14 16:16:11] ppocr INFO: epoch: [2/72], global_step: 4, lr: 0.000015, acc: 0.000000, norm_edit_dis: 0.008908, loss: 296.518524, avg_reader_cost: 2.61998 s, avg_batch_cost: 188.85271 s, avg_samples: 51.2, ips: 0.27111 samples/s, eta: 1 day, 12:34:49 [2023/01/14 16:16:15] ppocr INFO: save model in ./output/db_mv3/plate_rec_v1/latest [2023/01/14 16:45:50] ppocr INFO: epoch: [3/72], global_step: 6, lr: 0.000025, acc: 0.000000, norm_edit_dis: 0.012447, loss: 291.637024, avg_reader_cost: 2.12681 s, avg_batch_cost: 177.91249 s, avg_samples: 51.2, ips: 0.28778 samples/s, eta: 1 day, 11:24:18

大老们,训练完后 acc 始终一直是0,压根就没有识别精度,不知道是什么问题了,请求大老们帮忙分析下是什么因为导致的,尝试过不同的模型最终都未能解决, 使用的数据样本是网上下载的 CCPD2019 车牌数据图片。

rec_icdar15_train.yml 配置参数: Global: use_gpu: false epoch_num: 72 log_smooth_window: 20 print_batch_step: 10 save_model_dir: ./output/db_mv3/plate_rec_v1 save_epoch_step: 5

evaluation is run every 2000 iterations

eval_batch_step: [0, 50] cal_metric_during_train: True pretrained_model: ./pretrain_models/rec_mv3_none_bilstm_ctc_v2.0_train/best_accuracy

pretrain_weights: ./pretrain_models/rec_mv3_none_bilstm_ctc_v2.0_train/best_accuracy

checkpoints: save_inference_dir: ./ use_visualdl: False infer_img: /home/ym/Downloads/r9888.png

for data or label process

character_dict_path: dataset/dict.txt #dataset/dict.txt character_type: ch max_text_length: 9 infer_mode: False use_space_char: True save_res_path: ./output/db_mv3/plate_rec_v1/predicts_ic15.txt

Optimizer: name: Adam beta1: 0.9 beta2: 0.999 lr: name: Cosine #add new learning_rate: 0.0001 #0.0005 warmup_epoch: 5 #add new regularizer: name: 'L2' factor: 0.00004 #0

Architecture: model_type: rec algorithm: CRNN Transform: Backbone: name: ResNet #MobileNetV3 layers: 34 #add new #scale: 0.5 #model_name: large Neck: name: SequenceEncoder encoder_type: rnn hidden_size: 256 #96 Head: name: CTCHead fc_decay: 0.00004 #0

Loss: name: CTCLoss

PostProcess: name: CTCLabelDecode

Metric: name: RecMetric main_indicator: acc

Train: dataset: name: SimpleDataSet data_dir: /usr/projects/PaddleOCR-release-2.6/ #/usr/projects/PaddleOCR-release-2.6 label_file_list: ["dataset/train_rec.txt"] transforms: - DecodeImage: # load image img_mode: BGR channel_first: False - RecAug: # add new - CTCLabelEncode: # Class handling label - RecResizeImg: image_shape: [3, 32, 320] # -> [3, 32, 100] - KeepKeys: keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order loader: shuffle: True batch_size_per_card: 256 drop_last: True num_workers: 8 #use_shared_memory: False

Eval: dataset: name: SimpleDataSet data_dir: /usr/projects/PaddleOCR-release-2.6/ #/usr/projects/PaddleOCR-release-2.6 label_file_list: ["dataset/dev_rec.txt"] transforms: - DecodeImage: # load image img_mode: BGR channel_first: False - CTCLabelEncode: # Class handling label - RecResizeImg: image_shape: [3, 32, 320] # -> [3, 32, 100] - KeepKeys: keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order loader: shuffle: False drop_last: False batch_size_per_card: 256 num_workers: 4 #use_shared_memory: False

Same issue for nearly 1 month and still didnt get resolved

WenmuZhou commented 1 year ago

你的字典贴上来看看

ftmasadi commented 1 year ago

I also encountered this error for a long time and I could not solve it. I would appreciate it if you could guide me.#9000 @Ham714

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.