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.1k stars 7.81k forks source link

paddleocr 识别模型训练问题 #2765

Closed chccc1994 closed 3 years ago

chccc1994 commented 3 years ago

在用paddleocr 2.0.2 训练车牌识别模型时,利用以下配置文件,一直报错,是我的yml 文件文件吗???还是什么问题? 参考: 【AI创造营】使用 PaddleHub 结合 PaddleOCR 实现车牌识别 PaddleOCR:车牌识别 image image

yml文件如下:

Global:
  use_gpu: True
  epoch_num: 25
  log_smooth_window: 20
  print_batch_step: 10
  save_model_dir: ./output/rec/rec_mv3_tps_bilstm_attn_car/
  save_epoch_step: 1
  # evaluation is run every 5000 iterations after the 4000th iteration
  eval_batch_step: [0, 2000]
  cal_metric_during_train: True
  pretrained_model: E:/PaddleOCR/pretrain_models/rec_mv3_tps_bilstm_attn/best_accuracy
  checkpoints:
  save_inference_dir: E:/Paddle/PaddleOCR-release-2.1/inference/rec_mv3_tps_bilstm_attn
  use_visualdl: true
  infer_img: doc/imgs_words/ch/word_1.jpg
  # for data or label process
  character_dict_path: E:\PaddleOCR\work\rec_txt\word_dict.txt
  character_type: en
  max_text_length: 7
  infer_mode: False
  use_space_char: False

Optimizer:
  name: Adam
  beta1: 0.9
  beta2: 0.999
  lr:
    learning_rate: 0.0005
  regularizer:
    name: 'L2'
    factor: 0.00001

Architecture:
  model_type: rec
  algorithm: RARE
  Transform:
    name: TPS
    num_fiducial: 20
    loc_lr: 0.1
    model_name: small
  Backbone:
    name: MobileNetV3
    scale: 0.5
    model_name: large
  Neck:
    name: SequenceEncoder
    encoder_type: rnn 
    hidden_size: 96
  Head:
    name: AttentionHead  
    hidden_size: 96

Loss:
  name: AttentionLoss

PostProcess:
  name: AttnLabelDecode

Metric:
  name: RecMetric
  main_indicator: acc

Train:
  dataset:
    name: SimpleDataSet
    data_dir: E:\PaddleOCR\work\rec_img
    label_file_list:
      - E:\PaddleOCR\work\rec_txt\train_rec.txt
    transforms:
      - DecodeImage: # load image
          img_mode: BGR
          channel_first: False
      - AttnLabelEncode: # Class handling label
      - RecResizeImg:
          image_shape: [3, 32, 100]
      - KeepKeys:
          keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  loader:
    shuffle: True
    batch_size_per_card: 4
    drop_last: True
    num_workers: 1

Eval:
  dataset:
    name: SimpleDataSet
    data_dir: E:\PaddleOCR\work\rec_img
    label_file_list:
      - E:\PaddleOCR\work\rec_txt\dev_rec.txt
    transforms:
      - DecodeImage: # load image
          img_mode: BGR
          channel_first: False
      - AttnLabelEncode: # Class handling label
      - RecResizeImg:
          image_shape: [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: 4
    num_workers: 1

E:\PaddleOCR\work\rec_txt\train_rec.txt文件 image

WenmuZhou commented 3 years ago

遇到了循环引用,你的工程方便我进去看一下吗

chccc1994 commented 3 years ago

遇到了循环引用,你的工程方便我进去看一下吗

可以,怎么联系你? github 主页有我邮箱,你方便的话,邮箱联系我一下。

WenmuZhou commented 3 years ago

email 你了

chccc1994 commented 3 years ago

由于修改了max_text_length的值造成的,感谢@WenmuZhou。