Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用本地数据集上训练的RE进行推理时出错,KeyError: 'relations' #13998

Open
3 tasks done
justgoonz opened this issue Oct 14, 2024 · 0 comments
Open
3 tasks done

Comments

@justgoonz
Copy link

🔎 Search before asking

  • I have searched the PaddleOCR Docs and found no similar bug report.
  • I have searched the PaddleOCR Issues and found no similar bug report.
  • I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 Bug (问题描述)

我输入的命令是

python3 ./tools/infer_kie_token_ser_re.py \
  -c  ./configs/kie/vi_layoutxlm/RE_front.yml\
  -o Architecture.Backbone.checkpoints=./output/10_14/RE_front/best_accuracy\
  Global.infer_img=./train_data/OCR_front/test/image\
  -c_ser ./configs/kie/vi_layoutxlm/RE_front.yml \
  -o_ser Architecture.Backbone.checkpoints=./output/10_14/RE_front/best_accuracy

然后遇到报错

Traceback (most recent call last):
  File "./tools/infer_kie_token_ser_re.py", line 216, in <module>
    result = ser_re_engine(data)
  File "./tools/infer_kie_token_ser_re.py", line 147, in __call__
    ser_results, ser_inputs = self.ser_engine(data)
  File "/home/user/1_xsz_ocr/PaddleOCR/tools/infer_kie_token_ser.py", line 115, in __call__
    batch = transform(data, self.ops)
  File "/home/user/1_xsz_ocr/PaddleOCR/ppocr/data/imaug/__init__.py", line 72, in transform
    data = op(data)
  File "/home/user/1_xsz_ocr/PaddleOCR/ppocr/data/imaug/vqa/token/vqa_token_relation.py", line 31, in __call__
    relations = data["relations"]
KeyError: 'relations'

我查看源码时发现,在infer时,data相关的代码段为

for idx, info in enumerate(infer_imgs):
            if config["Global"].get("infer_mode", None) is False:
                data_line = info.decode("utf-8")
                substr = data_line.strip("\n").split("\t")
                img_path = os.path.join(data_dir, substr[0])
                data = {"img_path": img_path, "label": substr[1]}
                print(substr)
            else:
                img_path = info
                data = {"img_path": img_path}

即data只有img_path和label字段.请问哪里出了问题

完整的输出如下

(ocr_pp) user@gpu2:~/1_xsz_ocr/PaddleOCR$ python3 ./tools/infer_kie_token_ser_re.py   -c  ./configs/kie/vi_layoutxlm/RE_front.yml  -o Architecture.Backbone.checkpoints=./output/10_14/RE_front/best_accuracy  Global.infer_img=./train_data/OCR_front/test/image  -c_ser ./configs/kie/vi_layoutxlm/RE_front.yml   -o_ser Architecture.Backbone.checkpoints=./output/10_14/RE_front/best_accuracy
[2024/10/14 19:20:16] ppocr INFO: ********** re config **********
[2024/10/14 19:20:16] ppocr INFO: Architecture : 
[2024/10/14 19:20:16] ppocr INFO:     Backbone : 
[2024/10/14 19:20:16] ppocr INFO:         checkpoints : ./output/10_14/RE_front/best_accuracy
[2024/10/14 19:20:16] ppocr INFO:         mode : vi
[2024/10/14 19:20:16] ppocr INFO:         name : LayoutXLMForRe
[2024/10/14 19:20:16] ppocr INFO:         pretrained : True
[2024/10/14 19:20:16] ppocr INFO:     Transform : None
[2024/10/14 19:20:16] ppocr INFO:     algorithm : LayoutXLM
[2024/10/14 19:20:16] ppocr INFO:     model_type : kie
[2024/10/14 19:20:16] ppocr INFO: Eval : 
[2024/10/14 19:20:16] ppocr INFO:     dataset : 
[2024/10/14 19:20:16] ppocr INFO:         data_dir : /home/user/1_xsz_ocr/PaddleOCR/train_data/OCR_front/test/image
[2024/10/14 19:20:16] ppocr INFO:         label_file_list : ['/home/user/1_xsz_ocr/PaddleOCR/train_data/OCR_front/test/test.json']
[2024/10/14 19:20:16] ppocr INFO:         name : SimpleDataSet
[2024/10/14 19:20:16] ppocr INFO:         transforms : 
[2024/10/14 19:20:16] ppocr INFO:             DecodeImage : 
[2024/10/14 19:20:16] ppocr INFO:                 channel_first : False
[2024/10/14 19:20:16] ppocr INFO:                 img_mode : RGB
[2024/10/14 19:20:16] ppocr INFO:             VQATokenLabelEncode : 
[2024/10/14 19:20:16] ppocr INFO:                 algorithm : LayoutXLM
[2024/10/14 19:20:16] ppocr INFO:                 class_path : train_data/OCR_front/class_list_xfun.txt
[2024/10/14 19:20:16] ppocr INFO:                 contains_re : True
[2024/10/14 19:20:16] ppocr INFO:                 order_method : tb-yx
[2024/10/14 19:20:16] ppocr INFO:                 use_textline_bbox_info : True
[2024/10/14 19:20:16] ppocr INFO:             VQATokenPad : 
[2024/10/14 19:20:16] ppocr INFO:                 max_seq_len : 512
[2024/10/14 19:20:16] ppocr INFO:                 return_attention_mask : True
[2024/10/14 19:20:16] ppocr INFO:             VQAReTokenRelation : None
[2024/10/14 19:20:16] ppocr INFO:             VQAReTokenChunk : 
[2024/10/14 19:20:16] ppocr INFO:                 max_seq_len : 512
[2024/10/14 19:20:16] ppocr INFO:             TensorizeEntitiesRelations : None
[2024/10/14 19:20:16] ppocr INFO:             Resize : 
[2024/10/14 19:20:16] ppocr INFO:                 size : [512, 512]
[2024/10/14 19:20:16] ppocr INFO:             NormalizeImage : 
[2024/10/14 19:20:16] ppocr INFO:                 mean : [128, 128, 128]
[2024/10/14 19:20:16] ppocr INFO:                 order : hwc
[2024/10/14 19:20:16] ppocr INFO:                 scale : 1
[2024/10/14 19:20:16] ppocr INFO:                 std : [60, 60, 60]
[2024/10/14 19:20:16] ppocr INFO:             ToCHWImage : None
[2024/10/14 19:20:16] ppocr INFO:             KeepKeys : 
[2024/10/14 19:20:16] ppocr INFO:                 keep_keys : ['input_ids', 'bbox', 'attention_mask', 'token_type_ids', 'entities', 'relations']
[2024/10/14 19:20:16] ppocr INFO:     loader : 
[2024/10/14 19:20:16] ppocr INFO:         batch_size_per_card : 8
[2024/10/14 19:20:16] ppocr INFO:         drop_last : False
[2024/10/14 19:20:16] ppocr INFO:         num_workers : 8
[2024/10/14 19:20:16] ppocr INFO:         shuffle : False
[2024/10/14 19:20:16] ppocr INFO: Global : 
[2024/10/14 19:20:16] ppocr INFO:     cal_metric_during_train : False
[2024/10/14 19:20:16] ppocr INFO:     epoch_num : 130
[2024/10/14 19:20:16] ppocr INFO:     eval_batch_step : [0, 19]
[2024/10/14 19:20:16] ppocr INFO:     infer_img : ./train_data/OCR_front/test/image
[2024/10/14 19:20:16] ppocr INFO:     kie_det_model_dir : None
[2024/10/14 19:20:16] ppocr INFO:     kie_rec_model_dir : None
[2024/10/14 19:20:16] ppocr INFO:     log_smooth_window : 10
[2024/10/14 19:20:16] ppocr INFO:     print_batch_step : 10
[2024/10/14 19:20:16] ppocr INFO:     save_epoch_step : 2000
[2024/10/14 19:20:16] ppocr INFO:     save_inference_dir : None
[2024/10/14 19:20:16] ppocr INFO:     save_model_dir : ./output/10_14/RE_front
[2024/10/14 19:20:16] ppocr INFO:     save_res_path : ./output/10_14/re/OCR/with_gt
[2024/10/14 19:20:16] ppocr INFO:     seed : 2022
[2024/10/14 19:20:16] ppocr INFO:     use_gpu : True
[2024/10/14 19:20:16] ppocr INFO:     use_visualdl : False
[2024/10/14 19:20:16] ppocr INFO: Loss : 
[2024/10/14 19:20:16] ppocr INFO:     key : loss
[2024/10/14 19:20:16] ppocr INFO:     name : LossFromOutput
[2024/10/14 19:20:16] ppocr INFO:     reduction : mean
[2024/10/14 19:20:16] ppocr INFO: Metric : 
[2024/10/14 19:20:16] ppocr INFO:     main_indicator : hmean
[2024/10/14 19:20:16] ppocr INFO:     name : VQAReTokenMetric
[2024/10/14 19:20:16] ppocr INFO: Optimizer : 
[2024/10/14 19:20:16] ppocr INFO:     beta1 : 0.9
[2024/10/14 19:20:16] ppocr INFO:     beta2 : 0.999
[2024/10/14 19:20:16] ppocr INFO:     clip_norm : 10
[2024/10/14 19:20:16] ppocr INFO:     lr : 
[2024/10/14 19:20:16] ppocr INFO:         learning_rate : 5e-05
[2024/10/14 19:20:16] ppocr INFO:         warmup_epoch : 10
[2024/10/14 19:20:16] ppocr INFO:     name : AdamW
[2024/10/14 19:20:16] ppocr INFO:     regularizer : 
[2024/10/14 19:20:16] ppocr INFO:         factor : 0.0
[2024/10/14 19:20:16] ppocr INFO:         name : L2
[2024/10/14 19:20:16] ppocr INFO: PostProcess : 
[2024/10/14 19:20:16] ppocr INFO:     name : VQAReTokenLayoutLMPostProcess
[2024/10/14 19:20:16] ppocr INFO: Train : 
[2024/10/14 19:20:16] ppocr INFO:     dataset : 
[2024/10/14 19:20:16] ppocr INFO:         data_dir : /home/user/1_xsz_ocr/PaddleOCR/train_data/OCR_front/train/image
[2024/10/14 19:20:16] ppocr INFO:         label_file_list : ['/home/user/1_xsz_ocr/PaddleOCR/train_data/OCR_front/train/train.json']
[2024/10/14 19:20:16] ppocr INFO:         name : SimpleDataSet
[2024/10/14 19:20:16] ppocr INFO:         ratio_list : [1.0]
[2024/10/14 19:20:16] ppocr INFO:         transforms : 
[2024/10/14 19:20:16] ppocr INFO:             DecodeImage : 
[2024/10/14 19:20:16] ppocr INFO:                 channel_first : False
[2024/10/14 19:20:16] ppocr INFO:                 img_mode : RGB
[2024/10/14 19:20:16] ppocr INFO:             VQATokenLabelEncode : 
[2024/10/14 19:20:16] ppocr INFO:                 algorithm : LayoutXLM
[2024/10/14 19:20:16] ppocr INFO:                 class_path : train_data/OCR_front/class_list_xfun.txt
[2024/10/14 19:20:16] ppocr INFO:                 contains_re : True
[2024/10/14 19:20:16] ppocr INFO:                 order_method : tb-yx
[2024/10/14 19:20:16] ppocr INFO:                 use_textline_bbox_info : True
[2024/10/14 19:20:16] ppocr INFO:             VQATokenPad : 
[2024/10/14 19:20:16] ppocr INFO:                 max_seq_len : 512
[2024/10/14 19:20:16] ppocr INFO:                 return_attention_mask : True
[2024/10/14 19:20:16] ppocr INFO:             VQAReTokenRelation : None
[2024/10/14 19:20:16] ppocr INFO:             VQAReTokenChunk : 
[2024/10/14 19:20:16] ppocr INFO:                 max_seq_len : 512
[2024/10/14 19:20:16] ppocr INFO:             TensorizeEntitiesRelations : None
[2024/10/14 19:20:16] ppocr INFO:             Resize : 
[2024/10/14 19:20:16] ppocr INFO:                 size : [512, 512]
[2024/10/14 19:20:16] ppocr INFO:             NormalizeImage : 
[2024/10/14 19:20:16] ppocr INFO:                 mean : [128, 128, 128]
[2024/10/14 19:20:16] ppocr INFO:                 order : hwc
[2024/10/14 19:20:16] ppocr INFO:                 scale : 1
[2024/10/14 19:20:16] ppocr INFO:                 std : [60, 60, 60]
[2024/10/14 19:20:16] ppocr INFO:             ToCHWImage : None
[2024/10/14 19:20:16] ppocr INFO:             KeepKeys : 
[2024/10/14 19:20:16] ppocr INFO:                 keep_keys : ['input_ids', 'bbox', 'attention_mask', 'token_type_ids', 'entities', 'relations']
[2024/10/14 19:20:16] ppocr INFO:     loader : 
[2024/10/14 19:20:16] ppocr INFO:         batch_size_per_card : 2
[2024/10/14 19:20:16] ppocr INFO:         drop_last : False
[2024/10/14 19:20:16] ppocr INFO:         num_workers : 4
[2024/10/14 19:20:16] ppocr INFO:         shuffle : True
[2024/10/14 19:20:16] ppocr INFO: 

[2024/10/14 19:20:16] ppocr INFO: ********** ser config **********
[2024/10/14 19:20:16] ppocr INFO: Architecture : 
[2024/10/14 19:20:16] ppocr INFO:     Backbone : 
[2024/10/14 19:20:16] ppocr INFO:         checkpoints : ./output/10_14/RE_front/best_accuracy
[2024/10/14 19:20:16] ppocr INFO:         mode : vi
[2024/10/14 19:20:16] ppocr INFO:         name : LayoutXLMForRe
[2024/10/14 19:20:16] ppocr INFO:         pretrained : True
[2024/10/14 19:20:16] ppocr INFO:     Transform : None
[2024/10/14 19:20:16] ppocr INFO:     algorithm : LayoutXLM
[2024/10/14 19:20:16] ppocr INFO:     model_type : kie
[2024/10/14 19:20:16] ppocr INFO: Eval : 
[2024/10/14 19:20:16] ppocr INFO:     dataset : 
[2024/10/14 19:20:16] ppocr INFO:         data_dir : /home/user/1_xsz_ocr/PaddleOCR/train_data/OCR_front/test/image
[2024/10/14 19:20:16] ppocr INFO:         label_file_list : ['/home/user/1_xsz_ocr/PaddleOCR/train_data/OCR_front/test/test.json']
[2024/10/14 19:20:16] ppocr INFO:         name : SimpleDataSet
[2024/10/14 19:20:16] ppocr INFO:         transforms : 
[2024/10/14 19:20:16] ppocr INFO:             DecodeImage : 
[2024/10/14 19:20:16] ppocr INFO:                 channel_first : False
[2024/10/14 19:20:16] ppocr INFO:                 img_mode : RGB
[2024/10/14 19:20:16] ppocr INFO:             VQATokenLabelEncode : 
[2024/10/14 19:20:16] ppocr INFO:                 algorithm : LayoutXLM
[2024/10/14 19:20:16] ppocr INFO:                 class_path : train_data/OCR_front/class_list_xfun.txt
[2024/10/14 19:20:16] ppocr INFO:                 contains_re : True
[2024/10/14 19:20:16] ppocr INFO:                 order_method : tb-yx
[2024/10/14 19:20:16] ppocr INFO:                 use_textline_bbox_info : True
[2024/10/14 19:20:16] ppocr INFO:             VQATokenPad : 
[2024/10/14 19:20:16] ppocr INFO:                 max_seq_len : 512
[2024/10/14 19:20:16] ppocr INFO:                 return_attention_mask : True
[2024/10/14 19:20:16] ppocr INFO:             VQAReTokenRelation : None
[2024/10/14 19:20:16] ppocr INFO:             VQAReTokenChunk : 
[2024/10/14 19:20:16] ppocr INFO:                 max_seq_len : 512
[2024/10/14 19:20:16] ppocr INFO:             TensorizeEntitiesRelations : None
[2024/10/14 19:20:16] ppocr INFO:             Resize : 
[2024/10/14 19:20:16] ppocr INFO:                 size : [512, 512]
[2024/10/14 19:20:16] ppocr INFO:             NormalizeImage : 
[2024/10/14 19:20:16] ppocr INFO:                 mean : [128, 128, 128]
[2024/10/14 19:20:16] ppocr INFO:                 order : hwc
[2024/10/14 19:20:16] ppocr INFO:                 scale : 1
[2024/10/14 19:20:16] ppocr INFO:                 std : [60, 60, 60]
[2024/10/14 19:20:16] ppocr INFO:             ToCHWImage : None
[2024/10/14 19:20:16] ppocr INFO:             KeepKeys : 
[2024/10/14 19:20:16] ppocr INFO:                 keep_keys : ['input_ids', 'bbox', 'attention_mask', 'token_type_ids', 'entities', 'relations']
[2024/10/14 19:20:16] ppocr INFO:     loader : 
[2024/10/14 19:20:16] ppocr INFO:         batch_size_per_card : 8
[2024/10/14 19:20:16] ppocr INFO:         drop_last : False
[2024/10/14 19:20:16] ppocr INFO:         num_workers : 8
[2024/10/14 19:20:16] ppocr INFO:         shuffle : False
[2024/10/14 19:20:16] ppocr INFO: Global : 
[2024/10/14 19:20:16] ppocr INFO:     cal_metric_during_train : False
[2024/10/14 19:20:16] ppocr INFO:     epoch_num : 130
[2024/10/14 19:20:16] ppocr INFO:     eval_batch_step : [0, 19]
[2024/10/14 19:20:16] ppocr INFO:     infer_img : /home/user/1_xsz_ocr/PaddleOCR/train_data/OCR_front/test/image
[2024/10/14 19:20:16] ppocr INFO:     kie_det_model_dir : None
[2024/10/14 19:20:16] ppocr INFO:     kie_rec_model_dir : None
[2024/10/14 19:20:16] ppocr INFO:     log_smooth_window : 10
[2024/10/14 19:20:16] ppocr INFO:     print_batch_step : 10
[2024/10/14 19:20:16] ppocr INFO:     save_epoch_step : 2000
[2024/10/14 19:20:16] ppocr INFO:     save_inference_dir : None
[2024/10/14 19:20:16] ppocr INFO:     save_model_dir : ./output/10_14/RE_front
[2024/10/14 19:20:16] ppocr INFO:     save_res_path : ./output/10_14/re/OCR/with_gt
[2024/10/14 19:20:16] ppocr INFO:     seed : 2022
[2024/10/14 19:20:16] ppocr INFO:     use_gpu : True
[2024/10/14 19:20:16] ppocr INFO:     use_visualdl : False
[2024/10/14 19:20:16] ppocr INFO: Loss : 
[2024/10/14 19:20:16] ppocr INFO:     key : loss
[2024/10/14 19:20:16] ppocr INFO:     name : LossFromOutput
[2024/10/14 19:20:16] ppocr INFO:     reduction : mean
[2024/10/14 19:20:16] ppocr INFO: Metric : 
[2024/10/14 19:20:16] ppocr INFO:     main_indicator : hmean
[2024/10/14 19:20:16] ppocr INFO:     name : VQAReTokenMetric
[2024/10/14 19:20:16] ppocr INFO: Optimizer : 
[2024/10/14 19:20:16] ppocr INFO:     beta1 : 0.9
[2024/10/14 19:20:16] ppocr INFO:     beta2 : 0.999
[2024/10/14 19:20:16] ppocr INFO:     clip_norm : 10
[2024/10/14 19:20:16] ppocr INFO:     lr : 
[2024/10/14 19:20:16] ppocr INFO:         learning_rate : 5e-05
[2024/10/14 19:20:16] ppocr INFO:         warmup_epoch : 10
[2024/10/14 19:20:16] ppocr INFO:     name : AdamW
[2024/10/14 19:20:16] ppocr INFO:     regularizer : 
[2024/10/14 19:20:16] ppocr INFO:         factor : 0.0
[2024/10/14 19:20:16] ppocr INFO:         name : L2
[2024/10/14 19:20:16] ppocr INFO: PostProcess : 
[2024/10/14 19:20:16] ppocr INFO:     name : VQAReTokenLayoutLMPostProcess
[2024/10/14 19:20:16] ppocr INFO: Train : 
[2024/10/14 19:20:16] ppocr INFO:     dataset : 
[2024/10/14 19:20:16] ppocr INFO:         data_dir : /home/user/1_xsz_ocr/PaddleOCR/train_data/OCR_front/train/image
[2024/10/14 19:20:16] ppocr INFO:         label_file_list : ['/home/user/1_xsz_ocr/PaddleOCR/train_data/OCR_front/train/train.json']
[2024/10/14 19:20:16] ppocr INFO:         name : SimpleDataSet
[2024/10/14 19:20:16] ppocr INFO:         ratio_list : [1.0]
[2024/10/14 19:20:16] ppocr INFO:         transforms : 
[2024/10/14 19:20:16] ppocr INFO:             DecodeImage : 
[2024/10/14 19:20:16] ppocr INFO:                 channel_first : False
[2024/10/14 19:20:16] ppocr INFO:                 img_mode : RGB
[2024/10/14 19:20:16] ppocr INFO:             VQATokenLabelEncode : 
[2024/10/14 19:20:16] ppocr INFO:                 algorithm : LayoutXLM
[2024/10/14 19:20:16] ppocr INFO:                 class_path : train_data/OCR_front/class_list_xfun.txt
[2024/10/14 19:20:16] ppocr INFO:                 contains_re : True
[2024/10/14 19:20:16] ppocr INFO:                 order_method : tb-yx
[2024/10/14 19:20:16] ppocr INFO:                 use_textline_bbox_info : True
[2024/10/14 19:20:16] ppocr INFO:             VQATokenPad : 
[2024/10/14 19:20:16] ppocr INFO:                 max_seq_len : 512
[2024/10/14 19:20:16] ppocr INFO:                 return_attention_mask : True
[2024/10/14 19:20:16] ppocr INFO:             VQAReTokenRelation : None
[2024/10/14 19:20:16] ppocr INFO:             VQAReTokenChunk : 
[2024/10/14 19:20:16] ppocr INFO:                 max_seq_len : 512
[2024/10/14 19:20:16] ppocr INFO:             TensorizeEntitiesRelations : None
[2024/10/14 19:20:16] ppocr INFO:             Resize : 
[2024/10/14 19:20:16] ppocr INFO:                 size : [512, 512]
[2024/10/14 19:20:16] ppocr INFO:             NormalizeImage : 
[2024/10/14 19:20:16] ppocr INFO:                 mean : [128, 128, 128]
[2024/10/14 19:20:16] ppocr INFO:                 order : hwc
[2024/10/14 19:20:16] ppocr INFO:                 scale : 1
[2024/10/14 19:20:16] ppocr INFO:                 std : [60, 60, 60]
[2024/10/14 19:20:16] ppocr INFO:             ToCHWImage : None
[2024/10/14 19:20:16] ppocr INFO:             KeepKeys : 
[2024/10/14 19:20:16] ppocr INFO:                 keep_keys : ['input_ids', 'bbox', 'attention_mask', 'token_type_ids', 'entities', 'relations']
[2024/10/14 19:20:16] ppocr INFO:     loader : 
[2024/10/14 19:20:16] ppocr INFO:         batch_size_per_card : 2
[2024/10/14 19:20:16] ppocr INFO:         drop_last : False
[2024/10/14 19:20:16] ppocr INFO:         num_workers : 4
[2024/10/14 19:20:16] ppocr INFO:         shuffle : True
[2024/10/14 19:20:16] ppocr INFO: train with paddle 3.0.0-beta1 and device Place(gpu:0)
INFO:datasets:PyTorch version 2.4.1 available.
W1014 19:20:18.021422 715557 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.2, Runtime API Version: 11.8
W1014 19:20:18.022987 715557 gpu_resources.cc:164] device: 0, cuDNN Version: 8.7.
[2024/10/14 19:20:21] ppocr INFO: resume from ./output/10_14/RE_front/best_accuracy
[2024/10/14 19:20:21] ppocr WARNING: The first GPU is used for inference by default, GPU ID: 0
[2024/10/14 19:20:22] ppocr WARNING: The first GPU is used for inference by default, GPU ID: 0
[2024-10-14 19:20:23,026] [    INFO] - Already cached /home/user/.paddlenlp/models/layoutxlm-base-uncased/sentencepiece.bpe.model
[2024-10-14 19:20:23,614] [    INFO] - tokenizer config file saved in /home/user/.paddlenlp/models/layoutxlm-base-uncased/tokenizer_config.json
[2024-10-14 19:20:23,617] [    INFO] - Special tokens file saved in /home/user/.paddlenlp/models/layoutxlm-base-uncased/special_tokens_map.json
[2024/10/14 19:20:26] ppocr INFO: resume from ./output/10_14/RE_front/best_accuracy
Traceback (most recent call last):
  File "./tools/infer_kie_token_ser_re.py", line 216, in <module>
    result = ser_re_engine(data)
  File "./tools/infer_kie_token_ser_re.py", line 147, in __call__
    ser_results, ser_inputs = self.ser_engine(data)
  File "/home/user/1_xsz_ocr/PaddleOCR/tools/infer_kie_token_ser.py", line 115, in __call__
    batch = transform(data, self.ops)
  File "/home/user/1_xsz_ocr/PaddleOCR/ppocr/data/imaug/__init__.py", line 72, in transform
    data = op(data)
  File "/home/user/1_xsz_ocr/PaddleOCR/ppocr/data/imaug/vqa/token/vqa_token_relation.py", line 31, in __call__
    relations = data["relations"]
KeyError: 'relations'

🏃‍♂️ Environment (运行环境)

paddlenlp                 2.5.2                    pypi_0    pypi
paddleocr                 2.8.1                    pypi_0    pypi
paddlepaddle-gpu          3.0.0b1                  pypi_0    pypi

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

完整的命令如下,在训练阶段没有异常,错误仅仅发生在推理阶段

conda activate ocr_pp

cd /home/user/1_xsz_ocr/PaddleOCR

python3 tools/train.py -c configs/kie/vi_layoutxlm/RE_front.yml

python3 ./tools/infer_kie_token_ser_re.py \
  -c  ./configs/kie/vi_layoutxlm/RE_front.yml\
  -o Architecture.Backbone.checkpoints=./output/10_14/RE_front/best_accuracy\
  Global.infer_img=./train_data/OCR_front/test/image\
  -c_ser ./configs/kie/vi_layoutxlm/RE_front.yml \
  -o_ser Architecture.Backbone.checkpoints=./output/10_14/RE_front/best_accuracy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant