Explorar o código

polish docs and fix bugs

cuicheng01 hai 1 ano
pai
achega
e80b828489
Modificáronse 100 ficheiros con 443 adicións e 645 borrados
  1. 9 7
      README.md
  2. 1 3
      docs/tutorials/INSTALL.md
  3. 7 7
      docs/tutorials/inference/pipeline_inference_tools.md
  4. 8 13
      install_pdx.py
  5. 8 13
      main.py
  6. 8 13
      paddlex/__init__.py
  7. 1 1
      paddlex/configs/image_classification/CLIP_vit_base_patch16_224.yaml
  8. 1 1
      paddlex/configs/image_classification/CLIP_vit_large_patch14_224.yaml
  9. 1 1
      paddlex/configs/image_classification/ConvNeXt_tiny.yaml
  10. 1 1
      paddlex/configs/image_classification/MobileNetV2_x0_25.yaml
  11. 1 1
      paddlex/configs/image_classification/MobileNetV2_x0_5.yaml
  12. 1 1
      paddlex/configs/image_classification/MobileNetV2_x1_0.yaml
  13. 1 1
      paddlex/configs/image_classification/MobileNetV2_x1_5.yaml
  14. 1 1
      paddlex/configs/image_classification/MobileNetV2_x2_0.yaml
  15. 1 1
      paddlex/configs/image_classification/MobileNetV3_large_x0_35.yaml
  16. 1 1
      paddlex/configs/image_classification/MobileNetV3_large_x0_5.yaml
  17. 1 1
      paddlex/configs/image_classification/MobileNetV3_large_x0_75.yaml
  18. 1 1
      paddlex/configs/image_classification/MobileNetV3_large_x1_0.yaml
  19. 1 1
      paddlex/configs/image_classification/MobileNetV3_large_x1_25.yaml
  20. 1 1
      paddlex/configs/image_classification/MobileNetV3_small_x0_35.yaml
  21. 1 1
      paddlex/configs/image_classification/MobileNetV3_small_x0_5.yaml
  22. 1 1
      paddlex/configs/image_classification/MobileNetV3_small_x0_75.yaml
  23. 1 1
      paddlex/configs/image_classification/MobileNetV3_small_x1_0.yaml
  24. 1 1
      paddlex/configs/image_classification/MobileNetV3_small_x1_25.yaml
  25. 1 1
      paddlex/configs/image_classification/PP-HGNetV2-B0.yaml
  26. 1 1
      paddlex/configs/image_classification/PP-HGNetV2-B4.yaml
  27. 1 1
      paddlex/configs/image_classification/PP-HGNetV2-B6.yaml
  28. 1 1
      paddlex/configs/image_classification/PP-HGNet_small.yaml
  29. 1 1
      paddlex/configs/image_classification/PP-LCNet_x0_25.yaml
  30. 1 1
      paddlex/configs/image_classification/PP-LCNet_x0_35.yaml
  31. 1 1
      paddlex/configs/image_classification/PP-LCNet_x0_5.yaml
  32. 1 1
      paddlex/configs/image_classification/PP-LCNet_x0_75.yaml
  33. 1 1
      paddlex/configs/image_classification/PP-LCNet_x1_0.yaml
  34. 1 1
      paddlex/configs/image_classification/PP-LCNet_x1_5.yaml
  35. 1 1
      paddlex/configs/image_classification/PP-LCNet_x2_0.yaml
  36. 1 1
      paddlex/configs/image_classification/PP-LCNet_x2_5.yaml
  37. 1 1
      paddlex/configs/image_classification/ResNet101.yaml
  38. 1 1
      paddlex/configs/image_classification/ResNet152.yaml
  39. 1 1
      paddlex/configs/image_classification/ResNet18.yaml
  40. 1 1
      paddlex/configs/image_classification/ResNet34.yaml
  41. 1 1
      paddlex/configs/image_classification/ResNet50.yaml
  42. 1 1
      paddlex/configs/image_classification/SwinTransformer_base_patch4_window7_224.yaml
  43. 1 1
      paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml
  44. 1 1
      paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml
  45. 1 1
      paddlex/configs/object_detection/PP-YOLOE_plus-L.yaml
  46. 1 1
      paddlex/configs/object_detection/PP-YOLOE_plus-M.yaml
  47. 1 1
      paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml
  48. 1 1
      paddlex/configs/object_detection/PP-YOLOE_plus-X.yaml
  49. 1 1
      paddlex/configs/object_detection/PicoDet-L.yaml
  50. 1 1
      paddlex/configs/object_detection/PicoDet-S.yaml
  51. 1 1
      paddlex/configs/object_detection/RT-DETR-H.yaml
  52. 1 1
      paddlex/configs/object_detection/RT-DETR-L.yaml
  53. 1 1
      paddlex/configs/object_detection/RT-DETR-R18.yaml
  54. 1 1
      paddlex/configs/object_detection/RT-DETR-R50.yaml
  55. 1 1
      paddlex/configs/object_detection/RT-DETR-X.yaml
  56. 1 1
      paddlex/configs/semantic_segmentation/Deeplabv3-R101.yaml
  57. 1 1
      paddlex/configs/semantic_segmentation/Deeplabv3-R50.yaml
  58. 1 1
      paddlex/configs/semantic_segmentation/Deeplabv3_Plus-R101.yaml
  59. 1 1
      paddlex/configs/semantic_segmentation/Deeplabv3_Plus-R50.yaml
  60. 1 1
      paddlex/configs/semantic_segmentation/OCRNet_HRNet-W48.yaml
  61. 1 1
      paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml
  62. 1 1
      paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml
  63. 1 1
      paddlex/configs/text_detection/PP-OCRv4_server_det.yaml
  64. 1 1
      paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml
  65. 1 1
      paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml
  66. 10 15
      paddlex/engine.py
  67. 32 37
      paddlex/modules/__init__.py
  68. 8 13
      paddlex/modules/base/__init__.py
  69. 8 13
      paddlex/modules/base/build_model.py
  70. 8 13
      paddlex/modules/base/dataset_checker/__init__.py
  71. 12 18
      paddlex/modules/base/dataset_checker/dataset_checker.py
  72. 8 13
      paddlex/modules/base/dataset_checker/utils.py
  73. 15 25
      paddlex/modules/base/evaluator.py
  74. 8 13
      paddlex/modules/base/predictor/__init__.py
  75. 8 13
      paddlex/modules/base/predictor/io/__init__.py
  76. 8 13
      paddlex/modules/base/predictor/io/readers.py
  77. 8 13
      paddlex/modules/base/predictor/io/writers.py
  78. 8 13
      paddlex/modules/base/predictor/kernel_option.py
  79. 13 18
      paddlex/modules/base/predictor/predictor.py
  80. 8 13
      paddlex/modules/base/predictor/transform.py
  81. 8 13
      paddlex/modules/base/predictor/transforms/__init__.py
  82. 8 13
      paddlex/modules/base/predictor/transforms/image_common.py
  83. 8 13
      paddlex/modules/base/predictor/transforms/image_functions.py
  84. 8 13
      paddlex/modules/base/predictor/utils/__init__.py
  85. 8 13
      paddlex/modules/base/predictor/utils/batch.py
  86. 8 13
      paddlex/modules/base/predictor/utils/mixin.py
  87. 8 13
      paddlex/modules/base/predictor/utils/node.py
  88. 9 14
      paddlex/modules/base/predictor/utils/official_models.py
  89. 8 13
      paddlex/modules/base/predictor/utils/paddle_inference_predictor.py
  90. 8 13
      paddlex/modules/base/trainer/__init__.py
  91. 12 18
      paddlex/modules/base/trainer/train_deamon.py
  92. 14 23
      paddlex/modules/base/trainer/trainer.py
  93. 8 13
      paddlex/modules/base/utils/coco_eval.py
  94. 8 13
      paddlex/modules/base/utils/topk_eval.py
  95. 8 13
      paddlex/modules/image_classification/__init__.py
  96. 12 17
      paddlex/modules/image_classification/dataset_checker/__init__.py
  97. 8 13
      paddlex/modules/image_classification/dataset_checker/dataset_src/__init__.py
  98. 10 15
      paddlex/modules/image_classification/dataset_checker/dataset_src/analyse_dataset.py
  99. 12 18
      paddlex/modules/image_classification/dataset_checker/dataset_src/check_dataset.py
  100. 8 13
      paddlex/modules/image_classification/dataset_checker/dataset_src/split_dataset.py

+ 9 - 7
README.md

@@ -24,8 +24,8 @@ PaddleX3.0 分为本地端和云端,本地端提供统一任务API接口,支
 ## 安装与快速开始
 - [安装](./docs/tutorials/INSTALL.md)
 - 快速开始
-  - [单模型开发工具快速开始](./docs/tutorials/QUCK_STARTED.md)
-  - 模型产线开发工具快速开始(comming soon)
+  - [单模型开发工具](./docs/tutorials/tools/model_tools.md)
+  - [模型产线开发工具](./docs/tutorials/tools/pipelines_tools.md)
 
 ## 单模型开发工具
 本节介绍 PaddleX3.0 单模型的全流程开发流程,包括数据准备、模型训练/评估、模型推理的使用方法。PaddleX3.0 支持的模型可以参考 [PaddleX模型库](./docs/tutorials/models/support_model_list.md)。
@@ -35,17 +35,19 @@ PaddleX3.0 分为本地端和云端,本地端提供统一任务API接口,支
 - [数据标注](./docs/tutorials/data/annotation/README.md)
 - [数据校验](./docs/tutorials/data/dataset_check.md)
 ### 2. 模型训练
-- [模型训练/评估](./docs/tutorials/train/README.md)
-- 模型优化(comming soon)
+- [模型训练/评估](./docs/tutorials/base/README.md)
+- [模型优化](./docs/tutorials/base/model_optimize.md)
 
 ### 3. 模型推理
-- 模型推理能力即将开源,敬请期待...
+ - [模型推理](docs/tutorials/inference/model_inference_tools.md)
+ - [模型推理 API 介绍](docs/tutorials/inference/model_infernce_api.md)
 
 ## 模型产线开发工具
-本节将介绍 PaddleX3.0 模型产线的全流程开发流程,此部分内容即将开源,敬请期待...
+ - [模型产线推理](docs/tutorials/inference/pipeline_inference_tools.md)
+ - [模型产线推理 API 介绍](docs/tutorials/inference/pipeline_infernce_api.md)
 
 ## 多硬件支持
-🔥 本项目支持在多种硬件上进行模型的开发,除了GPU外,当前支持的硬件还有**昆仑芯**、**昇腾芯**、**寒武纪芯**。只需添加一个配置设备的参数,即可在对应硬件上使用上述工具。详情参考[多硬件训练](./docs/tutorials/train/multi_device_train.md)
+🔥 本项目支持在多种硬件上进行模型的开发,除了 GPU 外,当前支持的硬件还有**昆仑芯**、**昇腾芯**、**寒武纪芯**。只需添加一个配置设备的参数,即可在对应硬件上使用上述工具。详情可以参考上述文档
 
 - 昇腾芯支持的模型列表请参考 [PaddleX 昇腾芯模型列表](./docs/tutorials/models/support_npu_model_list.md)。
 - 昆仑芯支持的模型列表请参考 [PaddleX 昆仑芯模型列表](./docs/tutorials/models/support_xpu_model_list.md)。

+ 1 - 3
docs/tutorials/INSTALL.md

@@ -88,11 +88,9 @@ git clone https://gitee.com/paddlepaddle/PaddleX.git
 <!-- 这里需要指明安装成功的状态, 廷权 -->
 ```bash
 cd PaddleX
-# 安装第三方依赖
-pip install -r requirements.txt
 
 # 安装 PaddleX whl
-# -e:以可编辑模式安装,当前项目的代码更改,都会作用到 PaddleX Wheel
+# -e:以可编辑模式安装,当前项目的代码更改,都会直接作用到已经安装的 PaddleX Wheel
 pip install -e .
 
 # 安装 PaddleX 相关依赖

+ 7 - 7
docs/tutorials/inference/pipeline_inference_tools.md

@@ -38,7 +38,7 @@ result = pipeline.predict(
         {'input_path': "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"}
     )
 print(result["cls_result"])
-```    
+```  
 </details>
 
 ### 2.2 目标检测产线
@@ -71,8 +71,8 @@ from paddlex import PaddleInferenceOption
 model_name =  "RT-DETR-L"
 output_base = Path("output")
 
-output_dir = output_base / model_name
-pipeline = DetPipeline(model_name, output_dir=output_dir, kernel_option=PaddleInferenceOption())
+output = output_base / model_name
+pipeline = DetPipeline(model_name, output=output, kernel_option=PaddleInferenceOption())
 result = pipeline.predict(
         {"input_path": "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"})
 print(result["boxes"])
@@ -111,8 +111,8 @@ from paddlex import PaddleInferenceOption
 
 model_name = "PP-LiteSeg-T",
 output_base = Path("output")
-output_dir = output_base / model_name
-pipeline = SegPipeline(model_name, output_dir=output_dir, kernel_option=PaddleInferenceOption())
+output = output_base / model_name
+pipeline = SegPipeline(model_name, output=output, kernel_option=PaddleInferenceOption())
 result = pipeline.predict(
     {"input_path": "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_semantic_segmentation_002.png"}
 )
@@ -152,8 +152,8 @@ from paddlex import PaddleInferenceOption
 model_name =  "Mask-RT-DETR-L"
 output_base = Path("output")
 
-output_dir = output_base / model_name
-pipeline = DetPipeline(model_name, output_dir=output_dir, kernel_option=PaddleInferenceOption())
+output = output_base / model_name
+pipeline = DetPipeline(model_name, output=output, kernel_option=PaddleInferenceOption())
 result = pipeline.predict(
     {"input_path": "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_instance_segmentation_004.png"})
 print(result["boxes"])

+ 8 - 13
install_pdx.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import os
 import argparse
 from paddlex.repo_manager import setup, get_all_supported_repo_names

+ 8 - 13
main.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 from paddlex.engine import Engine
 
 if __name__ == "__main__":

+ 8 - 13
paddlex/__init__.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 import os
 

+ 1 - 1
paddlex/configs/image_classification/CLIP_vit_base_patch16_224.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/CLIP_vit_large_patch14_224.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/ConvNeXt_tiny.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV2_x0_25.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV2_x0_5.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV2_x1_0.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV2_x1_5.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV2_x2_0.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV3_large_x0_35.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV3_large_x0_5.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV3_large_x0_75.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV3_large_x1_0.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV3_large_x1_25.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV3_small_x0_35.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV3_small_x0_5.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV3_small_x0_75.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV3_small_x1_0.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/MobileNetV3_small_x1_25.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-HGNetV2-B0.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-HGNetV2-B4.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-HGNetV2-B6.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-HGNet_small.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-LCNet_x0_25.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-LCNet_x0_35.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-LCNet_x0_5.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-LCNet_x0_75.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-LCNet_x1_0.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-LCNet_x1_5.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-LCNet_x2_0.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/PP-LCNet_x2_5.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/ResNet101.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/ResNet152.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/ResNet18.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/ResNet34.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/ResNet50.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/image_classification/SwinTransformer_base_patch4_window7_224.yaml

@@ -32,7 +32,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/cls/cls_flowers_examples/images/image_00002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/instance_seg/instance_seg_coco_examples/images/aircraft-women-fashion-pilot-48797.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_instance_segmentation_004.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/instance_seg/instance_seg_coco_examples/images/aircraft-women-fashion-pilot-48797.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_instance_segmentation_004.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/object_detection/PP-YOLOE_plus-L.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/det/det_coco_examples/images/road0.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/object_detection/PP-YOLOE_plus-M.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/det/det_coco_examples/images/road0.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/det/det_coco_examples/images/road0.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/object_detection/PP-YOLOE_plus-X.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/det/det_coco_examples/images/road0.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/object_detection/PicoDet-L.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/det/det_coco_examples/images/road0.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/object_detection/PicoDet-S.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/det/det_coco_examples/images/road0.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/object_detection/RT-DETR-H.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/det/det_coco_examples/images/road0.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/object_detection/RT-DETR-L.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/det/det_coco_examples/images/road0.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/object_detection/RT-DETR-R18.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/det/det_coco_examples/images/road0.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/object_detection/RT-DETR-R50.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/det/det_coco_examples/images/road0.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/object_detection/RT-DETR-X.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model"
-  input_path: "/paddle/dataset/paddlex/det/det_coco_examples/images/road0.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/semantic_segmentation/Deeplabv3-R101.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model/model"
-  input_path: "/paddle/dataset/paddlex/seg/seg_optic_examples/images/H0002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_semantic_segmentation_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/semantic_segmentation/Deeplabv3-R50.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model/model"
-  input_path: "/paddle/dataset/paddlex/seg/seg_optic_examples/images/H0002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_semantic_segmentation_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/semantic_segmentation/Deeplabv3_Plus-R101.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model/model"
-  input_path: "/paddle/dataset/paddlex/seg/seg_optic_examples/images/H0002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_semantic_segmentation_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/semantic_segmentation/Deeplabv3_Plus-R50.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model/model"
-  input_path: "/paddle/dataset/paddlex/seg/seg_optic_examples/images/H0002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_semantic_segmentation_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/semantic_segmentation/OCRNet_HRNet-W48.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model/model"
-  input_path: "/paddle/dataset/paddlex/seg/seg_optic_examples/images/H0002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_semantic_segmentation_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_model/model"
-  input_path: "/paddle/dataset/paddlex/seg/seg_optic_examples/images/H0002.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_semantic_segmentation_002.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/text_detection/PP-OCRv4_mobile_det.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_accuracy"
-  input_path: "/paddle/dataset/paddlex/ocr_det/ocr_det_dataset_examples/images/train_img_100.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_001.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/text_detection/PP-OCRv4_server_det.yaml

@@ -31,7 +31,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_accuracy"
-  input_path: "/paddle/dataset/paddlex/ocr_det/ocr_det_dataset_examples/images/train_img_100.jpg"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_001.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml

@@ -30,7 +30,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_accuracy"
-  input_path: "/paddle/dataset/paddlex/ocr_rec/ocr_rec_dataset_examples/images/train_word_1003.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_rec_001.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 1 - 1
paddlex/configs/text_recognition/PP-OCRv4_server_rec.yaml

@@ -30,7 +30,7 @@ Evaluate:
 
 Predict:
   model_dir: "output/best_accuracy"
-  input_path: "/paddle/dataset/paddlex/ocr_rec/ocr_rec_dataset_examples/images/train_word_1003.png"
+  input_path: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_rec_001.png"
   kernel_option:
     run_mode: paddle
     batch_size: 1

+ 10 - 15
paddlex/engine.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import os
 
 from .modules.base import build_dataset_checker, build_trainer, build_evaluater, build_predictor
@@ -29,14 +24,14 @@ class Engine(object):
         self.config = config.get_config(
             args.config, overrides=args.override, show=False)
         self.mode = self.config.Global.mode
-        self.output_dir = self.config.Global.output
+        self.output = self.config.Global.output
 
     @try_except_decorator
     def run(self):
         """ the main function """
         if self.config.Global.mode == "check_dataset":
             dataset_checker = build_dataset_checker(self.config)
-            return dataset_checker.check_dataset()
+            return dataset_checker.check()
         elif self.config.Global.mode == "train":
             trainer = build_trainer(self.config)
             trainer.train()

+ 32 - 37
paddlex/modules/__init__.py

@@ -1,37 +1,32 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from .base import build_dataset_checker, build_trainer, build_evaluater, build_predictor, create_model, \
-PaddleInferenceOption
-from .image_classification import ClsDatasetChecker, ClsTrainer, ClsEvaluator, ClsPredictor
-from .object_detection import COCODatasetChecker, DetTrainer, DetEvaluator, DetPredictor
-from .text_detection import TextDetDatasetChecker, TextDetTrainer, TextDetEvaluator, TextDetPredictor
-from .text_recognition import TextRecDatasetChecker, TextRecTrainer, TextRecEvaluator, TextRecPredictor
-from .table_recognition import TableRecDatasetChecker, TableRecTrainer, TableRecEvaluator, TableRecPredictor
-from .semantic_segmentation import SegDatasetChecker, SegTrainer, SegEvaluator, SegPredictor
-from .instance_segmentation import COCOInstSegDatasetChecker, InstanceSegTrainer, InstanceSegEvaluator, \
-InstanceSegPredictor
-from .ts_anomaly_detection import TSADDatasetChecker, TSADTrainer, TSADEvaluator, TSADPredictor
-from .ts_classification import TSCLSDatasetChecker, TSCLSTrainer, TSCLSEvaluator, TSCLSPredictor
-from .ts_forecast import TSFCDatasetChecker, TSFCTrainer, TSFCEvaluator, TSFCPredictor
-
-from .base.predictor.transforms import image_common
-from .image_classification import transforms as cls_transforms
-from .object_detection import transforms as det_transforms
-from .text_detection import transforms as text_det_transforms
-from .text_recognition import transforms as text_rec_transforms
-from .table_recognition import transforms as table_rec_transforms
-from .semantic_segmentation import transforms as seg_transforms
-from .instance_segmentation import transforms as instance_seg_transforms
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
+#
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
+#
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
+from .base import build_dataset_checker, build_trainer, build_evaluater, build_predictor, create_model, \
+PaddleInferenceOption
+from .image_classification import ClsDatasetChecker, ClsTrainer, ClsEvaluator, ClsPredictor
+from .object_detection import COCODatasetChecker, DetTrainer, DetEvaluator, DetPredictor
+from .text_detection import TextDetDatasetChecker, TextDetTrainer, TextDetEvaluator, TextDetPredictor
+from .text_recognition import TextRecDatasetChecker, TextRecTrainer, TextRecEvaluator, TextRecPredictor
+from .table_recognition import TableRecDatasetChecker, TableRecTrainer, TableRecEvaluator, TableRecPredictor
+from .semantic_segmentation import SegDatasetChecker, SegTrainer, SegEvaluator, SegPredictor
+from .instance_segmentation import COCOInstSegDatasetChecker, InstanceSegTrainer, InstanceSegEvaluator, \
+InstanceSegPredictor
+from .ts_anomaly_detection import TSADDatasetChecker, TSADTrainer, TSADEvaluator, TSADPredictor
+from .ts_classification import TSCLSDatasetChecker, TSCLSTrainer, TSCLSEvaluator, TSCLSPredictor
+from .ts_forecast import TSFCDatasetChecker, TSFCTrainer, TSFCEvaluator, TSFCPredictor
+
+from .base.predictor.transforms import image_common
+from .image_classification import transforms as cls_transforms
+from .object_detection import transforms as det_transforms
+from .text_detection import transforms as text_det_transforms
+from .text_recognition import transforms as text_rec_transforms
+from .table_recognition import transforms as table_rec_transforms
+from .semantic_segmentation import transforms as seg_transforms
+from .instance_segmentation import transforms as instance_seg_transforms

+ 8 - 13
paddlex/modules/base/__init__.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 from .dataset_checker import build_dataset_checker, BaseDatasetChecker
 from .trainer import build_trainer, BaseTrainer, BaseTrainDeamon

+ 8 - 13
paddlex/modules/base/build_model.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import os
 from ...repo_apis.base import Config, PaddleModel
 from ...utils.device import get_device

+ 8 - 13
paddlex/modules/base/dataset_checker/__init__.py

@@ -1,17 +1,12 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 from .dataset_checker import build_dataset_checker, BaseDatasetChecker

+ 12 - 18
paddlex/modules/base/dataset_checker/dataset_checker.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import os
 from abc import ABC, abstractmethod
 
@@ -49,10 +44,9 @@ class BaseDatasetChecker(ABC, metaclass=AutoRegisterABCMetaClass):
         super().__init__()
         self.global_config = config.Global
         self.check_dataset_config = config.CheckDataset
-        self.output_dir = os.path.join(self.global_config.output,
-                                       "check_dataset")
+        self.output = os.path.join(self.global_config.output, "check_dataset")
 
-    def check_dataset(self) -> dict:
+    def check(self) -> dict:
         """execute dataset checking
 
         Returns:
@@ -60,8 +54,8 @@ class BaseDatasetChecker(ABC, metaclass=AutoRegisterABCMetaClass):
         """
         dataset_dir = self.get_dataset_root(self.global_config.dataset_dir)
 
-        if not os.path.exists(self.output_dir):
-            os.makedirs(self.output_dir)
+        if not os.path.exists(self.output):
+            os.makedirs(self.output)
 
         if self.check_dataset_config.get("convert", None):
             if self.check_dataset_config.convert.get("enable", False):

+ 8 - 13
paddlex/modules/base/dataset_checker/utils.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import os
 
 __all__ = [

+ 15 - 25
paddlex/modules/base/evaluator.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import os
 from pathlib import Path
 from abc import ABC, abstractmethod
@@ -100,7 +95,13 @@ class BaseEvaluator(ABC, metaclass=AutoRegisterABCMetaClass):
         Returns:
             dict: the evaluation metrics
         """
-        metrics = self.eval()
+        self.update_config()
+        # self.dump_config()
+        evaluate_result = self.pdx_model.evaluate(**self.get_eval_kwargs())
+        assert evaluate_result.returncode == 0, f"Encountered an unexpected error({evaluate_result.returncode}) in \
+evaling!"
+
+        metrics = evaluate_result.metrics
         assert self.check_return(
             metrics
         ), f"The return value({metrics}) of Evaluator.eval() is illegal!"
@@ -118,17 +119,6 @@ class BaseEvaluator(ABC, metaclass=AutoRegisterABCMetaClass):
                                             "config.yaml")
         self.pdx_config.dump(config_file_path)
 
-    def eval(self):
-        """firstly, update evaluation config, then evaluate model, finally return the evaluation result
-        """
-        self.update_config()
-        # self.dump_config()
-        evaluate_result = self.pdx_model.evaluate(**self.get_eval_kwargs())
-        assert evaluate_result.returncode == 0, f"Encountered an unexpected error({evaluate_result.returncode}) in \
-evaling!"
-
-        return evaluate_result.metrics
-
     def get_device(self, using_device_number: int=None) -> str:
         """get device setting from config
 

+ 8 - 13
paddlex/modules/base/predictor/__init__.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 from .predictor import BasePredictor, build_predictor, create_model
 from .transform import BaseTransform

+ 8 - 13
paddlex/modules/base/predictor/io/__init__.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 from .readers import (ImageReader, VideoReader, ReaderType)
 from .writers import (ImageWriter, TextWriter, WriterType)

+ 8 - 13
paddlex/modules/base/predictor/io/readers.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 import enum
 import itertools

+ 8 - 13
paddlex/modules/base/predictor/io/writers.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 import os
 import enum

+ 8 - 13
paddlex/modules/base/predictor/kernel_option.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 from functools import wraps, partial
 

+ 13 - 18
paddlex/modules/base/predictor/predictor.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 import os
 from copy import deepcopy
@@ -38,13 +33,13 @@ class BasePredictor(ABC, FromDictMixin, Node):
     def __init__(self,
                  model_dir,
                  kernel_option,
-                 output_dir,
+                 output,
                  pre_transforms=None,
                  post_transforms=None):
         super().__init__()
         self.model_dir = model_dir
         self.kernel_option = kernel_option
-        self.output_dir = output_dir
+        self.output = output
         self.other_src = self.load_other_src()
 
         logging.debug(
@@ -171,7 +166,7 @@ class PredictorBuilderByConfig(object):
         self.predictor = BasePredictor.get(model_name)(
             model_dir=model_dir,
             kernel_option=kernel_option,
-            output_dir=config.Global.output_dir,
+            output=config.Global.output,
             **predict_config)
 
     def predict(self):
@@ -189,7 +184,7 @@ def build_predictor(*args, **kwargs):
 def create_model(model_name,
                  model_dir=None,
                  kernel_option=None,
-                 output_dir=None,
+                 output="./",
                  pre_transforms=None,
                  post_transforms=None,
                  *args,
@@ -206,7 +201,7 @@ def create_model(model_name,
             BasePredictor.get(model_name)
     return BasePredictor.get(model_name)(model_dir=model_dir,
                                          kernel_option=kernel_option,
-                                         output_dir=output_dir,
+                                         output=output,
                                          pre_transforms=pre_transforms,
                                          post_transforms=post_transforms,
                                          *args,

+ 8 - 13
paddlex/modules/base/predictor/transform.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 import abc
 

+ 8 - 13
paddlex/modules/base/predictor/transforms/__init__.py

@@ -1,17 +1,12 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 from . import image_common

+ 8 - 13
paddlex/modules/base/predictor/transforms/image_common.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 import math
 from pathlib import Path

+ 8 - 13
paddlex/modules/base/predictor/transforms/image_functions.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 import cv2
 

+ 8 - 13
paddlex/modules/base/predictor/utils/__init__.py

@@ -1,15 +1,10 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""

+ 8 - 13
paddlex/modules/base/predictor/utils/batch.py

@@ -1,19 +1,14 @@
 # Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import inspect
 import functools
 import itertools

+ 8 - 13
paddlex/modules/base/predictor/utils/mixin.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 
 class FromDictMixin(object):

+ 8 - 13
paddlex/modules/base/predictor/utils/node.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import abc
 
 import inspect

+ 9 - 14
paddlex/modules/base/predictor/utils/official_models.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 from pathlib import Path
 
 from .....utils.cache import CACHE_DIR
@@ -171,7 +166,7 @@ class OfficialModelsDict(dict):
     def __getitem__(self, key):
         url = super().__getitem__(key)
         save_dir = Path(CACHE_DIR) / "official_models"
-        download_and_extract(url, save_dir, f"{key}", overwrite=True)
+        download_and_extract(url, save_dir, f"{key}", overwrite=False)
         return save_dir / f"{key}"
 
 

+ 8 - 13
paddlex/modules/base/predictor/utils/paddle_inference_predictor.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import os
 from paddle.inference import Config, create_predictor
 

+ 8 - 13
paddlex/modules/base/trainer/__init__.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 from .trainer import build_trainer, BaseTrainer
 from .train_deamon import BaseTrainDeamon

+ 12 - 18
paddlex/modules/base/trainer/train_deamon.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import os
 import sys
 import time
@@ -51,7 +46,7 @@ class BaseTrainDeamon(ABC):
         """ init """
         self.global_config = global_config
         self.init_pre_hook()
-        self.output_dir = global_config.output
+        self.output = global_config.output
         self.train_outputs = self.get_train_outputs()
         self.save_paths = self.get_save_paths()
         self.results = self.init_train_result()
@@ -90,7 +85,7 @@ class BaseTrainDeamon(ABC):
 
     def get_train_outputs(self):
         """ get training outputs dir """
-        return [Path(self.output_dir)]
+        return [Path(self.output)]
 
     def init_model_names(self):
         """ get models name """
@@ -99,8 +94,7 @@ class BaseTrainDeamon(ABC):
     def get_save_paths(self):
         """ get the path to save train_result.json """
         return [
-            Path(self.output_dir, save_name)
-            for save_name in self.get_save_names()
+            Path(self.output, save_name) for save_name in self.get_save_names()
         ]
 
     def init_configs(self):
@@ -125,7 +119,7 @@ class BaseTrainDeamon(ABC):
         return model_pkg
 
     def normlize_path(self, dict_obj, relative_to):
-        """ normlize path to string type path relative to the output_dir """
+        """ normlize path to string type path relative to the output """
         for key in dict_obj:
             if isinstance(dict_obj[key], dict):
                 self.normlize_path(dict_obj[key], relative_to)

+ 14 - 23
paddlex/modules/base/trainer/trainer.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import os
 from abc import ABC, abstractmethod
 from pathlib import Path
@@ -56,7 +51,12 @@ class BaseTrainer(ABC, metaclass=AutoRegisterABCMetaClass):
         """execute model training
         """
         os.makedirs(self.global_config.output, exist_ok=True)
-        self.train(*args, **kwargs)
+        self.update_config()
+        self.dump_config()
+        train_result = self.pdx_model.train(**self.get_train_kwargs())
+        assert train_result.returncode == 0, f"Encountered an unexpected error({train_result.returncode}) in \
+training!"
+
         self.deamon.stop()
 
     def dump_config(self, config_file_path: str=None):
@@ -71,15 +71,6 @@ class BaseTrainer(ABC, metaclass=AutoRegisterABCMetaClass):
                                             "config.yaml")
         self.pdx_config.dump(config_file_path)
 
-    def train(self):
-        """firstly, update and dump train config, then train model
-        """
-        self.update_config()
-        self.dump_config()
-        train_result = self.pdx_model.train(**self.get_train_kwargs())
-        assert train_result.returncode == 0, f"Encountered an unexpected error({train_result.returncode}) in \
-training!"
-
     def get_device(self, using_device_number: int=None) -> str:
         """get device setting from config
 

+ 8 - 13
paddlex/modules/base/utils/coco_eval.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import os
 import sys
 import argparse

+ 8 - 13
paddlex/modules/base/utils/topk_eval.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 import os
 import json
 import argparse

+ 8 - 13
paddlex/modules/image_classification/__init__.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 from .trainer import ClsTrainer
 from .dataset_checker import ClsDatasetChecker
 from .evaluator import ClsEvaluator

+ 12 - 17
paddlex/modules/image_classification/dataset_checker/__init__.py

@@ -1,29 +1,24 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 from pathlib import Path
 
 from ...base import BaseDatasetChecker
 from .dataset_src import check, split_dataset, deep_analyse
-from ..support_models import SUPPORT_MODELS
+from ..model_list import MODELS
 
 
 class ClsDatasetChecker(BaseDatasetChecker):
     """Dataset Checker for Image Classification Model
     """
-    support_models = SUPPORT_MODELS
+    entities = MODELS
     sample_num = 10
 
     def get_dataset_root(self, dataset_dir: str) -> str:
@@ -74,7 +69,7 @@ class ClsDatasetChecker(BaseDatasetChecker):
         Returns:
             dict: dataset summary.
         """
-        return check(dataset_dir, self.output_dir)
+        return check(dataset_dir, self.output)
 
     def analyse(self, dataset_dir: str) -> dict:
         """deep analyse dataset
@@ -85,7 +80,7 @@ class ClsDatasetChecker(BaseDatasetChecker):
         Returns:
             dict: the deep analysis results.
         """
-        return deep_analyse(dataset_dir, self.output_dir)
+        return deep_analyse(dataset_dir, self.output)
 
     def get_show_type(self) -> str:
         """get the show type of dataset

+ 8 - 13
paddlex/modules/image_classification/dataset_checker/dataset_src/__init__.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 from .check_dataset import check
 from .split_dataset import split_dataset
 from .analyse_dataset import deep_analyse

+ 10 - 15
paddlex/modules/image_classification/dataset_checker/dataset_src/analyse_dataset.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 import os
 import json
@@ -31,7 +26,7 @@ from .....utils.file_interface import custom_open
 from .....utils.fonts import PINGFANG_FONT_FILE_PATH
 
 
-def deep_analyse(dataset_path, output_dir):
+def deep_analyse(dataset_path, output):
     """class analysis for dataset"""
     tags = ['train', 'val']
     labels_cnt = defaultdict(str)
@@ -90,7 +85,7 @@ def deep_analyse(dataset_path, output_dir):
         fontsize=12)
     plt.legend(loc=1)
     fig.tight_layout()
-    file_path = os.path.join(output_dir, "histogram.png")
+    file_path = os.path.join(output, "histogram.png")
     fig.savefig(file_path, dpi=300)
 
     return {"histogram": os.path.join("check_dataset", "histogram.png")}

+ 12 - 18
paddlex/modules/image_classification/dataset_checker/dataset_src/check_dataset.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 import os
 import os.path as osp
@@ -24,7 +19,7 @@ from .....utils.errors import DatasetFileNotFoundError, CheckFailedError
 from .utils.visualizer import draw_label
 
 
-def check(dataset_dir, output_dir, sample_num=10):
+def check(dataset_dir, output, sample_num=10):
     """ check dataset """
     dataset_dir = osp.abspath(dataset_dir)
     # Custom dataset
@@ -95,7 +90,7 @@ def check(dataset_dir, output_dir, sample_num=10):
                     if not osp.exists(img_path):
                         raise DatasetFileNotFoundError(file_path=img_path)
 
-                    vis_save_dir = osp.join(output_dir, 'demo_img')
+                    vis_save_dir = osp.join(output, 'demo_img')
                     if not osp.exists(vis_save_dir):
                         os.makedirs(vis_save_dir)
 
@@ -107,8 +102,7 @@ def check(dataset_dir, output_dir, sample_num=10):
                                             osp.basename(file_name))
                         vis_im.save(vis_path)
                         sample_path = osp.join(
-                            'check_dataset',
-                            os.path.relpath(vis_path, output_dir))
+                            'check_dataset', os.path.relpath(vis_path, output))
                         sample_paths[tag].append(sample_path)
 
                     try:
@@ -121,7 +115,7 @@ def check(dataset_dir, output_dir, sample_num=10):
     num_classes = max(labels) + 1
 
     attrs = {}
-    attrs['label_file'] = osp.relpath(label_file, output_dir)
+    attrs['label_file'] = osp.relpath(label_file, output)
     attrs['num_classes'] = num_classes
     attrs['train_samples'] = sample_cnts['train']
     attrs['train_sample_paths'] = sample_paths['train']

+ 8 - 13
paddlex/modules/image_classification/dataset_checker/dataset_src/split_dataset.py

@@ -1,18 +1,13 @@
-# copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# !/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+################################################################################
 #
-#    http://www.apache.org/licenses/LICENSE-2.0
+# Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
 #
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
+################################################################################
+"""
+Author: PaddlePaddle Authors
+"""
 
 import os
 from random import shuffle

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio