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.23k stars 7.82k forks source link

训练PGNet一直报:got different data type, run type protmotion automatically, this may cause data type been changed. #11809

Closed NikaYK closed 7 months ago

NikaYK commented 7 months ago

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

Global:
  use_gpu: True
  epoch_num: 600
  log_smooth_window: 20
  print_batch_step: 10
  save_model_dir: ../models/pgnet/finetune/
  save_epoch_step: 10
  # evaluation is run every 0 iterationss after the 1000th iteration
  eval_batch_step: [ 0, 1000 ]
  cal_metric_during_train: False
  pretrained_model: ../models/pgnet/pretrain/best_accuracy
  checkpoints:
  save_inference_dir:
  use_visualdl: False
  infer_img:
  infer_visual_type: CN # two mode: EN is for english datasets, CN is for chinese datasets
  valid_set: totaltext # two mode: totaltext valid curved words, partvgg valid non-curved words
  save_res_path: ../models/pgnet/finetune/predicts_pgnet.txt
  character_dict_path: ./PaddleOCR/ppocr/utils/ppocr_keys_v1.txt
  character_type: CN
  max_text_length: 50 # the max length in seq
  max_text_nums: 30 # the max seq nums in a pic
  tcl_len: 64

Architecture:
  model_type: e2e
  algorithm: PGNet
  Transform:
  Backbone:
    name: ResNet
    layers: 50
  Neck:
    name: PGFPN
  Head:
    name: PGHead
    character_dict_path: ./PaddleOCR/ppocr/utils/ppocr_keys_v1.txt # the same as Global:character_dict_path

Loss:
  name: PGLoss
  tcl_bs: 64
  max_text_length: 50 # the same as Global: max_text_length
  max_text_nums: 30 # the same as Global:max_text_nums
  pad_num: 6623 # the length of dict for pad

Optimizer:
  name: Adam
  beta1: 0.9
  beta2: 0.999
  lr:
    name: Cosine
    learning_rate: 0.001
    warmup_epoch: 50
  regularizer:
    name: 'L2'
    factor: 0.0001

PostProcess:
  name: PGPostProcess
  score_thresh: 0.5
  mode: slow   # fast or slow two ways
  point_gather_mode: align # same as PGProcessTrain: point_gather_mode

Metric:
  name: E2EMetric
  mode: A   # two ways for eval, A: label from txt,  B: label from gt_mat
  gt_mat_dir: None  # the dir of gt_mat
  character_dict_path: ./PaddleOCR/ppocr/utils/ppocr_keys_v1.txt
  main_indicator: f_score_e2e

Train:
  dataset:
    name: PGDataSet
    data_dir: ../../data/seal_extract/data2/train
    label_file_list: [../../data/seal_extract/data2/train/annotation.txt]
    ratio_list: [1.0]
    transforms:
      - DecodeImage: # load image
          img_mode: BGR
          channel_first: False
      - E2ELabelEncodeTrain:
      - PGProcessTrain:
          batch_size: 8  # same as loader: batch_size_per_card
          use_resize: True
          use_random_crop: False
          min_crop_size: 24
          min_text_size: 4
          max_text_size: 512
          point_gather_mode: align # two mode: align and none, align mode is better than none mode
      - KeepKeys:
          keep_keys: [ 'images', 'tcl_maps', 'tcl_label_maps', 'border_maps','direction_maps', 'training_masks', 'label_list', 'pos_list', 'pos_mask' ] # dataloader will return list in this order
  loader:
    shuffle: True
    drop_last: False
    batch_size_per_card: 8
    num_workers: 0

Eval:
  dataset:
    name: PGDataSet
    data_dir: ../../data/seal_extract/data2/val
    label_file_list: [../../data/seal_extract/data2/val/annotation.txt]
    transforms:
      - DecodeImage: # load image
          img_mode: BGR
          channel_first: False
      - E2ELabelEncodeTest:
      - E2EResizeForTest:
          max_side_len: 768
      - NormalizeImage:
          scale: 1./255.
          mean: [ 0.485, 0.456, 0.406 ]
          std: [ 0.229, 0.224, 0.225 ]
          order: 'hwc'
      - ToCHWImage:
      - KeepKeys:
          keep_keys: [ 'image', 'shape', 'polys', 'texts', 'ignore_tags', 'img_id']
  loader:
    shuffle: False
    drop_last: False
    batch_size_per_card: 1 # must be 1
    num_workers: 0
W0326 08:30:16.485575  1101 dygraph_functions.cc:68148] got different data type, run type protmotion automatically, this may cause data type been changed.
W0326 08:30:16.486052  1101 multiply_fwd_func.cc:64] got different data type, run type protmotion automatically, this may cause data type been changed.
W0326 08:30:16.486198  1101 multiply_fwd_func.cc:64] got different data type, run type protmotion automatically, this may cause data type been changed.
W0326 08:30:16.486353  1101 multiply_fwd_func.cc:64] got different data type, run type protmotion automatically, this may cause data type been changed.
W0326 08:30:16.486400  1101 multiply_fwd_func.cc:64] got different data type, run type protmotion automatically, this may cause data type been changed.
W0326 08:30:16.543423  1101 dygraph_functions.cc:52641] got different data type, run type protmotion automatically, this may cause data type been changed.
W0326 08:30:16.545722  1101 dygraph_functions.cc:52641] got different data type, run type protmotion automatically, this may cause data type been changed.
W0326 08:30:17.847258  1101 dygraph_functions.cc:68148] got different data type, run type protmotion automatically, this may cause data type been changed.
TingquanGao commented 7 months ago

配置文件有修改吗?是用的私有数据集吗?

NikaYK commented 7 months ago

配置文件有修改吗?是用的私有数据集吗?

配置文件按照中文数据集修改的,数据集根据PPOCRLabel标注的

TingquanGao commented 7 months ago

由于该模型比较久远,PaddleOCR是在2021年4月的release 2.1版本支持的。因此建议 PaddleOCR使用release/2.1分支、paddlepaddle-gpu 使用 2.0.2 版本尝试训练。

TingquanGao commented 7 months ago

该问题已close。如有疑问,可以reopen或提issue。