diff --git a/ppstructure/vqa/eval_re.py b/ppstructure/vqa/eval_re.py index 12bb9cabdb8b4d6482a121ca3b73089b3d0244ff..68c27bad8a8e236fc16ffad21acefe7a55fde561 100644 --- a/ppstructure/vqa/eval_re.py +++ b/ppstructure/vqa/eval_re.py @@ -24,7 +24,7 @@ import paddle from paddlenlp.transformers import LayoutXLMTokenizer, LayoutXLMModel, LayoutXLMForRelationExtraction from xfun import XFUNDataset -from utils import parse_args, get_bio_label_maps, print_arguments +from vqa_utils import parse_args, get_bio_label_maps, print_arguments from data_collator import DataCollator from metric import re_score diff --git a/ppstructure/vqa/eval_ser.py b/ppstructure/vqa/eval_ser.py index 52eeb8a1da82d6e7dcdc726c1a77fd9ab18f0608..95f428c721e103748d5cd722ff0e1d2bf0f09e52 100644 --- a/ppstructure/vqa/eval_ser.py +++ b/ppstructure/vqa/eval_ser.py @@ -33,7 +33,7 @@ from paddlenlp.transformers import LayoutLMModel, LayoutLMTokenizer, LayoutLMFor from xfun import XFUNDataset from losses import SERLoss -from utils import parse_args, get_bio_label_maps, print_arguments +from vqa_utils import parse_args, get_bio_label_maps, print_arguments from ppocr.utils.logging import get_logger diff --git a/ppstructure/vqa/infer_re.py b/ppstructure/vqa/infer_re.py index 7937700a78c28eff19a78dc5ddc8ccef82cc0148..b6774e77befe6ba8954d5f552bcade86cb44e644 100644 --- a/ppstructure/vqa/infer_re.py +++ b/ppstructure/vqa/infer_re.py @@ -15,7 +15,7 @@ import paddle from paddlenlp.transformers import LayoutXLMTokenizer, LayoutXLMModel, LayoutXLMForRelationExtraction from xfun import XFUNDataset -from utils import parse_args, get_bio_label_maps, draw_re_results +from vqa_utils import parse_args, get_bio_label_maps, draw_re_results from data_collator import DataCollator from ppocr.utils.logging import get_logger diff --git a/ppstructure/vqa/infer_ser.py b/ppstructure/vqa/infer_ser.py index 7994b5449af97988e9ad458f4047b59b81f72560..f5fb581fa7e7613216d2e4feb8e39ed8c2541dc9 100644 --- a/ppstructure/vqa/infer_ser.py +++ b/ppstructure/vqa/infer_ser.py @@ -14,6 +14,10 @@ import os import sys + +__dir__ = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(__dir__) + import json import cv2 import numpy as np @@ -22,7 +26,7 @@ from copy import deepcopy import paddle # relative reference -from utils import parse_args, get_image_file_list, draw_ser_results, get_bio_label_maps +from vqa_utils import parse_args, get_image_file_list, draw_ser_results, get_bio_label_maps from paddlenlp.transformers import LayoutXLMModel, LayoutXLMTokenizer, LayoutXLMForTokenClassification from paddlenlp.transformers import LayoutLMModel, LayoutLMTokenizer, LayoutLMForTokenClassification diff --git a/ppstructure/vqa/infer_ser_e2e.py b/ppstructure/vqa/infer_ser_e2e.py index 6bb0247501bc98ea709d3ad47c284268b3d9503b..33fe4dbb5e809388b135ee467d7e7c230f0eabcc 100644 --- a/ppstructure/vqa/infer_ser_e2e.py +++ b/ppstructure/vqa/infer_ser_e2e.py @@ -14,6 +14,10 @@ import os import sys + +__dir__ = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(__dir__) + import json import cv2 import numpy as np @@ -25,9 +29,9 @@ from paddlenlp.transformers import LayoutXLMModel, LayoutXLMTokenizer, LayoutXLM from paddlenlp.transformers import LayoutLMModel, LayoutLMTokenizer, LayoutLMForTokenClassification # relative reference -from utils import parse_args, get_image_file_list, draw_ser_results, get_bio_label_maps +from vqa_utils import parse_args, get_image_file_list, draw_ser_results, get_bio_label_maps -from utils import pad_sentences, split_page, preprocess, postprocess, merge_preds_list_with_ocr_info +from vqa_utils import pad_sentences, split_page, preprocess, postprocess, merge_preds_list_with_ocr_info MODELS = { 'LayoutXLM': diff --git a/ppstructure/vqa/infer_ser_re_e2e.py b/ppstructure/vqa/infer_ser_re_e2e.py index 32d8850a16eebee7e43fd58cbaa604fc2bc00b7c..e24c9f69e0836d64fbe67609623e4b6409f7658c 100644 --- a/ppstructure/vqa/infer_ser_re_e2e.py +++ b/ppstructure/vqa/infer_ser_re_e2e.py @@ -24,7 +24,7 @@ import paddle from paddlenlp.transformers import LayoutXLMModel, LayoutXLMTokenizer, LayoutXLMForRelationExtraction # relative reference -from utils import parse_args, get_image_file_list, draw_re_results +from vqa_utils import parse_args, get_image_file_list, draw_re_results from infer_ser_e2e import SerPredictor diff --git a/ppstructure/vqa/train_re.py b/ppstructure/vqa/train_re.py index 47d694678013295a1c664a7bdb6a7fe13a0b36a5..eeff2bfbbe466b29b8b46e83058e2199fd5cafed 100644 --- a/ppstructure/vqa/train_re.py +++ b/ppstructure/vqa/train_re.py @@ -27,7 +27,7 @@ import paddle from paddlenlp.transformers import LayoutXLMTokenizer, LayoutXLMModel, LayoutXLMForRelationExtraction from xfun import XFUNDataset -from utils import parse_args, get_bio_label_maps, print_arguments, set_seed +from vqa_utils import parse_args, get_bio_label_maps, print_arguments, set_seed from data_collator import DataCollator from eval_re import evaluate diff --git a/ppstructure/vqa/train_ser.py b/ppstructure/vqa/train_ser.py index 2670ef9eeaf75cc1c9bb7d8f41d6f76d4300e597..226172050e9a5ea3b7c6534444ef24278de07043 100644 --- a/ppstructure/vqa/train_ser.py +++ b/ppstructure/vqa/train_ser.py @@ -32,7 +32,7 @@ from paddlenlp.transformers import LayoutXLMModel, LayoutXLMTokenizer, LayoutXLM from paddlenlp.transformers import LayoutLMModel, LayoutLMTokenizer, LayoutLMForTokenClassification from xfun import XFUNDataset -from utils import parse_args, get_bio_label_maps, print_arguments, set_seed +from vqa_utils import parse_args, get_bio_label_maps, print_arguments, set_seed from eval_ser import evaluate from losses import SERLoss from ppocr.utils.logging import get_logger diff --git a/ppstructure/vqa/utils.py b/ppstructure/vqa/vqa_utils.py similarity index 100% rename from ppstructure/vqa/utils.py rename to ppstructure/vqa/vqa_utils.py