paddlex 3.0.0rc1__py3-none-any.whl → 3.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- paddlex/.version +1 -1
- paddlex/__init__.py +1 -1
- paddlex/configs/modules/chart_parsing/PP-Chart2Table.yaml +13 -0
- paddlex/configs/modules/doc_vlm/PP-DocBee2-3B.yaml +14 -0
- paddlex/configs/modules/formula_recognition/PP-FormulaNet_plus-L.yaml +40 -0
- paddlex/configs/modules/formula_recognition/PP-FormulaNet_plus-M.yaml +40 -0
- paddlex/configs/modules/formula_recognition/PP-FormulaNet_plus-S.yaml +40 -0
- paddlex/configs/modules/layout_detection/PP-DocBlockLayout.yaml +40 -0
- paddlex/configs/modules/layout_detection/PP-DocLayout-L.yaml +2 -2
- paddlex/configs/modules/layout_detection/PP-DocLayout-M.yaml +2 -2
- paddlex/configs/modules/layout_detection/PP-DocLayout-S.yaml +2 -2
- paddlex/configs/modules/layout_detection/PP-DocLayout_plus-L.yaml +40 -0
- paddlex/configs/modules/text_detection/PP-OCRv5_mobile_det.yaml +40 -0
- paddlex/configs/modules/text_detection/PP-OCRv5_server_det.yaml +40 -0
- paddlex/configs/modules/text_recognition/PP-OCRv5_mobile_rec.yaml +39 -0
- paddlex/configs/modules/text_recognition/PP-OCRv5_server_rec.yaml +39 -0
- paddlex/configs/modules/textline_orientation/PP-LCNet_x1_0_textline_ori.yaml +41 -0
- paddlex/configs/pipelines/OCR.yaml +7 -6
- paddlex/configs/pipelines/PP-ChatOCRv3-doc.yaml +3 -1
- paddlex/configs/pipelines/PP-ChatOCRv4-doc.yaml +91 -34
- paddlex/configs/pipelines/PP-StructureV3.yaml +72 -72
- paddlex/configs/pipelines/doc_understanding.yaml +1 -1
- paddlex/configs/pipelines/formula_recognition.yaml +2 -2
- paddlex/configs/pipelines/layout_parsing.yaml +3 -2
- paddlex/configs/pipelines/seal_recognition.yaml +1 -0
- paddlex/configs/pipelines/table_recognition.yaml +2 -1
- paddlex/configs/pipelines/table_recognition_v2.yaml +7 -1
- paddlex/hpip_links.html +20 -20
- paddlex/inference/common/batch_sampler/doc_vlm_batch_sampler.py +33 -10
- paddlex/inference/common/batch_sampler/image_batch_sampler.py +34 -25
- paddlex/inference/common/result/mixin.py +19 -12
- paddlex/inference/models/base/predictor/base_predictor.py +2 -8
- paddlex/inference/models/common/static_infer.py +11 -59
- paddlex/inference/models/common/tokenizer/__init__.py +2 -0
- paddlex/inference/models/common/tokenizer/clip_tokenizer.py +1 -1
- paddlex/inference/models/common/tokenizer/gpt_tokenizer.py +2 -2
- paddlex/inference/models/common/tokenizer/qwen2_5_tokenizer.py +112 -0
- paddlex/inference/models/common/tokenizer/qwen2_tokenizer.py +7 -1
- paddlex/inference/models/common/tokenizer/qwen_tokenizer.py +288 -0
- paddlex/inference/models/common/tokenizer/tokenizer_utils.py +13 -13
- paddlex/inference/models/common/tokenizer/tokenizer_utils_base.py +3 -3
- paddlex/inference/models/common/tokenizer/vocab.py +7 -7
- paddlex/inference/models/common/vlm/conversion_utils.py +99 -0
- paddlex/inference/models/common/vlm/fusion_ops.py +205 -0
- paddlex/inference/models/common/vlm/generation/configuration_utils.py +1 -1
- paddlex/inference/models/common/vlm/generation/logits_process.py +1 -1
- paddlex/inference/models/common/vlm/generation/utils.py +1 -1
- paddlex/inference/models/common/vlm/transformers/configuration_utils.py +3 -3
- paddlex/inference/models/common/vlm/transformers/conversion_utils.py +3 -3
- paddlex/inference/models/common/vlm/transformers/model_outputs.py +2 -2
- paddlex/inference/models/common/vlm/transformers/model_utils.py +7 -31
- paddlex/inference/models/doc_vlm/modeling/GOT_ocr_2_0.py +830 -0
- paddlex/inference/models/doc_vlm/modeling/__init__.py +2 -0
- paddlex/inference/models/doc_vlm/modeling/qwen2.py +1606 -0
- paddlex/inference/models/doc_vlm/modeling/qwen2_5_vl.py +3006 -0
- paddlex/inference/models/doc_vlm/modeling/qwen2_vl.py +0 -105
- paddlex/inference/models/doc_vlm/predictor.py +79 -24
- paddlex/inference/models/doc_vlm/processors/GOT_ocr_2_0.py +97 -0
- paddlex/inference/models/doc_vlm/processors/__init__.py +2 -0
- paddlex/inference/models/doc_vlm/processors/common.py +189 -0
- paddlex/inference/models/doc_vlm/processors/qwen2_5_vl.py +548 -0
- paddlex/inference/models/doc_vlm/processors/qwen2_vl.py +21 -176
- paddlex/inference/models/formula_recognition/predictor.py +7 -1
- paddlex/inference/models/formula_recognition/processors.py +92 -79
- paddlex/inference/models/formula_recognition/result.py +28 -27
- paddlex/inference/models/image_feature/processors.py +3 -4
- paddlex/inference/models/keypoint_detection/predictor.py +3 -0
- paddlex/inference/models/object_detection/predictor.py +2 -0
- paddlex/inference/models/object_detection/processors.py +28 -3
- paddlex/inference/models/object_detection/utils.py +2 -0
- paddlex/inference/models/table_structure_recognition/result.py +0 -10
- paddlex/inference/models/text_detection/predictor.py +8 -0
- paddlex/inference/models/text_detection/processors.py +44 -10
- paddlex/inference/models/text_detection/result.py +0 -10
- paddlex/inference/pipelines/__init__.py +9 -5
- paddlex/inference/pipelines/_parallel.py +172 -0
- paddlex/inference/pipelines/anomaly_detection/pipeline.py +16 -6
- paddlex/inference/pipelines/attribute_recognition/pipeline.py +11 -1
- paddlex/inference/pipelines/base.py +14 -4
- paddlex/inference/pipelines/components/faisser.py +1 -1
- paddlex/inference/pipelines/doc_preprocessor/pipeline.py +53 -27
- paddlex/inference/pipelines/formula_recognition/pipeline.py +120 -82
- paddlex/inference/pipelines/formula_recognition/result.py +1 -11
- paddlex/inference/pipelines/image_classification/pipeline.py +16 -6
- paddlex/inference/pipelines/image_multilabel_classification/pipeline.py +16 -6
- paddlex/inference/pipelines/instance_segmentation/pipeline.py +16 -6
- paddlex/inference/pipelines/keypoint_detection/pipeline.py +16 -6
- paddlex/inference/pipelines/layout_parsing/pipeline.py +34 -47
- paddlex/inference/pipelines/layout_parsing/pipeline_v2.py +893 -260
- paddlex/inference/pipelines/layout_parsing/result.py +4 -17
- paddlex/inference/pipelines/layout_parsing/result_v2.py +523 -245
- paddlex/inference/pipelines/layout_parsing/setting.py +87 -0
- paddlex/inference/pipelines/layout_parsing/utils.py +565 -1998
- paddlex/inference/pipelines/layout_parsing/xycut_enhanced/__init__.py +16 -0
- paddlex/inference/pipelines/layout_parsing/xycut_enhanced/utils.py +1144 -0
- paddlex/inference/pipelines/layout_parsing/xycut_enhanced/xycuts.py +563 -0
- paddlex/inference/pipelines/m_3d_bev_detection/pipeline.py +2 -2
- paddlex/inference/pipelines/multilingual_speech_recognition/pipeline.py +2 -2
- paddlex/inference/pipelines/object_detection/pipeline.py +16 -6
- paddlex/inference/pipelines/ocr/pipeline.py +127 -70
- paddlex/inference/pipelines/ocr/result.py +19 -16
- paddlex/inference/pipelines/open_vocabulary_detection/pipeline.py +2 -2
- paddlex/inference/pipelines/open_vocabulary_segmentation/pipeline.py +2 -2
- paddlex/inference/pipelines/pp_chatocr/pipeline_base.py +2 -2
- paddlex/inference/pipelines/pp_chatocr/pipeline_v3.py +2 -5
- paddlex/inference/pipelines/pp_chatocr/pipeline_v4.py +5 -5
- paddlex/inference/pipelines/rotated_object_detection/pipeline.py +16 -6
- paddlex/inference/pipelines/seal_recognition/pipeline.py +109 -53
- paddlex/inference/pipelines/semantic_segmentation/pipeline.py +16 -6
- paddlex/inference/pipelines/small_object_detection/pipeline.py +16 -6
- paddlex/inference/pipelines/table_recognition/pipeline.py +26 -18
- paddlex/inference/pipelines/table_recognition/pipeline_v2.py +624 -53
- paddlex/inference/pipelines/table_recognition/result.py +1 -1
- paddlex/inference/pipelines/table_recognition/table_recognition_post_processing_v2.py +9 -5
- paddlex/inference/pipelines/ts_anomaly_detection/pipeline.py +2 -2
- paddlex/inference/pipelines/ts_classification/pipeline.py +2 -2
- paddlex/inference/pipelines/ts_forecasting/pipeline.py +2 -2
- paddlex/inference/pipelines/video_classification/pipeline.py +2 -2
- paddlex/inference/pipelines/video_detection/pipeline.py +2 -2
- paddlex/inference/serving/basic_serving/_pipeline_apps/_common/common.py +5 -1
- paddlex/inference/serving/basic_serving/_pipeline_apps/layout_parsing.py +0 -1
- paddlex/inference/serving/basic_serving/_pipeline_apps/pp_chatocrv3_doc.py +0 -1
- paddlex/inference/serving/basic_serving/_pipeline_apps/pp_chatocrv4_doc.py +1 -1
- paddlex/inference/serving/basic_serving/_pipeline_apps/pp_structurev3.py +6 -2
- paddlex/inference/serving/basic_serving/_pipeline_apps/table_recognition.py +1 -5
- paddlex/inference/serving/basic_serving/_pipeline_apps/table_recognition_v2.py +4 -5
- paddlex/inference/serving/infra/utils.py +20 -22
- paddlex/inference/serving/schemas/formula_recognition.py +1 -1
- paddlex/inference/serving/schemas/layout_parsing.py +1 -2
- paddlex/inference/serving/schemas/pp_chatocrv3_doc.py +1 -2
- paddlex/inference/serving/schemas/pp_chatocrv4_doc.py +2 -2
- paddlex/inference/serving/schemas/pp_structurev3.py +10 -6
- paddlex/inference/serving/schemas/seal_recognition.py +1 -1
- paddlex/inference/serving/schemas/table_recognition.py +2 -6
- paddlex/inference/serving/schemas/table_recognition_v2.py +5 -6
- paddlex/inference/utils/hpi.py +8 -1
- paddlex/inference/utils/hpi_model_info_collection.json +81 -2
- paddlex/inference/utils/io/readers.py +12 -12
- paddlex/inference/utils/mkldnn_blocklist.py +25 -0
- paddlex/inference/utils/official_models.py +14 -0
- paddlex/inference/utils/pp_option.py +29 -8
- paddlex/model.py +2 -2
- paddlex/modules/__init__.py +1 -1
- paddlex/modules/anomaly_detection/evaluator.py +2 -2
- paddlex/modules/base/__init__.py +1 -1
- paddlex/modules/base/evaluator.py +5 -5
- paddlex/modules/base/trainer.py +1 -1
- paddlex/modules/doc_vlm/dataset_checker.py +2 -2
- paddlex/modules/doc_vlm/evaluator.py +2 -2
- paddlex/modules/doc_vlm/exportor.py +2 -2
- paddlex/modules/doc_vlm/model_list.py +1 -1
- paddlex/modules/doc_vlm/trainer.py +2 -2
- paddlex/modules/face_recognition/evaluator.py +2 -2
- paddlex/modules/formula_recognition/evaluator.py +5 -2
- paddlex/modules/formula_recognition/model_list.py +3 -0
- paddlex/modules/formula_recognition/trainer.py +3 -0
- paddlex/modules/general_recognition/evaluator.py +1 -1
- paddlex/modules/image_classification/evaluator.py +2 -2
- paddlex/modules/image_classification/model_list.py +1 -0
- paddlex/modules/instance_segmentation/evaluator.py +1 -1
- paddlex/modules/keypoint_detection/evaluator.py +1 -1
- paddlex/modules/m_3d_bev_detection/evaluator.py +2 -2
- paddlex/modules/multilabel_classification/evaluator.py +2 -2
- paddlex/modules/object_detection/dataset_checker/dataset_src/convert_dataset.py +4 -4
- paddlex/modules/object_detection/evaluator.py +2 -2
- paddlex/modules/object_detection/model_list.py +2 -0
- paddlex/modules/semantic_segmentation/evaluator.py +2 -2
- paddlex/modules/table_recognition/evaluator.py +2 -2
- paddlex/modules/text_detection/evaluator.py +2 -2
- paddlex/modules/text_detection/model_list.py +2 -0
- paddlex/modules/text_recognition/evaluator.py +2 -2
- paddlex/modules/text_recognition/model_list.py +2 -0
- paddlex/modules/ts_anomaly_detection/evaluator.py +2 -2
- paddlex/modules/ts_classification/dataset_checker/dataset_src/split_dataset.py +1 -1
- paddlex/modules/ts_classification/evaluator.py +2 -2
- paddlex/modules/ts_forecast/evaluator.py +2 -2
- paddlex/modules/video_classification/evaluator.py +2 -2
- paddlex/modules/video_detection/evaluator.py +2 -2
- paddlex/ops/__init__.py +2 -2
- paddlex/paddlex_cli.py +19 -13
- paddlex/repo_apis/Paddle3D_api/bev_fusion/model.py +2 -2
- paddlex/repo_apis/PaddleClas_api/cls/config.py +1 -1
- paddlex/repo_apis/PaddleClas_api/cls/model.py +1 -1
- paddlex/repo_apis/PaddleClas_api/cls/register.py +10 -0
- paddlex/repo_apis/PaddleClas_api/cls/runner.py +1 -1
- paddlex/repo_apis/PaddleDetection_api/instance_seg/model.py +1 -1
- paddlex/repo_apis/PaddleDetection_api/instance_seg/runner.py +1 -1
- paddlex/repo_apis/PaddleDetection_api/object_det/config.py +1 -1
- paddlex/repo_apis/PaddleDetection_api/object_det/model.py +1 -1
- paddlex/repo_apis/PaddleDetection_api/object_det/official_categories.py +25 -0
- paddlex/repo_apis/PaddleDetection_api/object_det/register.py +30 -0
- paddlex/repo_apis/PaddleDetection_api/object_det/runner.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/formula_rec/config.py +3 -3
- paddlex/repo_apis/PaddleOCR_api/formula_rec/model.py +5 -9
- paddlex/repo_apis/PaddleOCR_api/formula_rec/register.py +27 -0
- paddlex/repo_apis/PaddleOCR_api/formula_rec/runner.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/table_rec/model.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/table_rec/runner.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/text_det/model.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/text_det/register.py +18 -0
- paddlex/repo_apis/PaddleOCR_api/text_det/runner.py +1 -1
- paddlex/repo_apis/PaddleOCR_api/text_rec/config.py +3 -3
- paddlex/repo_apis/PaddleOCR_api/text_rec/model.py +5 -9
- paddlex/repo_apis/PaddleOCR_api/text_rec/register.py +18 -0
- paddlex/repo_apis/PaddleOCR_api/text_rec/runner.py +1 -1
- paddlex/repo_apis/PaddleSeg_api/seg/model.py +1 -1
- paddlex/repo_apis/PaddleSeg_api/seg/runner.py +1 -1
- paddlex/repo_apis/PaddleTS_api/ts_ad/config.py +3 -3
- paddlex/repo_apis/PaddleTS_api/ts_cls/config.py +2 -2
- paddlex/repo_apis/PaddleTS_api/ts_fc/config.py +4 -4
- paddlex/repo_apis/PaddleVideo_api/video_cls/config.py +1 -1
- paddlex/repo_apis/PaddleVideo_api/video_cls/model.py +1 -1
- paddlex/repo_apis/PaddleVideo_api/video_cls/runner.py +1 -1
- paddlex/repo_apis/PaddleVideo_api/video_det/config.py +1 -1
- paddlex/repo_apis/PaddleVideo_api/video_det/model.py +1 -1
- paddlex/repo_apis/PaddleVideo_api/video_det/runner.py +1 -1
- paddlex/repo_apis/base/config.py +1 -1
- paddlex/repo_manager/core.py +3 -3
- paddlex/repo_manager/meta.py +6 -2
- paddlex/repo_manager/repo.py +17 -16
- paddlex/utils/custom_device_list.py +26 -2
- paddlex/utils/deps.py +1 -1
- paddlex/utils/device.py +15 -8
- paddlex/utils/env.py +4 -0
- paddlex/utils/flags.py +2 -4
- paddlex/utils/fonts/__init__.py +34 -4
- paddlex/utils/misc.py +1 -1
- {paddlex-3.0.0rc1.dist-info → paddlex-3.0.1.dist-info}/METADATA +52 -56
- {paddlex-3.0.0rc1.dist-info → paddlex-3.0.1.dist-info}/RECORD +233 -206
- {paddlex-3.0.0rc1.dist-info → paddlex-3.0.1.dist-info}/WHEEL +1 -1
- {paddlex-3.0.0rc1.dist-info → paddlex-3.0.1.dist-info}/entry_points.txt +0 -0
- {paddlex-3.0.0rc1.dist-info → paddlex-3.0.1.dist-info}/licenses/LICENSE +0 -0
- {paddlex-3.0.0rc1.dist-info → paddlex-3.0.1.dist-info}/top_level.txt +0 -0
@@ -23,14 +23,14 @@ class TextDetEvaluator(BaseEvaluator):
|
|
23
23
|
entities = MODELS
|
24
24
|
|
25
25
|
def update_config(self):
|
26
|
-
"""update
|
26
|
+
"""update evaluation config"""
|
27
27
|
if self.eval_config.log_interval:
|
28
28
|
self.pdx_config.update_log_interval(self.eval_config.log_interval)
|
29
29
|
|
30
30
|
self.pdx_config.update_dataset(self.global_config.dataset_dir, "TextDetDataset")
|
31
31
|
|
32
32
|
def get_eval_kwargs(self) -> dict:
|
33
|
-
"""get key-value arguments of model
|
33
|
+
"""get key-value arguments of model evaluation function
|
34
34
|
|
35
35
|
Returns:
|
36
36
|
dict: the arguments of evaluation function.
|
@@ -25,7 +25,7 @@ class TextRecEvaluator(BaseEvaluator):
|
|
25
25
|
entities = MODELS
|
26
26
|
|
27
27
|
def update_config(self):
|
28
|
-
"""update
|
28
|
+
"""update evaluation config"""
|
29
29
|
if self.eval_config.log_interval:
|
30
30
|
self.pdx_config.update_log_interval(self.eval_config.log_interval)
|
31
31
|
if self.global_config["model"] == "LaTeX_OCR_rec":
|
@@ -53,7 +53,7 @@ class TextRecEvaluator(BaseEvaluator):
|
|
53
53
|
self.pdx_config.update_label_dict_path(label_dict_path)
|
54
54
|
|
55
55
|
def get_eval_kwargs(self) -> dict:
|
56
|
-
"""get key-value arguments of model
|
56
|
+
"""get key-value arguments of model evaluation function
|
57
57
|
|
58
58
|
Returns:
|
59
59
|
dict: the arguments of evaluation function.
|
@@ -41,7 +41,7 @@ class TSADEvaluator(BaseEvaluator):
|
|
41
41
|
return config_path
|
42
42
|
|
43
43
|
def update_config(self):
|
44
|
-
"""update
|
44
|
+
"""update evaluation config"""
|
45
45
|
self.pdx_config.update_dataset(self.global_config.dataset_dir, "TSADDataset")
|
46
46
|
self.pdx_config.update_weights(self.eval_config.weight_path)
|
47
47
|
|
@@ -56,7 +56,7 @@ class TSADEvaluator(BaseEvaluator):
|
|
56
56
|
)
|
57
57
|
|
58
58
|
def get_eval_kwargs(self) -> dict:
|
59
|
-
"""get key-value arguments of model
|
59
|
+
"""get key-value arguments of model evaluation function
|
60
60
|
|
61
61
|
Returns:
|
62
62
|
dict: the arguments of evaluation function.
|
@@ -55,7 +55,7 @@ def split_dataset(root_dir, train_rate, val_rate, group_id="group_id"):
|
|
55
55
|
df = df.drop_duplicates(keep="first")
|
56
56
|
|
57
57
|
group_unique = df[group_id].unique()
|
58
|
-
dfs = [] #
|
58
|
+
dfs = [] # separate multiple group
|
59
59
|
for column in group_unique:
|
60
60
|
df_one = df[df[group_id].isin([column])]
|
61
61
|
df_one = df_one.drop_duplicates(subset=["time"], keep="first")
|
@@ -41,11 +41,11 @@ class TSCLSEvaluator(BaseEvaluator):
|
|
41
41
|
return config_path
|
42
42
|
|
43
43
|
def update_config(self):
|
44
|
-
"""update
|
44
|
+
"""update evaluation config"""
|
45
45
|
self.pdx_config.update_dataset(self.global_config.dataset_dir, "TSCLSDataset")
|
46
46
|
|
47
47
|
def get_eval_kwargs(self) -> dict:
|
48
|
-
"""get key-value arguments of model
|
48
|
+
"""get key-value arguments of model evaluation function
|
49
49
|
|
50
50
|
Returns:
|
51
51
|
dict: the arguments of evaluation function.
|
@@ -41,11 +41,11 @@ class TSFCEvaluator(BaseEvaluator):
|
|
41
41
|
return config_path
|
42
42
|
|
43
43
|
def update_config(self):
|
44
|
-
"""update
|
44
|
+
"""update evaluation config"""
|
45
45
|
self.pdx_config.update_dataset(self.global_config.dataset_dir, "TSDataset")
|
46
46
|
|
47
47
|
def get_eval_kwargs(self) -> dict:
|
48
|
-
"""get key-value arguments of model
|
48
|
+
"""get key-value arguments of model evaluation function
|
49
49
|
|
50
50
|
Returns:
|
51
51
|
dict: the arguments of evaluation function.
|
@@ -22,7 +22,7 @@ class VideoClsEvaluator(BaseEvaluator):
|
|
22
22
|
entities = MODELS
|
23
23
|
|
24
24
|
def update_config(self):
|
25
|
-
"""update
|
25
|
+
"""update evaluation config"""
|
26
26
|
if self.eval_config.log_interval:
|
27
27
|
self.pdx_config.update_log_interval(self.eval_config.log_interval)
|
28
28
|
self.pdx_config.update_dataset(
|
@@ -33,7 +33,7 @@ class VideoClsEvaluator(BaseEvaluator):
|
|
33
33
|
self.pdx_config.update_pretrained_weights(self.eval_config.weight_path)
|
34
34
|
|
35
35
|
def get_eval_kwargs(self) -> dict:
|
36
|
-
"""get key-value arguments of model
|
36
|
+
"""get key-value arguments of model evaluation function
|
37
37
|
|
38
38
|
Returns:
|
39
39
|
dict: the arguments of evaluation function.
|
@@ -22,7 +22,7 @@ class VideoDetEvaluator(BaseEvaluator):
|
|
22
22
|
entities = MODELS
|
23
23
|
|
24
24
|
def update_config(self):
|
25
|
-
"""update
|
25
|
+
"""update evaluation config"""
|
26
26
|
if self.eval_config.log_interval:
|
27
27
|
self.pdx_config.update_log_interval(self.eval_config.log_interval)
|
28
28
|
self.pdx_config.update_dataset(
|
@@ -31,7 +31,7 @@ class VideoDetEvaluator(BaseEvaluator):
|
|
31
31
|
self.pdx_config.update_pretrained_weights(self.eval_config.weight_path)
|
32
32
|
|
33
33
|
def get_eval_kwargs(self) -> dict:
|
34
|
-
"""get key-value arguments of model
|
34
|
+
"""get key-value arguments of model evaluation function
|
35
35
|
|
36
36
|
Returns:
|
37
37
|
dict: the arguments of evaluation function.
|
paddlex/ops/__init__.py
CHANGED
@@ -114,7 +114,7 @@ class PaddleXCustomOperatorModule(ModuleType):
|
|
114
114
|
with filelock.FileLock(lockfile):
|
115
115
|
return paddle_jit_load(name=self.modulename, sources=sources, **args)
|
116
116
|
except:
|
117
|
-
logging.error("{}
|
117
|
+
logging.error("{} built fail!".format(self.modulename))
|
118
118
|
raise
|
119
119
|
|
120
120
|
def _load_module(self):
|
@@ -126,7 +126,7 @@ class PaddleXCustomOperatorModule(ModuleType):
|
|
126
126
|
"No custom op {} found, try JIT build".format(self.modulename)
|
127
127
|
)
|
128
128
|
self.module = self.jit_build()
|
129
|
-
logging.info("{}
|
129
|
+
logging.info("{} built success!".format(self.modulename))
|
130
130
|
|
131
131
|
# refresh
|
132
132
|
sys.modules[self.fullname] = self.module
|
paddlex/paddlex_cli.py
CHANGED
@@ -66,15 +66,9 @@ def args_cfg():
|
|
66
66
|
################# install pdx #################
|
67
67
|
install_group.add_argument(
|
68
68
|
"--install",
|
69
|
-
action="store_true",
|
70
|
-
default=False,
|
71
|
-
help="Install specified PaddleX plugins.",
|
72
|
-
)
|
73
|
-
install_group.add_argument(
|
74
|
-
"plugins",
|
75
69
|
nargs="*",
|
76
|
-
|
77
|
-
help="
|
70
|
+
metavar="PLUGIN",
|
71
|
+
help="Install specified PaddleX plugins.",
|
78
72
|
)
|
79
73
|
install_group.add_argument(
|
80
74
|
"--no_deps",
|
@@ -193,7 +187,10 @@ def args_cfg():
|
|
193
187
|
pipeline = args.pipeline
|
194
188
|
pipeline_args = []
|
195
189
|
|
196
|
-
if
|
190
|
+
if (
|
191
|
+
not (args.install is not None or args.serve or args.paddle2onnx)
|
192
|
+
and pipeline is not None
|
193
|
+
):
|
197
194
|
if os.path.isfile(pipeline):
|
198
195
|
pipeline_name = load_pipeline_config(pipeline)["pipeline_name"]
|
199
196
|
else:
|
@@ -247,7 +244,12 @@ def install(args):
|
|
247
244
|
if device_type == "cpu":
|
248
245
|
package = "ultra-infer-python"
|
249
246
|
elif device_type == "gpu":
|
250
|
-
|
247
|
+
cuda_version = get_paddle_cuda_version()
|
248
|
+
if not cuda_version:
|
249
|
+
sys.exit(
|
250
|
+
"No CUDA version found. Please make sure you have installed PaddlePaddle with CUDA enabled."
|
251
|
+
)
|
252
|
+
if cuda_version[0] != 11:
|
251
253
|
sys.exit(
|
252
254
|
"You are not using PaddlePaddle compiled with CUDA 11. Currently, CUDA versions other than 11.x are not supported by the high-performance inference plugin."
|
253
255
|
)
|
@@ -263,7 +265,7 @@ def install(args):
|
|
263
265
|
# Disable eager initialization
|
264
266
|
os.environ["PADDLE_PDX_EAGER_INIT"] = "False"
|
265
267
|
|
266
|
-
plugins = args.
|
268
|
+
plugins = args.install[:]
|
267
269
|
|
268
270
|
if "serving" in plugins:
|
269
271
|
plugins.remove("serving")
|
@@ -435,8 +437,9 @@ def main():
|
|
435
437
|
parser.print_help()
|
436
438
|
sys.exit(2)
|
437
439
|
|
438
|
-
if args.install:
|
440
|
+
if args.install is not None:
|
439
441
|
install(args)
|
442
|
+
return
|
440
443
|
elif args.serve:
|
441
444
|
serve(
|
442
445
|
args.pipeline,
|
@@ -446,12 +449,14 @@ def main():
|
|
446
449
|
host=args.host,
|
447
450
|
port=args.port,
|
448
451
|
)
|
452
|
+
return
|
449
453
|
elif args.paddle2onnx:
|
450
454
|
paddle_to_onnx(
|
451
455
|
args.paddle_model_dir,
|
452
456
|
args.onnx_model_dir,
|
453
457
|
opset_version=args.opset_version,
|
454
458
|
)
|
459
|
+
return
|
455
460
|
else:
|
456
461
|
if args.get_pipeline_config is not None:
|
457
462
|
interactive_get_pipeline(args.get_pipeline_config, args.save_path)
|
@@ -464,7 +469,7 @@ def main():
|
|
464
469
|
pipeline_args_dict[arg_name] = getattr(args, arg_name)
|
465
470
|
else:
|
466
471
|
logging.warning(f"Argument {arg_name} is missing in args")
|
467
|
-
|
472
|
+
pipeline_predict(
|
468
473
|
args.pipeline,
|
469
474
|
args.input,
|
470
475
|
args.device,
|
@@ -473,3 +478,4 @@ def main():
|
|
473
478
|
hpi_config=args.hpi_config,
|
474
479
|
**pipeline_args_dict,
|
475
480
|
)
|
481
|
+
return
|
@@ -54,7 +54,7 @@ class BEVFusionModel(BaseModel):
|
|
54
54
|
raise ValueError(f"`dy2st`={dy2st} is not supported.")
|
55
55
|
if device in ("cpu", "gpu"):
|
56
56
|
logging.warning(
|
57
|
-
f"The device type to use will be automatically determined, which may differ from the
|
57
|
+
f"The device type to use will be automatically determined, which may differ from the specified type: {repr(device)}."
|
58
58
|
)
|
59
59
|
|
60
60
|
# Update YAML config file
|
@@ -134,7 +134,7 @@ class BEVFusionModel(BaseModel):
|
|
134
134
|
|
135
135
|
if device in ("cpu", "gpu"):
|
136
136
|
logging.warning(
|
137
|
-
f"The device type to use will be automatically determined, which may differ from the
|
137
|
+
f"The device type to use will be automatically determined, which may differ from the specified type: {repr(device)}."
|
138
138
|
)
|
139
139
|
|
140
140
|
# Update YAML config file
|
@@ -464,7 +464,7 @@ indicating that no pretrained model to be used."
|
|
464
464
|
"""update directory that save predicting output
|
465
465
|
|
466
466
|
Args:
|
467
|
-
save_dir (str): the
|
467
|
+
save_dir (str): the directory path that save predicting output.
|
468
468
|
"""
|
469
469
|
self.update([f"Infer.save_dir={save_dir}"])
|
470
470
|
|
@@ -265,7 +265,7 @@ class ClsModel(BaseModel):
|
|
265
265
|
dict_path (str, optional): the label dict file path. Defaults to None.
|
266
266
|
|
267
267
|
Returns:
|
268
|
-
CompletedProcess: the result of
|
268
|
+
CompletedProcess: the result of inferring subprocess execution.
|
269
269
|
"""
|
270
270
|
model_dir = abspath(model_dir)
|
271
271
|
input_path = abspath(input_path)
|
@@ -896,6 +896,16 @@ register_model_info(
|
|
896
896
|
}
|
897
897
|
)
|
898
898
|
|
899
|
+
register_model_info(
|
900
|
+
{
|
901
|
+
"model_name": "PP-LCNet_x1_0_textline_ori",
|
902
|
+
"suite": "Cls",
|
903
|
+
"config_path": osp.join(PDX_CONFIG_DIR, "PP-LCNet_x1_0_textline_ori.yaml"),
|
904
|
+
"supported_apis": ["train", "evaluate", "predict", "export", "infer"],
|
905
|
+
"infer_config": "deploy/configs/inference_cls.yaml",
|
906
|
+
}
|
907
|
+
)
|
908
|
+
|
899
909
|
register_model_info(
|
900
910
|
{
|
901
911
|
"model_name": "PP-LCNet_x1_0_table_cls",
|
@@ -135,7 +135,7 @@ class ClsRunner(BaseRunner):
|
|
135
135
|
device (str): unused.
|
136
136
|
|
137
137
|
Returns:
|
138
|
-
CompletedProcess: the result of
|
138
|
+
CompletedProcess: the result of inferring subprocess execution.
|
139
139
|
"""
|
140
140
|
# `device` unused
|
141
141
|
cmd = [self.python, "python/predict_cls.py", "-c", config_path, *cli_args]
|
@@ -310,7 +310,7 @@ class InstanceSegModel(BaseModel):
|
|
310
310
|
save_dir (str, optional): the directory path to save output. Defaults to None.
|
311
311
|
|
312
312
|
Returns:
|
313
|
-
CompletedProcess: the result of
|
313
|
+
CompletedProcess: the result of inferring subprocess execution.
|
314
314
|
"""
|
315
315
|
model_dir = abspath(model_dir)
|
316
316
|
input_path = abspath(input_path)
|
@@ -138,7 +138,7 @@ class InstanceSegRunner(BaseRunner):
|
|
138
138
|
device (str): unused.
|
139
139
|
|
140
140
|
Returns:
|
141
|
-
CompletedProcess: the result of
|
141
|
+
CompletedProcess: the result of inferring subprocess execution.
|
142
142
|
"""
|
143
143
|
# `device` unused
|
144
144
|
cmd = [self.python, "deploy/python/infer.py", "--use_fd_format", *cli_args]
|
@@ -423,7 +423,7 @@ class DetConfig(BaseConfig, PPDetConfigMixin):
|
|
423
423
|
|
424
424
|
Args:
|
425
425
|
config (dict): the original config.
|
426
|
-
update_dict (dict): to be updated
|
426
|
+
update_dict (dict): to be updated parameters and its values
|
427
427
|
|
428
428
|
Example:
|
429
429
|
self._recursively_set(self.HybridEncoder, {'encoder_layer': {'dim_feedforward': 2048}})
|
@@ -335,7 +335,7 @@ class DetModel(BaseModel):
|
|
335
335
|
save_dir (str, optional): the directory path to save output. Defaults to None.
|
336
336
|
|
337
337
|
Returns:
|
338
|
-
CompletedProcess: the result of
|
338
|
+
CompletedProcess: the result of inferring subprocess execution.
|
339
339
|
"""
|
340
340
|
model_dir = abspath(model_dir)
|
341
341
|
input_path = abspath(input_path)
|
@@ -217,4 +217,29 @@ official_categories = {
|
|
217
217
|
{"name": "footer_image", "id": 21},
|
218
218
|
{"name": "aside_text", "id": 22},
|
219
219
|
],
|
220
|
+
"PP-DocLayout_plus-L": [
|
221
|
+
{"name": "paragraph_title", "id": 0},
|
222
|
+
{"name": "image", "id": 1},
|
223
|
+
{"name": "text", "id": 2},
|
224
|
+
{"name": "number", "id": 3},
|
225
|
+
{"name": "abstract", "id": 4},
|
226
|
+
{"name": "content", "id": 5},
|
227
|
+
{"name": "figure_title", "id": 6},
|
228
|
+
{"name": "formula", "id": 7},
|
229
|
+
{"name": "table", "id": 8},
|
230
|
+
{"name": "reference", "id": 9},
|
231
|
+
{"name": "doc_title", "id": 10},
|
232
|
+
{"name": "footnote", "id": 11},
|
233
|
+
{"name": "header", "id": 12},
|
234
|
+
{"name": "algorithm", "id": 13},
|
235
|
+
{"name": "footer", "id": 14},
|
236
|
+
{"name": "seal", "id": 15},
|
237
|
+
{"name": "chart", "id": 16},
|
238
|
+
{"name": "formula_number", "id": 17},
|
239
|
+
{"name": "aside_text", "id": 18},
|
240
|
+
{"name": "reference_content", "id": 19},
|
241
|
+
],
|
242
|
+
"PP-DocBlockLayout": [
|
243
|
+
{"name": "Region", "id": 0},
|
244
|
+
],
|
220
245
|
}
|
@@ -1103,3 +1103,33 @@ register_model_info(
|
|
1103
1103
|
},
|
1104
1104
|
}
|
1105
1105
|
)
|
1106
|
+
|
1107
|
+
register_model_info(
|
1108
|
+
{
|
1109
|
+
"model_name": "PP-DocLayout_plus-L",
|
1110
|
+
"suite": "Det",
|
1111
|
+
"config_path": osp.join(PDX_CONFIG_DIR, "PP-DocLayout_plus-L.yaml"),
|
1112
|
+
"supported_apis": ["train", "evaluate", "predict", "export", "infer"],
|
1113
|
+
"supported_dataset_types": ["COCODetDataset"],
|
1114
|
+
"supported_train_opts": {
|
1115
|
+
"device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
|
1116
|
+
"dy2st": False,
|
1117
|
+
"amp": ["OFF"],
|
1118
|
+
},
|
1119
|
+
}
|
1120
|
+
)
|
1121
|
+
|
1122
|
+
register_model_info(
|
1123
|
+
{
|
1124
|
+
"model_name": "PP-DocBlockLayout",
|
1125
|
+
"suite": "Det",
|
1126
|
+
"config_path": osp.join(PDX_CONFIG_DIR, "PP-DocBlockLayout.yaml"),
|
1127
|
+
"supported_apis": ["train", "evaluate", "predict", "export", "infer"],
|
1128
|
+
"supported_dataset_types": ["COCODetDataset"],
|
1129
|
+
"supported_train_opts": {
|
1130
|
+
"device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
|
1131
|
+
"dy2st": False,
|
1132
|
+
"amp": ["OFF"],
|
1133
|
+
},
|
1134
|
+
}
|
1135
|
+
)
|
@@ -138,7 +138,7 @@ class DetRunner(BaseRunner):
|
|
138
138
|
device (str): unused.
|
139
139
|
|
140
140
|
Returns:
|
141
|
-
CompletedProcess: the result of
|
141
|
+
CompletedProcess: the result of inferring subprocess execution.
|
142
142
|
"""
|
143
143
|
# `device` unused
|
144
144
|
cmd = [self.python, "deploy/python/infer.py", "--use_fd_format", *cli_args]
|
@@ -420,11 +420,11 @@ class FormulaRecConfig(BaseConfig):
|
|
420
420
|
self._update_save_interval(save_interval)
|
421
421
|
|
422
422
|
def _update_infer_img(self, infer_img: str, infer_list: str = None):
|
423
|
-
"""update image list to be
|
423
|
+
"""update image list to be inferred
|
424
424
|
|
425
425
|
Args:
|
426
|
-
infer_img (str): path to the image file to be
|
427
|
-
infer_list (str, optional): path to the .txt file containing the paths to image to be
|
426
|
+
infer_img (str): path to the image file to be inferred. It would be ignored when `infer_list` is be set.
|
427
|
+
infer_list (str, optional): path to the .txt file containing the paths to image to be inferred.
|
428
428
|
Defaults to None.
|
429
429
|
"""
|
430
430
|
if infer_list:
|
@@ -135,11 +135,9 @@ class FormulaRecModel(BaseModel):
|
|
135
135
|
# PDX related settings
|
136
136
|
device_type = device.split(":")[0]
|
137
137
|
uniform_output_enabled = kwargs.pop("uniform_output_enabled", True)
|
138
|
-
export_with_pir = kwargs.pop("export_with_pir", False)
|
139
138
|
config.update({"Global.uniform_output_enabled": uniform_output_enabled})
|
140
|
-
config.update({"Global.
|
141
|
-
|
142
|
-
config.update({"Global.export_with_pir": export_with_pir})
|
139
|
+
config.update({"Global.model_name": self.name})
|
140
|
+
config.update({"Global.export_with_pir": kwargs.pop("export_with_pir", False)})
|
143
141
|
|
144
142
|
self._assert_empty_kwargs(kwargs)
|
145
143
|
|
@@ -272,11 +270,9 @@ class FormulaRecModel(BaseModel):
|
|
272
270
|
|
273
271
|
# PDX related settings
|
274
272
|
uniform_output_enabled = kwargs.pop("uniform_output_enabled", True)
|
275
|
-
export_with_pir = kwargs.pop("export_with_pir", False)
|
276
273
|
config.update({"Global.uniform_output_enabled": uniform_output_enabled})
|
277
|
-
config.update({"Global.
|
278
|
-
|
279
|
-
config.update({"Global.export_with_pir": export_with_pir})
|
274
|
+
config.update({"Global.model_name": self.name})
|
275
|
+
config.update({"Global.export_with_pir": kwargs.pop("export_with_pir", False)})
|
280
276
|
|
281
277
|
self._assert_empty_kwargs(kwargs)
|
282
278
|
|
@@ -301,7 +297,7 @@ class FormulaRecModel(BaseModel):
|
|
301
297
|
save_dir (str, optional): the directory path to save output. Defaults to None.
|
302
298
|
|
303
299
|
Returns:
|
304
|
-
CompletedProcess: the result of
|
300
|
+
CompletedProcess: the result of inferring subprocess execution.
|
305
301
|
"""
|
306
302
|
config = self.config.copy()
|
307
303
|
cli_args = []
|
@@ -70,3 +70,30 @@ register_model_info(
|
|
70
70
|
"supported_apis": ["train", "evaluate", "predict", "export", "infer"],
|
71
71
|
}
|
72
72
|
)
|
73
|
+
|
74
|
+
register_model_info(
|
75
|
+
{
|
76
|
+
"model_name": "PP-FormulaNet_plus-S",
|
77
|
+
"suite": "FormulaRec",
|
78
|
+
"config_path": osp.join(PDX_CONFIG_DIR, "PP-FormulaNet_plus-S.yaml"),
|
79
|
+
"supported_apis": ["train", "evaluate", "predict", "export", "infer"],
|
80
|
+
}
|
81
|
+
)
|
82
|
+
|
83
|
+
register_model_info(
|
84
|
+
{
|
85
|
+
"model_name": "PP-FormulaNet_plus-M",
|
86
|
+
"suite": "FormulaRec",
|
87
|
+
"config_path": osp.join(PDX_CONFIG_DIR, "PP-FormulaNet_plus-M.yaml"),
|
88
|
+
"supported_apis": ["train", "evaluate", "predict", "export", "infer"],
|
89
|
+
}
|
90
|
+
)
|
91
|
+
|
92
|
+
register_model_info(
|
93
|
+
{
|
94
|
+
"model_name": "PP-FormulaNet_plus-L",
|
95
|
+
"suite": "FormulaRec",
|
96
|
+
"config_path": osp.join(PDX_CONFIG_DIR, "PP-FormulaNet_plus-L.yaml"),
|
97
|
+
"supported_apis": ["train", "evaluate", "predict", "export", "infer"],
|
98
|
+
}
|
99
|
+
)
|
@@ -131,7 +131,7 @@ class FormulaRecRunner(BaseRunner):
|
|
131
131
|
device (str): unused.
|
132
132
|
|
133
133
|
Returns:
|
134
|
-
CompletedProcess: the result of
|
134
|
+
CompletedProcess: the result of inferring subprocess execution.
|
135
135
|
"""
|
136
136
|
cmd = [self.python, "tools/infer/predict_rec.py", *cli_args]
|
137
137
|
return self.run_cmd(cmd, switch_wdir=True, echo=True, silent=False)
|
@@ -85,7 +85,7 @@ class TableRecModel(TextRecModel):
|
|
85
85
|
save_dir (str, optional): the directory path to save output. Defaults to None.
|
86
86
|
|
87
87
|
Returns:
|
88
|
-
CompletedProcess: the result of
|
88
|
+
CompletedProcess: the result of inferring subprocess execution.
|
89
89
|
"""
|
90
90
|
config = self.config.copy()
|
91
91
|
cli_args = []
|
@@ -45,7 +45,7 @@ class TableRecRunner(TextRecRunner):
|
|
45
45
|
device (str): unused.
|
46
46
|
|
47
47
|
Returns:
|
48
|
-
CompletedProcess: the result of
|
48
|
+
CompletedProcess: the result of inferring subprocess execution.
|
49
49
|
"""
|
50
50
|
cmd = [self.python, "ppstructure/table/predict_structure.py", *cli_args]
|
51
51
|
return self.run_cmd(cmd, switch_wdir=True, echo=True, silent=False)
|
@@ -41,7 +41,7 @@ class TextDetModel(TextRecModel):
|
|
41
41
|
save_dir (str, optional): the directory path to save output. Defaults to None.
|
42
42
|
|
43
43
|
Returns:
|
44
|
-
CompletedProcess: the result of
|
44
|
+
CompletedProcess: the result of inferring subprocess execution.
|
45
45
|
"""
|
46
46
|
config = self.config.copy()
|
47
47
|
cli_args = []
|
@@ -87,3 +87,21 @@ register_model_info(
|
|
87
87
|
"supported_apis": ["train", "evaluate", "predict", "export"],
|
88
88
|
}
|
89
89
|
)
|
90
|
+
|
91
|
+
register_model_info(
|
92
|
+
{
|
93
|
+
"model_name": "PP-OCRv5_server_det",
|
94
|
+
"suite": "TextDet",
|
95
|
+
"config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv5_server_det.yaml"),
|
96
|
+
"supported_apis": ["train", "evaluate", "predict", "export"],
|
97
|
+
}
|
98
|
+
)
|
99
|
+
|
100
|
+
register_model_info(
|
101
|
+
{
|
102
|
+
"model_name": "PP-OCRv5_mobile_det",
|
103
|
+
"suite": "TextDet",
|
104
|
+
"config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv5_mobile_det.yaml"),
|
105
|
+
"supported_apis": ["train", "evaluate", "predict", "export"],
|
106
|
+
}
|
107
|
+
)
|
@@ -46,7 +46,7 @@ class TextDetRunner(TextRecRunner):
|
|
46
46
|
device (str): unused.
|
47
47
|
|
48
48
|
Returns:
|
49
|
-
CompletedProcess: the result of
|
49
|
+
CompletedProcess: the result of inferring subprocess execution.
|
50
50
|
"""
|
51
51
|
# `config_path` and `device` unused
|
52
52
|
cmd = [self.python, "tools/infer/predict_det.py", *cli_args]
|
@@ -413,11 +413,11 @@ class TextRecConfig(BaseConfig):
|
|
413
413
|
self._update_save_interval(save_interval)
|
414
414
|
|
415
415
|
def _update_infer_img(self, infer_img: str, infer_list: str = None):
|
416
|
-
"""update image list to be
|
416
|
+
"""update image list to be inferred
|
417
417
|
|
418
418
|
Args:
|
419
|
-
infer_img (str): path to the image file to be
|
420
|
-
infer_list (str, optional): path to the .txt file containing the paths to image to be
|
419
|
+
infer_img (str): path to the image file to be inferred. It would be ignored when `infer_list` is be set.
|
420
|
+
infer_list (str, optional): path to the .txt file containing the paths to image to be inferred.
|
421
421
|
Defaults to None.
|
422
422
|
"""
|
423
423
|
if infer_list:
|