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
42.75k stars 7.68k forks source link

识别问题 #3126

Closed chccc1994 closed 3 years ago

chccc1994 commented 3 years ago

识别训练中,没有加预训练模型等,自己定义了字典,部署时,识别结果中出现了字典中没有的字符,是否属于正常现象?为什么会出现这种情况?

tink2123 commented 3 years ago

麻烦提供一下可复现的配置文件、字典、训练权重,我们自测一下。

chccc1994 commented 3 years ago
Global:
  use_gpu: true
  epoch_num: 500
  log_smooth_window: 20
  print_batch_step: 10
  save_model_dir: ./output/rec20210617/
  save_epoch_step: 10
  # evaluation is run every 2000 iterations
  eval_batch_step: [0, 2000]
  cal_metric_during_train: True
  pretrained_model:
  checkpoints:
  save_inference_dir: 
  use_visualdl: False
  infer_img: 
  # for data or label process
  character_dict_path: word_dict.txt
  character_type: ch
  max_text_length: 25
  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

Architecture:
  model_type: rec
  algorithm: CRNN
  Transform:
  Backbone:
    name: MobileNetV3
    scale: 0.5
    model_name: large
  Neck:
    name: SequenceEncoder
    encoder_type: rnn
    hidden_size: 96
  Head:
    name: CTCHead
    fc_decay: 0

Loss:
  name: CTCLoss

PostProcess:
  name: CTCLabelDecode

Metric:
  name: RecMetric
  main_indicator: acc

Train:
  dataset:
    name: SimpleDataSet
    data_dir: work/digital_meter/crop_img/
    label_file_list: 
      - work/digital_meter/rec_gt.txt
    transforms:
      - DecodeImage: # load image
          img_mode: BGR
          channel_first: False
      - CTCLabelEncode: # 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: 16
    drop_last: True
    num_workers: 8
    use_shared_memory: False

Eval:
  dataset:
    name: SimpleDataSet
    data_dir: work/digital_meter/crop_img/
    label_file_list: 
      - work/digital_meter/rec_gt.txt
    transforms:
      - DecodeImage: # load image
          img_mode: BGR
          channel_first: False
      - CTCLabelEncode: # 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: 4
    use_shared_memory: False

字典:

a
b
c
v
0
1
2
3
4
5
6
7
8
9
.
tink2123 commented 3 years ago

暂时无法复现问题,可以提供下您训练的权重文件和测试图片吗?

chccc1994 commented 3 years ago

暂时无法复现问题,可以提供下您训练的权重文件和测试图片吗?

猜测可能是标注问题,按照单字符标注就没这个问题了。

这个问题怎么解决? 部署问题

Evezerest commented 3 years ago

The issue will be closed, if it is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. It is recommended to pull and try the latest code first. 该问题将会被关闭,若问题未解决或有后续问题,请随时重新打开(建议先拉取最新代码进行尝试),我们会继续跟进。